This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] problems in hypotf math function
- From: Bob Wilson <bwilson at tensilica dot com>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Tue, 06 Sep 2005 10:43:43 -0700
- Subject: Re: [PATCH] problems in hypotf math function
- References: <42EE8F3B.5060406@tensilica.com> <4314E1FC.9090406@redhat.com> <90C28B7F-555F-4080-87D4-379F8D9E59AB@tensilica.com> <431B5D3A.9040402@redhat.com>
Ulrich Drepper wrote:
Bob Wilson wrote:
Fair enough, but you still need to remove the exponent bias from the
increment value for 2^60.
Test case?
Here's a small program that demonstrates the problem. Without the patch, the
hypotf() results will be infinity.
#include <stdio.h>
#include <math.h>
unsigned int ta = 0x60000000;
unsigned int tb = 0x10000000;
main ()
{
float a = *(float *)&ta;
float b = *(float *)&tb;
float c, d;
c = hypotf(a, a);
d = hypot(a, a);
printf("a = %e hypotf(a,a) = %e hypot(a,a) = %e\n", a, c, d);
c = hypotf(b, b);
d = hypot(b, b);
printf("b = %e hypotf(b,b) = %e hypot(b,b) = %e\n", b, c, d);
}