Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Résultats différents entre le byte code et le code natif sur des calculs en flottants #3203

Closed
vicuna opened this issue Feb 13, 2002 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 13, 2002

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

@vicuna
Copy link
Author

vicuna commented Feb 19, 2002

Comment author: administrator

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

@vicuna vicuna closed this as completed Feb 19, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant