Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2002 11:18:19 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Mikhail Teterin <mi+mx@aldan.algebra.com>
Cc:        Matthew Seaman <m.seaman@infracaninophile.co.uk>, questions@FreeBSD.ORG
Subject:   Re: pow(3) on FreeBSD
Message-ID:  <20020819161819.GB70455@dan.emsphone.com>
In-Reply-To: <200208191124.35129.mi%2Bmx@aldan.algebra.com>
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
In the last episode (Aug 19), Mikhail Teterin said:
> You are right, the FreeBSD's man-page does not specify the return value
> in case of a non-integer y. I just know it from experiment to be zero
> (and not NaN as Matthew claimed).
> 
> = $ cat > test.c
> = #include <math.h>
> = #include <stdio.h>
> = main()
> = {
> =     printf("%f\n", pow(2, 1.5));
> = }
> = ^D
> = $ gcc test.c -lm
> = $ ./a.out
> = 2.828427
> 
> The test above was, obviously, done on Solaris. On FreeBSD, this same
> program outputs zero:
> 
> 	mteterin@misha:~ (257) uname -a
> 	FreeBSD misha 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Wed Jul 31 13:27:39 EDT 
> 2002     mteterin@misha [...]
> 	mteterin@misha:~ (258) ./a.out 
> 	0.000000

There must be something wrong with your setup, then :)  It prints
2.828427 on my -current box and all my 4.* boxes as well.  Try
rebuilding libc and libm with CFLAGS=-O and nothing else.  You may have
hit a compiler bug.

FreeBSD dan.emsphone.com 5.0-CURRENT FreeBSD 5.0-CURRENT #181: Thu Jul 25 14:15:12 CDT 2002     zsh@dan.emsphone.com:/usr/src/sys/i386/compile/DANSMP  i386

-- 
	Dan Nelson
	dnelson@allantgroup.com

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?20020819161819.GB70455>