Skip to contentSkip to conversation

Return "nan" when calling fuction "strtod" of "stdlib.h"

imx6ulevk 夏星 1 participant 1 message Jan 19, 2016

lore
Share & tools
lore

夏星

author
#0 lore raw

Deer Enginneer:

I try to get a double number from a const char*, use function "strtod" of "stdlib.h" Program run well in ubuntu, but return "nan" in imx6ulevk.
My system version is : 2015.04-imx_v2015.04_3.14.38_6ul_ga+g5d63276

It seem like something wrong in stdlib, Could you pls give me some advise?

Looking forwared your kindly reply.

The test demo :
------------------------------------------------------------------------------
/* strtod example */
#include <stdio.h>
#include <stdlib.h>

int main ()
{
float f;
char *str = "12345.67";
f = strtod(str, NULL);
printf("string = %s float = %f\n", str, f);
return 0;
}

-------------------------------------------------------------------------------------------

------------------

BestRegards
夏星(xiaxing)
深圳市雪锐科技有限公司