Re: power(2,63) is not equal to 9223372036854775808

new topic     » goto parent     » topic index » view thread      » older message » newer message

Would be interesting to see if someone can reproduce this on *nix. Wonder if it's a MinGW bug.

If you have MinGW yourself, you could also try this C program, to see if the bug shows up by itself.

#include <stdio.h> 
#include <math.h> 
 
int main(int argc, char ** argv) 
{ 
        printf("%d\n", (powl(2.0L, 63.0L) - 1.0L) == 9223372036854775807.0L); 
        printf("%d\n", powl(2.0L, 63.0L) == 9223372036854775808.0L); 
        printf("%d\n", (powl(2.0L, 63.0L) + 1.0L) == 9223372036854775809.0L); 
        printf("%d\n", (powl(2.0L, 63.0L) + 2.0L) == 9223372036854775810.0L); 
 
        printf("%d\n", (pow(2.0, 63.0) - 1.0) == 9223372036854775807.0); 
        printf("%d\n", pow(2.0, 63.0) == 9223372036854775808.0); 
        printf("%d\n", (pow(2.0, 63.0) + 1.0) == 9223372036854775809.0); 
        printf("%d\n", (pow(2.0, 63.0) + 2.0) == 9223372036854775810.0); 
 
        printf("%d\n", (powl(2.0L, 63.0L) - 1.0L) == 9223372036854775807.0); 
        printf("%d\n", powl(2.0L, 63.0L) == 9223372036854775808.0); 
        printf("%d\n", (powl(2.0L, 63.0L) + 1.0L) == 9223372036854775809.0); 
        printf("%d\n", (powl(2.0L, 63.0L) + 2.0L) == 9223372036854775810.0); 
        return 0; 
} 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu