Skip to content

Instantly share code, notes, and snippets.

@ridiculousfish
Created September 8, 2022 22:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#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