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
Improved display of abnormal floats #8233
Comments
Comment author: administrator Hi Damien, Damien Doligez wrote (2003-07-26T20:51:04+0200):
Yes. I took a look at the source. I thought there was a special case
Thanks. The dot has obvious lexical problems. I like to be able to
Maybe the values that string_of_float ought to return a "nan", -cheers |
Comment author: administrator Hi John,
Not on my machine. I guess it depends on the C standard library.
This is now done in the working source.
I'm not sure I understand what you mean here. It would be easy -- Damien |
Comment author: administrator
By coincidence. The strings "nan", "inf", "-inf" depend on the C So, we can't guarantee that these names will match those of the float However, in the spirit of "the Caml toplevel should be able to read
|
Comment author: administrator Display of nan and inf: fixed by DD 2003-07-26 |
Original bug ID: 1781
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Float of string accepts the strings "nan", "inf" and "-inf".
Ocaml(top) always display those value with a dot at the end. eg.,
:; ocaml
Objective Caml version 3.07+beta 1
nan;;
infinity;;
neg_infinity;;
Could you get rid of the excess dot?
While we're on the topic, this behavior is good:
float_of_string "nan";;
float_of_string "inf";;
float_of_string "-inf";;
Why does entering those values only work for nan?
nan;;
inf;;
Unbound value inf
Oh, the ocamltop lexer treats "nan" as an identifier and there happens
to be a Pervasives.nan which is a handy coincidence. I almost was
going to mention that if the tokens "infinity" and "neg_infinity" were
used instead of "inf" and "-inf" this might be considered a good
thing. Most likely this is not a good thing.
The text was updated successfully, but these errors were encountered: