One more test (to get rid of compiler optimization)

int main (int argc, char *argv[]) {
        double d;
        
        if (argc>1 && sscanf(argv[1], "%lg", &d)) {
                printf("  double=%.20lg\n", d);         
                printf("  signed=%lx\n", (long)d);
                printf("unsigned=%lx\n", (unsigned long)d);
        }
        return 0;
}

On x86_64 (so, with or without -O2)


$ gcc -O2 -Wall math2.c -o math2 && ./math2 9223372036854775807
  double=9223372036854775808
  signed=8000000000000000
unsigned=8000000000000000


On ppc64

$ gcc -O2 -Wall math2.c -o math2 && ./math2 9223372036854775807
  double=9223372036854775808
  signed=0x7fffffffffffff
unsigned=8000000000000000


Remi.


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to