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.

What problems are caused by using binary floating-point?

0
10 Posted

What problems are caused by using binary floating-point?

0
10

Binary floating-point cannot exactly represent decimal fractions, so if binary floating-point is used it is not possible to guarantee that results will be the same as those using decimal arithmetic. This makes it extremely difficult to develop and test applications that use exact real-world data, such as commercial and financial values. Here are some specific examples: • Taking the number 9 and repeatedly dividing by ten yields the following results: Decimal Binary 0.9 0.09 0.009 0.0009 0.00009 0.000009 9E-7 9E-8 9E-9 9E-10 0.9 0.089999996 0.0090 9.0E-4 9.0E-5 9.0E-6 9.0000003E-7 9.0E-8 9.0E-9 8.9999996E-10 Here, the left hand column shows the results delivered by decimal floating-point arithmetic (such as the BigDecimal class for Java or the decNumber C package), and the right hand column shows the results obtained by using the Java float data type. The results from using the double data type are similar to the latter (with more repeated 9s or 0s). Some problems like this can be partl

What is your question?

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