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: 888 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Bonjour,
Le programme suivant génère des résultats différents suivant qu'on
le compile avec ocamlc ou ocamlopt :
type point = {x: float; y: float}
let pvect a b c d =
(b.x-.a.x).(d.y-.c.y)-.(d.x-.c.x).(b.y-.a.y)
let cross (a,b) (c,d) =
let pabcd = pvect a b c d in
let tc = pvect a c a b /. pabcd and ta = pvect a c c d /. pabcd in
tc > 0. && tc < 1. && ta > 0. && ta < 1.
let a = ({x = -117016.03; y = 171997.24}, {x = 13994.09; y = 18969.76})
let b = ({x = -76012.12; y = -579011.80}, {x = 13994.09; y = 18969.76})
barnier@beige:cstrexamples>uname -a
Linux beige 2.4.12 #7 Thu Jan 10 10:24:33 CET 2002 i686 unknown
barnier@beige:cstrexamples>ocamlc -v
The Objective Caml compiler, version 3.04
Standard library directory: /usr/lib/ocaml
Bon courage.
-- Nicolas
The text was updated successfully, but these errors were encountered:
Pas reproductible sur alpha. tc et ta sont tres proches de 1; je parie que
c'est un probleme d'arrondi a cause de la precision supplementaire des
flottants
natifs sur pentium. -- Damien
Correct guess -- XL
Original bug ID: 888
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Bonjour,
Le programme suivant génère des résultats différents suivant qu'on
le compile avec ocamlc ou ocamlopt :
type point = {x: float; y: float}
let pvect a b c d =
(b.x-.a.x).(d.y-.c.y)-.(d.x-.c.x).(b.y-.a.y)
let cross (a,b) (c,d) =
let pabcd = pvect a b c d in
let tc = pvect a c a b /. pabcd and ta = pvect a c c d /. pabcd in
tc > 0. && tc < 1. && ta > 0. && ta < 1.
let a = ({x = -117016.03; y = 171997.24}, {x = 13994.09; y = 18969.76})
let b = ({x = -76012.12; y = -579011.80}, {x = 13994.09; y = 18969.76})
let _ = Printf.printf "%b\n" (cross a b);;
barnier@beige:cstrexamples>bug.out
true
barnier@beige:cstrexamples>bug.opt
false
barnier@beige:cstrexamples>uname -a
Linux beige 2.4.12 #7 Thu Jan 10 10:24:33 CET 2002 i686 unknown
barnier@beige:cstrexamples>ocamlc -v
The Objective Caml compiler, version 3.04
Standard library directory: /usr/lib/ocaml
Bon courage.
-- Nicolas
The text was updated successfully, but these errors were encountered: