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

toplevel float addition error #8500

Closed
vicuna opened this issue Mar 3, 2004 · 1 comment
Closed

toplevel float addition error #8500

vicuna opened this issue Mar 3, 2004 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 3, 2004

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

Bug description

Hi,

I just installed ocaml on my linux machine (kernel version
2.4.22gentoo-r7, SMP with 2 athlon-MP 2400s) and noticed the following
problem:

$> ocaml
Objective Caml version 3.07+14 (2004-02-03)

2.5555 +. 4.5555;;

  • : float = 7.11100000000000065

This only happens with specific numbers, however, and only in the
toplevel "interpreter" mode. The following program when loaded from a
file produces the correct output.

print_float (2.5555 +. 4.5555);;

On the toplevel, if the number is slightly different, there is also no
error.

2.5555 +. 5.5555;;

  • : float = 8.111

I didn't see this listed in the known bugs section, so I hope it's useful.

Mark

@vicuna
Copy link
Author

vicuna commented Apr 1, 2004

Comment author: administrator

Welcome to the world of floating-point arithmetic. All the outputs shown are
correct.

@vicuna vicuna closed this as completed Apr 1, 2004
@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