Decimal string to floating point conversion with correct half-to-even rounding

kinke noone at
Tue Jul 7 23:56:45 UTC 2020

On Tuesday, 7 July 2020 at 23:52:05 UTC, 9il wrote:
> On Tuesday, 7 July 2020 at 16:38:39 UTC, kinke wrote:
>> So wouldn't the trivial 'fix' be using `strtod` for double 
>> literals and `strtof` for floats? [For LDC, we wouldn't rely 
>> on the host C runtime or a mir implementation, but use LLVM 
>> facilities anyway.]
> This should work if the C runtime handles the values correctly.

I've just opened a PR for DMD (and LDC too):

> Does this actually mean DMD wouldn't be able to compile itself 
> with DigigtalMars C runtime?

Sorry, I don't understand. - I think this excess precision was at 
some point considered a feature (but probably only for D, not for 
DigitalMars C), there's even a test making sure 0.9L and 0.9 are 
parsed to the same compile-time value.

More information about the Digitalmars-d-announce mailing list