From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA20019; Sat, 1 Feb 2003 14:08:10 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 OAA19831 for ; Sat, 1 Feb 2003 14:08:09 +0100 (MET) Received: from fort-point-station.mit.edu (FORT-POINT-STATION.MIT.EDU [18.7.7.76]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h11D87P13577 for ; Sat, 1 Feb 2003 14:08:08 +0100 (MET) Received: from grand-central-station.mit.edu (GRAND-CENTRAL-STATION.MIT.EDU [18.7.21.82]) by fort-point-station.mit.edu (8.9.2/8.9.2) with ESMTP id IAA17592; Sat, 1 Feb 2003 08:08:06 -0500 (EST) Received: from melbourne-city-street.mit.edu (MELBOURNE-CITY-STREET.MIT.EDU [18.7.21.86]) by grand-central-station.mit.edu (8.9.2/8.9.2) with ESMTP id IAA20610; Sat, 1 Feb 2003 08:02:48 -0500 (EST) Received: from nerd-xing.mit.edu (NERD-XING.MIT.EDU [18.7.16.74]) by melbourne-city-street.mit.edu (8.9.2/8.9.2) with ESMTP id HAA21843; Sat, 1 Feb 2003 07:56:07 -0500 (EST) Received: (from jfc@localhost) by nerd-xing.mit.edu (8.9.3) id HAA06393; Sat, 1 Feb 2003 07:56:06 -0500 (EST) Message-Id: <200302011256.HAA06393@nerd-xing.mit.edu> To: Shawn Wagner cc: caml-list@inria.fr Subject: Re: [Caml-list] Finding the sign of a float In-Reply-To: Your message of "Fri, 31 Jan 2003 22:35:21 PST." <20030131223521.T22850@speakeasy.org> Date: Sat, 01 Feb 2003 07:56:06 -0500 From: John Carr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I'm looking for a way, in pure ocaml without having to bail out to C, to > tell if a float is negative or not. > > Just using x < 0.0 won't work, as I need to be able to tell the difference > between -0.0 and +0.0. This is for ocaml versions of the C copysign and > signbit functions. Any suggestions? x < 0.0 || (x = 0.0 && 1.0/.x < 0.0) may be faster than converting the bits to integer, or slower, depending on platform and context, and how often you encounter -0. ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners