caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Floating-point classification
@ 2001-01-22 11:42 Olivier Andrieu
  2001-01-25 16:05 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Andrieu @ 2001-01-22 11:42 UTC (permalink / raw)
  To: caml-list

Hello, 

Is there a way to test whether a float has value 'nan' or 'inf' ? I
didn't find in the standard library the equivalent of libc functions
isfinite() or isnan() (those are macros I think). 

I think that in C you can test if a float is nan by comparing it
with itself. It seems to work in  OCaml too :

        Objective Caml version 3.00

# let a = 0. /. 0. ;;
val a : float = nan
# a = a ;;
- : bool = false

Is it correct ? What about 'inf' ?

   Olivier



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-01-26 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-22 11:42 Floating-point classification Olivier Andrieu
2001-01-25 16:05 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).