string to float conversion?

前端 未结 9 1841
-上瘾入骨i
-上瘾入骨i 2020-12-18 14:16

I\'m wondering what sort of algorithm could be used to take something like \"4.72\" into a float data type, equal to

float x = 4.72;
9条回答
  •  庸人自扰
    2020-12-18 14:50

    For C strtod() and C99 friends strtof() and strtold() (description on same link) already have that algorithm implemented.

    If you are having problems writing your own, post your code and specific questions about it.

提交回复
热议问题