What is Nostr?
Taylor R Campbell /
npub1ewx…m9ww
2024-07-17 13:05:56

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!
Author Public Key
npub1ewx2f6gqcqgswt6x3jwfsq5ruu0vhuf6mk877xnzsxe0wecdlymsmlm9ww