D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4409 - to!double("-nan") throws
Summary: to!double("-nan") throws
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-30 07:32 UTC by David Simcha
Modified: 2010-08-11 13:58 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2010-06-30 07:32:09 UTC
import std.conv;

void main() {
    auto foo = to!double("nan");  // Works
    auto bar = to!double("-nan"); // Throws
}

std.conv.ConvError: std.conv(659): Can't convert value `-nan' of type const(char)[] to type double

It's important that the string "-nan" get converted properly to a NaN so that floating point numbers output to strings by writeln() can be read back properly.
Comment 1 David Simcha 2010-08-11 13:58:44 UTC
This appears to have been fixed in 2.048.  Must be related to the revamp of std.conv.