You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 140 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
le probleme touche a la comparaison de nombres de
type float. Il semble qu'il y ait une incoherence :
Objective Caml version 3.00
let decimales t = fst (modf t);;
val decimales : float -> float =
decimales 1.14;;
: float = 0.140000
decimales 2.14;;
: float = 0.140000
(decimales 1.14) = (decimales 2.14);;
: bool = false
0.140000 = 0.140000;;
: bool = true
Bienvenue dans le monde des nombres flottants ou tout est flou et rien
n'est jamais aussi simple qu'en math. Pour comprendre ce qui se
passe:
Printf.printf "%.20f" (decimales 1.14);;
0.13999999999999990000- : unit = ()
Printf.printf "%.20f" (decimales 2.14);;
0.14000000000000012000- : unit = ()
Printf.printf "%.20f" 0.140000;;
0.14000000000000001000- : unit = ()
Les trois nombres flottants (decimales 1.14), (decimales 2.14), et
0.140000 sont differents (et aucun n'est egal au nombre rationnel
0.14), mais l'affichage par defaut les arrondit malencontreusement.
Original bug ID: 140
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Vincent Cremet
Version: ocaml 3.00
OS: SunOS sun-demons 5.7 Generic_106541-04 sun4u sparc
Submission from: ext2.lri.fr (129.175.15.5)
Bonjour,
le probleme touche a la comparaison de nombres de
type float. Il semble qu'il y ait une incoherence :
let decimales t = fst (modf t);;
val decimales : float -> float =
decimales 1.14;;
decimales 2.14;;
(decimales 1.14) = (decimales 2.14);;
0.140000 = 0.140000;;
Cordialement,
Vincent Cremet.
Stagiaire DEA - equipe Demons au LRI
The text was updated successfully, but these errors were encountered: