Taylor R Campbell on Nostr: Here's a fun program to compile and run with and without -m32 on x86, to compute the ...
Here's a fun program to compile and run with and without -m32 on x86, to compute the logarithm of 2, two ways, and print it twice:
#include <math.h>
#include <stdio.h>
int
main(void)
{
printf("log1pf(1)=%a=%a\n", log1pf(1), log1pf(1));
printf("log1p(1)=%a=%a\n", log1p(1), log1p(1));
return 0;
}
log1pf returns results in single precision, right? So surely this should print:
log1pf(1)=0x1.62e43p-1=0x1.62e43p-1
log1p(1)=0x1.62e42fefa39efp-1=0x1.62e42fefa39efp-1
But it doesn't always!
#include <math.h>
#include <stdio.h>
int
main(void)
{
printf("log1pf(1)=%a=%a\n", log1pf(1), log1pf(1));
printf("log1p(1)=%a=%a\n", log1p(1), log1p(1));
return 0;
}
log1pf returns results in single precision, right? So surely this should print:
log1pf(1)=0x1.62e43p-1=0x1.62e43p-1
log1p(1)=0x1.62e42fefa39efp-1=0x1.62e42fefa39efp-1
But it doesn't always!