MSVC: fix for failing tests due to strtod+hexadecimal literals

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at
Sun Mar 1 13:00:52 PST 2015

Hi all,
   MSVC's strtod does not deal correctly with hexadecimal floating 
point literals, resulting a few unittests failing. For example, 
the following program

import std.math, std.stdio;
void main() {

outputs "0" (zero), simply because std.math.PI is defined using a 
hex literal and LDC2 compiled with MSVC cannot deal with that.

I added
#if _MSC_VER <= 1800
to main.cpp, and then in std.math I defined PI and friends using 
decimal floating point literals for 

Is this a desired fix? (i.e. trying to make a better build with 
MSVC while we wait for the new version)

One positive effect of this change is that it un-hides some other 
failing tests.

thanks for comments,

More information about the digitalmars-d-ldc mailing list