Created
September 8, 2022 22:20
-
-
Save ridiculousfish/bfa7ed6b1d76c114e19b379e1b9be16f to your computer and use it in GitHub Desktop.
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
#include <math.h> | |
#include <float.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
__attribute__((noinline)) | |
double nafter(double x) { | |
return nextafter(x, INFINITY); | |
} | |
int main(void) { | |
double dbl = nafter(0.0); | |
int64_t i64 = 0; | |
memcpy(&i64, &dbl, sizeof i64); | |
printf("%lld\n", (long long)i64); | |
printf("positive: %d\n", dbl > 0.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment