Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why does the happen in floating point?

floating point
0
Posted

Why does the happen in floating point?

0

There are several unexpected things that seem to bite programmers with floating point. This is almost always a result of the programmer not being fully conversant with floating point arithmetic in general, rather than a problem relating to Java technology. The question of floating point accuracy comes up more than with C++ (for example) because of Sun’s decision in the println() method to print enough digits to distinguish the number from the next-closest number, rather than rounding it to 6 significant digits by default as the C/C++ libraries do. [ISO C, Sect 7.9.6.1, line 21 of “the double argument”] If you seem to be having problems with floating point, the problem probably stems from the fact that floating-point arithmetic is inherently imprecise. You can expect up to 7 digits of precision with floats and 16 digits with doubles. However, that does not mean that a number that can be exactly represented in 7 digits decimal or can be exactly represented as a binary floating point numb

0

There are several unexpected things that seem to bite programmers with floating point. This is almost always a result of the programmer not being fully conversant with floating point arithmetic in general, rather than a problem relating to Java technology. The question of floating point accuracy comes up more than with C++ (for example) because of Sun’s decision in the println() method to print enough digits to distinguish the number from the next-closest number, rather than rounding it to 6 significant digits by default as the C/C++ libraries do. [ISO C, Sect 7.9.6.1, line 21 of “the double argument”] If you seem to be having problems with floating point, the problem probably stems from the fact that floating-point arithmetic is inherently imprecise. You can expect up to 7 digits of precision with floats and 16 digits with doubles.

0
10

[*] There are several unexpected things that seem to bite programmers with floating point. This is almost always a result of the programmer not being fully conversant with floating point arithmetic in general, rather than a problem relating to Java. The question of floating point accuracy comes up with Java more than with C++ (for example) because of Java’s decision in the println() method to print enough digits to distinguish the number from the next-closest number, rather than rounding it to 6 significant digits by default as the C/C++ libraries do. [ISO C, Sect 7.9.6.1, line 21 of “the double argument”] If you seem to be having problems with floating point, the problem probably stems from the fact that floating-point arithmetic is inherently imprecise. You can expect up to 7 digits of precision with floats and 16 digits with doubles. However, that does not mean that a number that can be exactly represented in 7 digits decimal or can be exactly represented as a binary floating point

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123