Also, since the 0.1 cannot get any closer to the exact value of 1/10 and 0.3 cannot get any closer to the exact value of 3/10, then pre-rounding with round() function cannot help:
round(.1, 1) + round(.1, 1) + round(.1, 1) == round(.3, 1)
=> False
Même ça c'est faux. C'est pas tout à fait ce que tu as dit (restons stricts), mais là quand même... j'avoue que je me serais bien fait avoir.
Honnêtement, tu l'aurais anticipé ?
En théorie, la théorie et la pratique c'est pareil. En pratique c'est pas vrai.
[^] # Re: Rien de surprenant
Posté par gUI (Mastodon) . En réponse au journal [Humour] vers un monde différent. Évalué à 0.
OH MON DIEU !
Tiré de la doc de Python :
Also, since the 0.1 cannot get any closer to the exact value of 1/10 and 0.3 cannot get any closer to the exact value of 3/10, then pre-rounding with round() function cannot help:
round(.1, 1) + round(.1, 1) + round(.1, 1) == round(.3, 1)
=> False
Même ça c'est faux. C'est pas tout à fait ce que tu as dit (restons stricts), mais là quand même... j'avoue que je me serais bien fait avoir.
Honnêtement, tu l'aurais anticipé ?
En théorie, la théorie et la pratique c'est pareil. En pratique c'est pas vrai.