From owner-freebsd-questions Mon Aug 19 0:10:40 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 60F4137B401 for ; Mon, 19 Aug 2002 00:10:36 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C69D43E65 for ; Mon, 19 Aug 2002 00:10:35 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk ([IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.5/8.12.5) with ESMTP id g7J7AIQI007909; Mon, 19 Aug 2002 08:10:18 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.5/8.12.5/Submit) id g7J7A9hF007908; Mon, 19 Aug 2002 08:10:09 +0100 (BST) Date: Mon, 19 Aug 2002 08:10:09 +0100 From: Matthew Seaman To: Mikhail Teterin Cc: questions@FreeBSD.ORG Subject: Re: pow(3) on FreeBSD Message-ID: <20020819071009.GA7443@happy-idiot-talk.infracaninophi> References: <200208190413.g7J4DEcw051123@corbulon.video-collage.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200208190413.g7J4DEcw051123@corbulon.video-collage.com> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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