Always false float comparisons
Era Scarecrow via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 15 17:08:08 PDT 2016
On Sunday, 15 May 2016 at 22:49:27 UTC, Walter Bright wrote:
> My proposal removes the "whim" by requiring 128 bit precision
> for CTFE.
Is there an option to use a reproducible fraction type that
doesn't have the issues floating point has?
Consider for most things perhaps this format would work better?
struct Ftype { //Ftype a placeholder name
long whole;
long fraction;
long divider;
}
Now 1.30 can perfectly be represented as Ftype(1,3,10) (or
13/10) and would never fail, represent incredibly small and
incredibly large things, just not nearly to the degree
floating/doubles could for scientific calculations, while at the
same time avoiding the imprecision (or requirement) of the FPU
entirely.
More information about the Digitalmars-d
mailing list