Always false float comparisons
Era Scarecrow via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 16 21:12:09 PDT 2016
On Monday, 16 May 2016 at 18:44:57 UTC, Jonathan M Davis wrote:
> On Sunday, May 15, 2016 15:49:27 Walter Bright via
> Digitalmars-d wrote:
>> My proposal removes the "whim" by requiring 128 bit precision
>> for CTFE.
>
> Based on some of the recent discussions, it sounds like having
> soft floating point in the compiler would also help with
> cross-compilation. So, completely aside from the precision
> chosen, it sounds like having a soft floating point
> implementation in CTFE would definitely help - though maybe I
> misunderstood. My understanding of the floating point stuff is
> pretty bad, unfortunately.
My understanding of floating point is bad too. I understand
fixed floating point (a number of bits is considered the
fraction) but as I recall while trying to break down and answer
questions while referring to as much of the information as I
could, the power/significand portion I got stuck when looking at
the raw bits and proper answers failed to come out.
As for soft floating point, I'd hopefully see an option to
control how much precision you can raise it to (so it would
probably be a template struct), as well as making it a library we
can use. Same with fixed integers which we could then incorporate
cent and ucent until such a time that the types are commonly
avaliable. (Afterall 128bit computers will come sooner or later,
maybe in 20 years? I doubt the memory model would need to move up
from 64bit though)
Although for implementation it could use BCD math instead (which
is easier to print off as decimal); Just specify the number of
digits for precision (40+), how many digits it can shift
larger/smaller; The floating point type would be related to the
8-bit computers of old but on steroids! Actually basic floating
point like that wouldn't be too hard to implement over a weekend.
More information about the Digitalmars-d
mailing list