Yocto开发笔记之《Tip-stdlib库函数strtod返回nan错误》(QQ交流群:519230208)

2015.04-imx_v2015.04_3.14.38_6ul_ga+g5d63276 (Jan 04 2016 - 18:07:08)

FSL Community BSP : https://community.freescale.com/docs/DOC-99985

mail: meta-freescale@yoctoproject.org

============================================================

问题描述:

想通过字符串得到double型值,于是有了以下测试程序

/* strtod example */
#include <stdio.h>      /* printf, NULL */
#include <stdlib.h>     /* strtod */

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

在ubuntu返回值正常,在imx6的板子上每次却返回nan

解决方法:

 1. 更新C标准库,重新编译内核...

原文地址:https://www.cnblogs.com/alanfang/p/5142076.html