Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2002 08:10:09 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Mikhail Teterin <mi@corbulon.video-collage.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: pow(3) on FreeBSD
Message-ID:  <20020819071009.GA7443@happy-idiot-talk.infracaninophi>
In-Reply-To: <200208190413.g7J4DEcw051123@corbulon.video-collage.com>
References:  <200208190413.g7J4DEcw051123@corbulon.video-collage.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 19, 2002 at 12:13:14AM -0400, Mikhail Teterin wrote:
> Hi!
> 
> In accordance with its man-page entry, pow(3) will return 0 if
> its second argument is not an integer. Why is that? What's the
> reasoning and what is a workaround -- I'm trying to port an
> application from Solaris, which uses pow(3) quite heavily...

No --- read the manual page again more carefully.   It says:

The functions pow(x, y) checks to see if x < 0 and y is not an integer

Or in other words, pow() returns NaN and sets errno == EDOM in
situations where the result would be complex valued.  The man page
does talk about some quite historic hardware, which has little
relevance today.  FreeBSD implements IEEE 754 floating point on IA32
class processors: see ieee(3), fpgetmask(3).
 
> Needless to say, Solaris' pow works properly for non-integer
> arguments...

Even Solaris cannot return a complex value as a double.  

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
Tel: +44 1628 476614                                  Marlow
Fax: +44 0870 0522645                                 Bucks., SL7 1TH UK

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020819071009.GA7443>