Opened 9 years ago

Closed 9 years ago

#783 closed discussion (fixed)

convert<double>("-nan") fails

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.12
Component: utility Version: 0.11
Keywords: Cc:

Description

My program expect input to be double so it converts the string to a dounle using convert<double>. Now I got an exception thrown because the input was "-nan". The question is whether "-nan" is double or not. I can see the argument it's not bcs there is no such thing as a sign of a NaN. The reason I'm raising the question is that the input was created from a double:

double x;
double y;
<SNIP>
cout << (x/y) << "\n";

where in this case both a x and y were set to 0.0 inside <SNIP>.

Should we change the behaviour of convert so it accepts "-nan" for signed types?

Change History (2)

comment:1 Changed 9 years ago by Peter

Milestone: yat 0.x+yat 0.12
Owner: changed from Jari Häkkinen to Peter
Status: newassigned

comment:2 Changed 9 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [3177]) Change behaviour if convert<T> and is<T> so they accept "-nan" (case insensitively) as an argument if T is a signed type. closes #783

Note: See TracTickets for help on using tickets.