xref: /openbsd-src/lib/libc/arch/riscv64/gen/isinfl.c (revision 87962d75d1c1a416b89e927cd4ab8e3327a47509)
1*87962d75Sdrahn /*	$OpenBSD: isinfl.c,v 1.1 2021/04/27 04:36:00 drahn Exp $	*/
2*87962d75Sdrahn /*
3*87962d75Sdrahn  * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
4*87962d75Sdrahn  *
5*87962d75Sdrahn  * Permission to use, copy, modify, and distribute this software for any
6*87962d75Sdrahn  * purpose with or without fee is hereby granted, provided that the above
7*87962d75Sdrahn  * copyright notice and this permission notice appear in all copies.
8*87962d75Sdrahn  *
9*87962d75Sdrahn  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*87962d75Sdrahn  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*87962d75Sdrahn  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*87962d75Sdrahn  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*87962d75Sdrahn  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*87962d75Sdrahn  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*87962d75Sdrahn  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*87962d75Sdrahn  */
17*87962d75Sdrahn 
18*87962d75Sdrahn #include <sys/types.h>
19*87962d75Sdrahn #include <machine/ieee.h>
20*87962d75Sdrahn #include <math.h>
21*87962d75Sdrahn 
22*87962d75Sdrahn int
__isinfl(long double e)23*87962d75Sdrahn __isinfl(long double e)
24*87962d75Sdrahn {
25*87962d75Sdrahn 	struct ieee_ext *p = (struct ieee_ext *)&e;
26*87962d75Sdrahn 
27*87962d75Sdrahn 	return (p->ext_exp == EXT_EXP_INFNAN &&
28*87962d75Sdrahn 	    p->ext_frach == 0 && p->ext_frachm == 0 &&
29*87962d75Sdrahn 	    p->ext_fraclm == 0 && p->ext_fracl == 0);
30*87962d75Sdrahn }
31