Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2002 12:09:42 -0400
From:      "C. A. Daelhousen" <cd9@buffalo.edu>
To:        Mikhail Teterin <mi+mx@aldan.algebra.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: pow(3) on FreeBSD
Message-ID:  <20020819120942.A65360@selvirjin.alltel.net>
In-Reply-To: <200208191124.35129.mi%2Bmx@aldan.algebra.com>; from mi%2Bmx@aldan.algebra.com on Mon, Aug 19, 2002 at 11:24:35AM -0400
References:  <200208190413.g7J4DEcw051123@corbulon.video-collage.com> <20020819043012.GN74231@dan.emsphone.com> <200208191124.35129.mi%2Bmx@aldan.algebra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 19, 2002 at 11:24:35AM -0400, Mikhail Teterin wrote:
> There is nothing complex (pun intended) about, say, 1^2.5. It is still
> 1. -- unless you are running FreeBSD (Linux?)... There is nothing
> complex about Dan's's example (2^1.5) above either -- the correct value
> is 2.828427, but it is 0 on FreeBSD -- in accordance with the man-page
> and in disagreement with Dan...
> 
> Now, can someone, please, offer the REAL reasons for the FreeBSD's
> apparent defficiency? May be, even a double-precision workaround --
> unlike powf(3), which operates on float-precision numbers?..
> 

It works for me.

c/pow.c:
  #include <math.h>
  #include <stdio.h>
  int main() { printf("%e\n", pow(2,1.5)); return 0; }

compile/run:
  $ gcc30 -O2 -march=athlon -pipe -o bin/pow -lm -Wall c/pow.c
  $ bin/pow
  2.828427e+00
  $ uname -a
  FreeBSD <host> 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0:
  Sun Aug 18 19:22:25 EDT 2002
  root@<host>:/usr/obj/usr/src/sys/V8  i386

-- 
..: Chad Daelhousen == cd9@buffalo.edu :.........: sig v3.1 :...
: Programming for 10 +/- 2 years (50 +/- 10% of a lifetime)    :
:.............Perl will be the first to implement mind reading.:


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?20020819120942.A65360>