This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] problems in hypotf math function


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);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]