14 lines
272 B
C
14 lines
272 B
C
#include <math.h>
|
|
#include <stdint.h>
|
|
|
|
int isinf(double x) {
|
|
union {
|
|
double f;
|
|
uint64_t i;
|
|
} u = { .f = x };
|
|
|
|
uint64_t exp = (u.i >> 52) & 0x7FF;
|
|
uint64_t mantissa = u.i & 0xFFFFFFFFFFFFFULL;
|
|
|
|
return (exp == 0x7FF) && (mantissa == 0);
|
|
} |