如何打印完整的浮点数而不是“1.01383e + 007”? [英] How to print full float numbers instead of "1.01383e+007"?

查看:410
本文介绍了如何打印完整的浮点数而不是“1.01383e + 007”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打印一些大的浮点数的完整合法值,但是当浮点数足够大时,您会得到这个符号,例如1.01383e + 007。如何获得合法值?

I want to print out the full legitimate value of some large summation of floats, but when floats are large enough you get this notation such as "1.01383e+007". How can you get the legitimate value?

推荐答案

浮点的一个重要特性是它们没有与所有对于大值,有效数字返回小数点。 科学显示合理地反映了固有的内部存储现实。

An important characteristic of floating point is that they do not have precision associated with all the significant figures back to the decimal point for large values. The "scientific" display reasonably reflects the inherent internal storage realities.

如果希望出现10138300(例如),请使用具有更多有效数字的数据类型,例如 double 以C族语言显示最多10个 15 的值。或者根据CPU体系结构和编程语言或环境使用扩展精度整数表示,例如 long long long

If you want 10138300 (for example) to appear, use a datatype which has more significant figures, such as double in the C family languages for values up to 1015 or so. Or use an extended precision integer representation, such as long or long long depending on the CPU architecture and programming language or environment.

这篇关于如何打印完整的浮点数而不是“1.01383e + 007”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆