blob: 62e5263bb6612b1185d7ca473779a571550b26e9 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Changed to return -1 for -Inf by Ulrich Drepper <drepper@cygnus.com>.
4 * Public domain.
5 */
6
7/*
8 * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0;
9 * no branching!
10 */
11
12#include "math.h"
13#include "math_private.h"
14
15int __isinf(double x)
16{
17 int32_t hx,lx;
18 EXTRACT_WORDS(hx,lx,x);
19 lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
20 lx |= -lx;
21 return ~(lx >> 31) & (hx >> 30);
22}
23libm_hidden_def(__isinf)