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

Unable to get mentioned in documentation Num elements infinity and undefined #6290

Closed
vicuna opened this issue Jan 8, 2014 · 2 comments
Closed

Comments

@vicuna
Copy link

vicuna commented Jan 8, 2014

Original bug ID: 6290
Reporter: Marcgal
Status: closed (set by @xavierleroy on 2017-02-16T14:18:29Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 4.01.0
Category: otherlibs

Bug description

The documentation the Num library (http://caml.inria.fr/pub/docs/manual-ocaml/libref/Num.html) claims that "Numbers (type num) are arbitrary-precision rational numbers, plus the special elements 1/0 (infinity) and 0/0 (undefined)."

However, it seems that it is not possible to get these values since typing "(num_of_int 0)//(num_of_int 0)" or (num_of_int 1)//(num_of_int 0) produces Exception: Failure "create_ratio infinite or undefined rational number".

Happens in the toplevel as well as during execution of an Ocaml program compiled with Ocaml batch compiler or Ocaml native compiler. Tested in Ocaml version 4.01.0 and 3.12.1

@vicuna
Copy link
Author

vicuna commented Jan 20, 2015

Comment author: @damiendoligez

We should probably fix the docs.

@vicuna
Copy link
Author

vicuna commented Dec 6, 2015

Comment author: @xavierleroy

By default, special rationals (infinity and undefined) are flagged as errors. You can change this behavior with:

Arith_status.set_error_when_null_denominator false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant