浮点数
文章平均质量分 92
ziwuzu
这个作者很懒,什么都没留下…
展开
-
浮点数的二进制表示---------转载
浮点数相关,这个写的好 http://www.ruanyifeng.com/blog/2010/06/ieee_floating-point_representation.html 浮点数的二进制表示 作者: 阮一峰 日期: 2010年6月 6日 1. 前几天,我在读一本C语言教材,有一道例题: #include <stdio.h> v...原创 2014-04-06 16:39:21 · 115 阅读 · 0 评论 -
浮点数的二进制表示
在转载的文章中,看到了浮点数的表示, 自己写程序验证了下 public class TestFloat { public static void main(String[] args) { System.out.println(Float.toHexString(Float.MAX_VALUE)); System.out.println(Float.toString(Flo...2014-04-06 16:44:36 · 160 阅读 · 0 评论 -
浮点数计算钱
一..为什么不用浮点数算钱 1. 浮点运算在计算过程中需要对阶,而在对阶过程中可能损失精度,即尾数部分被舍弃。 public class TestDouble { public static void main(String[] args) { Double a = 1.0e15; for (int i = 0; i < 1000000; i++) { a +...2014-04-07 12:11:34 · 363 阅读 · 0 评论 -
十进制小数在二进制中的表示
有些在十进制中的有限小数,在二进制中变成了无限小数。 public static void main(String[] args) { Float a = 0.01f; System.out.println(a); System.out.println(Float.toHexString(a)); Double d = 0.01d; System.out.prin...2014-04-07 12:22:26 · 505 阅读 · 0 评论 -
BigDecimal教程-转载
How to Use Java BigDecimal: A Tutorial Contents [hide] 1 The Problem 2 Primer on Financial Issues 3 Introducing BigDecimal 4 Rounding and Scalin 5 Immutability and Arithmetic 6 ...原创 2014-04-07 12:23:35 · 194 阅读 · 0 评论