floating point is not fun

#include <stdio.h>
#include <math.h>

int main()
        double a= 10.0;
        double b= 1e+308;
        printf("%dn",isinf(a * b));
        return 0;

Prints 1 on: 64bit intel, 32bit PowerPC, 32bit SPARC, 64bit Sparc. But prints zero on 32bit intel.

Oh, but if you build that with g++ instead of gcc on 32bit Intel, you get 1.

One thought on “floating point is not fun

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.