I find bugs 1.7 + 1.4 = 3.0999999999999996!
I can not understand!
How to calculate more accuracy?
Fix the number of decimal places, say 3 or 5 to get a more readable result.
Why are you using length of
block for the decimal place numbers?
Use a simple number such as 4.
It is because according to the number of the decimal point
Can you place a simple number instead of this length of
block and see the outcome?
First see it working then try to enhance it.
When I use this
I get this
What is ‘floating’? That red ‘length’ block wants a string, and it might be crashing if you’re not feeding it a string.
If you’re trying to put in the actual value of the math (is floating = 3.9999999999996?), that won’t fix your floating point error. You need to round your answer to some reasonable number of display digits (and it could be something large, like 10 decimal places), not tell it to round to the digits it actually thinks it has, or else you won’t mask the floating point error.
Welcome back Dr. Sarisky. @catsarisky
with 5 decimal places. mine is ok
I think it is like this
For example: floating variable
0.1 + 0.11 → 1 < 2
than floating variable 2 → 0.21 (Correct to Two Decimal Places)
0.0001 +0.01 4 > 2
than floating variable 4 → 0.0101 (Correct to Four Decimal Places)
I set my example to 10 decimal places and then multiplied the result by 1 to get rid of extra zeros.
See this
Result
Hope this makes it clear.
Great, that is the final answer! appreciated!
must the answer multiply by one to get right!
This is just a trick to get rid of the extra 000 in the answer. You can do that same if you add ZERO to the answer.
In case you want the 000 to show then just remove the last step.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.