problem with string conversion to double
Eric Klumpp
eric.klumpp at emailforever.com
Sun May 13 23:17:53 BST 2001
Hi everybody,
I have a problem to convert a string containing an integer value to a
double format.
My string, called txt, contain "0" or "1", and in both cases I do :
sscanf(txt,"%lf",&num) where num is a double. In both cases, num contain
"-NaN" and the sscanf return 1.
I have tried to replace "%lf" by a lot of other flag (%f, %g, %e, %lf,
%lg, %Lf, %Lg) but the result is the same. And same result by :
num=strtod(txt,NULL)
The only one solution I have found is to do : num=atof(txt)
Can someone explain me why the result is -NaN (-infinity) ?
And in the same time, has anybody a solution to convert long double to
string, and string to long double ?
Eric
PS : I use a string format in a database in order to backup and
manipulate all possible format. So doing I have a lot of conversions
between string and other types and in both way.
--
_____________________________________________________________
Eric Klumpp
\\\\\////
email : eric.klumpp at emailforever.com / ^ - \
eric.klumpp at freesbee.fr ( (o) (o) )
________________________________________oOOO____(_)____OOOo__
-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«
More information about the KDevelop
mailing list