MSVC: fix for failing tests due to strtod+hexadecimal literals
Kai Nacke via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Fri Mar 6 11:09:54 PST 2015
On Thursday, 5 March 2015 at 05:00:04 UTC, Dan Olson wrote:
> "Johan Engelen" <j at j.nl> writes:
>> On Tuesday, 3 March 2015 at 22:12:39 UTC, Dan Olson wrote:
>>> Could David Gay's strtod() be used?
>> Thanks for that link. I had a look at David Gay's strtod() (a
>> complicated piece of code) and it also accepts hex floats .
>> I think it is clear that my hex parser is much simpler but also
>> more naive and may need quite some extra complication to make
>> deal with all corner cases (I am by no measure an expert on
>> fp). Although a fun exercise, I guess I should accept the fact
>> that David Gay's function is very much superior to mine :)
>> Should we replace MSVC's strtod() altogether with David Gay's,
>> use only the hex parser "gethex()"?
> Personally I don't know but it does look like the gethex()
> could be used. I would think whatever is easiest to keep going
> passes unittests. BTW, David Gay is listed as the author in
> BDS man
> page for strtod (uses by OS X).
> Another thing. Kai has worked on using LLVM'S own float
> support class. Seem to me like this will eventually be the
> best way to
> go as it does all this and will be consistent across platforms.
> appears to use this to parse float literals (I just grepped the
> P.S. exploringbinary is a fun website.
Thanks for the hint! I now use the LLVM functions instead of MSVC
strtold(). Maybe someone can comment on the test results?
More information about the digitalmars-d-ldc