Erreurs décimales : Différence entre versions

De Asso Val Libre
Aller à : navigation, rechercher
(Grand classique)
Ligne 1 : Ligne 1 :
 
== Grand classique ==
 
== Grand classique ==
 +
 +
  '''0.1+0.2 = ???'''
  
 
* https://docs.python.org/fr/2.7/tutorial/floatingpoint.html
 
* https://docs.python.org/fr/2.7/tutorial/floatingpoint.html

Version du 31 octobre 2019 à 16:07

Grand classique

 0.1+0.2 = ???
Python 
 Python 2.7.16 (default, Oct  7 2019, 17:36:04) 
 >>> 0.1+0.2
 0.30000000000000004
 >>> 0.1+0.2-0.3
 5.551115123125783e-17
Tcl 
 % puts [expr 0.1+0.2]
 0.30000000000000004
 % puts [expr 0.1+0.2-0.3]
 5.551115123125783e-17
Perl 
 echo "print 0.1+0.2" | perl
 0.3
 echo "print 0.1+0.2-0.3" | perl
 5.55111512312578e-17

OK

Numworks 
(calculatrice graphique basée Python)