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 KAA16340; Sat, 1 Feb 2003 10:08:48 +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 KAA16145 for ; Sat, 1 Feb 2003 10:08:46 +0100 (MET) Received: from relay.pair.com (relay.pair.com [209.68.1.20]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id h1198jP10317 for ; Sat, 1 Feb 2003 10:08:46 +0100 (MET) Received: (qmail 29402 invoked from network); 1 Feb 2003 09:08:44 -0000 Received: from arda.pair.com (HELO compaqreview.d6.com) (209.68.1.133) by relay.pair.com with SMTP; 1 Feb 2003 09:08:44 -0000 X-pair-Authenticated: 209.68.1.133 Message-Id: <4.3.2.7.2.20030201005659.03437c98@localhost> X-Sender: checker@localhost X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Sat, 01 Feb 2003 01:05:51 -0800 To: Shawn Wagner , caml-list@inria.fr From: Chris Hecker Subject: Re: [Caml-list] Finding the sign of a float In-Reply-To: <20030131223521.T22850@speakeasy.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed 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? let is_neg v = (Int64.shift_right_logical (Int64.bits_of_float v) 63) = Int64.one Chris PS. My kingdom for overloaded arithmetic operators and Int32/64 constants. ------------------- 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