Convert double/float to string

后端 未结 7 1354
渐次进展
渐次进展 2020-11-29 04:55

I need to convert a floating point number to an equivalent string in decimal (or other base). Conversion at first needs to be done in the format xE+0 where

相关标签:
7条回答
  • 2020-11-29 05:17

    See if the BSD C Standard Library has fcvt(). You could start with the source for it that rather than writing your code from scratch. The UNIX 98 standard fcvt() apparently does not output scientific notation so you would have to implement it yourself, but I don't think it would be hard.

    0 讨论(0)
提交回复
热议问题