Created
September 4, 2018 21:16
-
-
Save anarazel/af10ee63fa508a902b2c22c67c488930 to your computer and use it in GitHub Desktop.
__builtin_isinf is busted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
andres@alap4:~/src/postgresql$ clang-7 -march=i386 -O2 -m32 ~/tmp/flttst.c -o ~/tmp/flttst && ~/tmp/flttst | |
r1 = 1, r2 = 0 | |
andres@alap4:~/src/postgresql$ clang-7 -march=nehalem -O2 -m32 ~/tmp/flttst.c -o ~/tmp/flttst && ~/tmp/flttst | |
r1 = 1, r2 = 1 | |
andres@alap4:~/src/postgresql$ cat ~/tmp/flttst.c | |
#include <stdio.h> | |
#include <math.h> | |
int main(int argc, char **argv) | |
{ | |
double d1 = (argc ? 1e180 : 0); | |
double d2 = (argv ? 1e200 : 0); | |
int r2 = __builtin_isinf(d1 * d2); | |
int r1 = isinf(d1 * d2); | |
printf("r1 = %d, r2 = %d\n", r1, r2); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment