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

ARM float errors with ocamlc #3197

Closed
vicuna opened this issue Feb 9, 2002 · 2 comments
Closed

ARM float errors with ocamlc #3197

vicuna opened this issue Feb 9, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 9, 2002

Original bug ID: 881
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Christian Gillot
Version: 3.04
OS: linux
Submission from: 80-24-20-121.uc.nombres.ttd.es (80.24.20.121)

Hi,

Floats don't work with bytecode (ocamlrun) on the iPAQ.
You get strange results but on the native (ocamlopt) version
it works though. First I got this using a cross-compiled ocamlc
but later I compiled ocamlc natively and I get exactly the
same behaviour.
I don't know what's going on but if I can help tell me.
You can do tests natively by using the skiffcluster from Compaq CRL
see the following URL :
http://www.handhelds.org/projects/skiffcluster.html

The iPAQ has Linux 2.4.16/glibc 2.2.4 with Ocaml 3.04

let main () =
let x = 5.2 in
let y = 6.3 in
let z = x +. y in
print_float x;
print_string " + ";
print_float y;
print_string "=";
print_float z;
print_string "\n";;

main();;

In the native ocamlopt compiled version
you get the expected result. But in the
bytecode version here is what you get :

-9.25596534328e+61 + 4.66726164528e-62=-9.25596534328e+61

Thanks

@vicuna
Copy link
Author

vicuna commented Feb 11, 2002

Comment author: administrator

Floats don't work with bytecode (ocamlrun) on the iPAQ.
You get strange results but on the native (ocamlopt) version
it works though. First I got this using a cross-compiled ocamlc
but later I compiled ocamlc natively and I get exactly the
same behaviour.
I don't know what's going on but if I can help tell me.
You can do tests natively by using the skiffcluster from Compaq CRL
see the following URL :
http://www.handhelds.org/projects/skiffcluster.html

The iPAQ has Linux 2.4.16/glibc 2.2.4 with Ocaml 3.04

let main () =
let x = 5.2 in
let y = 6.3 in
let z = x +. y in
print_float x;
print_string " + ";
print_float y;
print_string "=";
print_float z;
print_string "\n";;

main();;

I tested the program above on skiffcluster5 using OCaml 3.04 and it
worked fine in bytecode. (I compiled OCaml on that machine a couple
of weeks ago and did not have the fortitude to recompile it again, so
something might have changed in their C compiler since then.)

AFAIK, floats are software emulated on the Strong Arm, either by the C
library or the kernel, and I have long suspected that the emulation
has a few quirks -- one of my test cases (an FFT implementation)
never produced the right results when compiled with ocamlopt, although
the bytecode version was OK. Still, the bytecode interpreter is a C
program like any other, so it is surprising that it would run into
floating-point problems that other C programs would not run into.

Best regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Feb 11, 2002

Comment author: administrator

Could not reproduce

@vicuna vicuna closed this as completed Feb 11, 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