From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA08815 for caml-red; Mon, 22 Jan 2001 22:58:42 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA29117 for ; Mon, 22 Jan 2001 12:42:07 +0100 (MET) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f0MBg6X05376 for ; Mon, 22 Jan 2001 12:42:06 +0100 (MET) Received: from akasha.ijm.jussieu.fr (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.10.0/jtpda-5.3.3) with ESMTP id f0MBg6q80627 for ; Mon, 22 Jan 2001 12:42:06 +0100 (CET) Received: (from andrieu@localhost) by akasha.ijm.jussieu.fr (8.9.3/8.9.3) id MAA32582; Mon, 22 Jan 2001 12:42:03 +0100 From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14956.7306.706689.299369@akasha.ijm.jussieu.fr> Date: Mon, 22 Jan 2001 12:42:02 +0100 To: caml-list@inria.fr Subject: Floating-point classification X-Mailer: VM 6.90 under Emacs 20.7.1 Sender: weis@pauillac.inria.fr 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