From: malc <malc@pulsesoft.com>
To: John Carr <jfc@MIT.EDU>
Cc: Shawn Wagner <shawnw@speakeasy.org>, "" <caml-list@inria.fr>
Subject: Re: [Caml-list] Finding the sign of a float
Date: Sat, 1 Feb 2003 17:11:10 +0300 (MSK) [thread overview]
Message-ID: <Pine.LNX.4.50.0302011710210.1801-100000@home.oyster.ru> (raw)
In-Reply-To: <200302011256.HAA06393@nerd-xing.mit.edu>
On Sat, 1 Feb 2003, John Carr wrote:
>
> > 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.
1.0 /. x = neg_infinity less typing
--
mailto:malc@pulsesoft.com
-------------------
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
next prev parent reply other threads:[~2003-02-01 14:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-01 6:35 Shawn Wagner
2003-02-01 9:05 ` Chris Hecker
2003-02-01 12:56 ` John Carr
2003-02-01 14:11 ` malc [this message]
2003-02-01 18:05 ` Shawn Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.50.0302011710210.1801-100000@home.oyster.ru \
--to=malc@pulsesoft.com \
--cc=caml-list@inria.fr \
--cc=jfc@MIT.EDU \
--cc=shawnw@speakeasy.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox