简体   繁体   English

java:如何将双精度数字转换为十进制

[英]java: how can I convert double precision numbers to decimal

I want to convert double precision numbers to decimal . 我想将双精度数字转换为十进制。

for example I have 23.43, the double value would be (using matlab) : 174 71 255 122 20 110 55 64 now having this how can I write a java program that gives me 23.43 ? 例如我有23.43,则双精度值将是(使用matlab):174 71 255 122 20 110 55 64现在有了这个,我如何编写一个给我23.43的Java程序?

and here is the calculation of double precision in matlab : 这是matlab中双精度的计算:

MATLAB constructs the double data type according to IEEE Standard 754 for double precision. MATLAB根据IEEE标准754构造双精度数据类型以实现双精度。 Any value stored as a double requires 64 bits, formatted as shown in the table below: 任何存储为double的值都需要64位,格式如下表所示:

Bits Usage 比特用法

63 Sign (0 = positive, 1 = negative) 63号(0 =正,1 =负)

62 to 52 Exponent, biased by 1023 62到52的指数,偏向1023

51 to 0 Fraction f of the number 1.f 51至0数1.f的分数f

long l = Double.doubleToLongBits(double);
double d = Double.longBitsToDouble(long);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在不损失Java精度的情况下将String转换为Double? - How can I convert String to Double without losing precision in Java? 如何在Java中将非常大的十进制数转换为二进制数 - How Can I Convert Very Large Decimal Numbers to Binary In Java 仅当双精度数为小数“.00”时,如何才能将双精度数转换为整数? (爪哇) - How can I convert a double to an integer only when the double has a decimal '.00'? (Java) Java:将float转换为保留双精度小数点的精度 - Java: convert float to double preserving decimal point precision 如何转换 ArrayList<string[]> 到包含十进制值的双[]?</string[]> - How can I convert an ArrayList<String[]> to a double[] that contains decimal values? 如何在 Java 中将双精度数截断为仅两位小数? - How can I truncate a double to only two decimal places in Java? 如何截断二维双数组中某些双数的小数位? - How can I cut off decimal places of some double numbers in a 2d double array? 在JAVA中输入小数或双数 - Input decimal or double numbers in JAVA 如何将double转换为2位小数? - How do I convert a double to 2 decimal places? 如何在 java 中故意创建随机浮点/十进制精度错误? - How can I intentionally create random floating point / decimal precision errors in java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM