算法IEEE 754双转换成字符串? [英] Algorithm to convert an IEEE 754 double to a string?
问题描述
许多编程语言提供的库函数对那些双打转换为字符串。例如,C有的sprintf
,C ++有字符串流
,Java有 Double.toString
等。
Many programming languages that use IEEE 754 doubles provide a library function to convert those doubles to strings. For example, C has sprintf
, C++ has stringstream
, Java has Double.toString
, etc.
在内部,如何这些功能的实现?也就是说,什么样的算法(S)他们是否使用转换双成字符串再presentation,因为他们往往受到程序员选择precision限制?
Internally, how are these functions implemented? That is, what algorithm(s) are they using to convert the double into a string representation, given that they are often subject to programmer-chosen precision limitations?
谢谢!
推荐答案
我相信你正在寻找的印刷浮点数快速,准确地
我发现了另外一个帖子,链接:<一href="http://stackoverflow.com/questions/2480790/exact-textual-re$p$psentation-of-an-ieee-double">here.
I found that link on another post: here.
这篇关于算法IEEE 754双转换成字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!