2
Mathematically speaking why it happens and how to fix the following "error" in python:
>>>10.53 % 1
0.5299999999999994
I’d like to understand how the python
works to obtain this value, why it occurs.
In fact to possible duplicate format the output via the command print
.
But I’d like to work without the print
...
Tries
a = 10.53 % 1
andprint("%.2f" % a)
:)– NoobSaibot
It is a mistake to use the [error tag]. :)
– Victor Stafusa
As to why this error occurred, the matter is discussed in this question: https://answall.com/q/219211/64969
– Jefferson Quesado
@Jeffersonquesado 2 fantastic answers, 1 more didactic other more technical, however maybe for me to get the answer I expected, the question should have been: "How is the module calculation" that by the way : >>>> https://answall.com/questions/93092/como-%C3%A9-made-o-c%C3%A1lculo-de-matem%C3%A1tica-do-m%C3%B3dulo-em-javascript Now doing a mix I’m beginning to understand... Vlw the tip;)
– MagicHat
@Magichat the intention was only to show why the representation give these errors. In fact, to better understand the module is much more interesting this question that you linked
– Jefferson Quesado