|
Packit Service |
82fcde |
/* @(#)s_finite.c 5.1 93/09/24 */
|
|
Packit Service |
82fcde |
/*
|
|
Packit Service |
82fcde |
* ====================================================
|
|
Packit Service |
82fcde |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
Packit Service |
82fcde |
*
|
|
Packit Service |
82fcde |
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
Packit Service |
82fcde |
* Permission to use, copy, modify, and distribute this
|
|
Packit Service |
82fcde |
* software is freely granted, provided that this notice
|
|
Packit Service |
82fcde |
* is preserved.
|
|
Packit Service |
82fcde |
* ====================================================
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#if defined(LIBM_SCCS) && !defined(lint)
|
|
Packit Service |
82fcde |
static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $";
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/*
|
|
Packit Service |
82fcde |
* finite(x) returns 1 is x is finite, else 0;
|
|
Packit Service |
82fcde |
* no branching!
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <math.h>
|
|
Packit Service |
82fcde |
#include <math_private.h>
|
|
Packit Service |
82fcde |
#include <ldbl-classify-compat.h>
|
|
Packit Service |
82fcde |
#include <shlib-compat.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#undef __finite
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifndef FINITE
|
|
Packit Service |
82fcde |
# define FINITE __finite
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
int FINITE(double x)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
int32_t hx;
|
|
Packit Service |
82fcde |
GET_HIGH_WORD (hx, x);
|
|
Packit Service |
82fcde |
return (int) ((uint32_t) ((hx & 0x7ff00000) - 0x7ff00000) >> 31);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
hidden_def (__finite)
|
|
Packit Service |
82fcde |
weak_alias (__finite, finite)
|
|
Packit Service |
82fcde |
#ifdef NO_LONG_DOUBLE
|
|
Packit Service |
82fcde |
# if LDBL_CLASSIFY_COMPAT
|
|
Packit Service |
82fcde |
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
|
|
Packit Service |
82fcde |
compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_23)
|
|
Packit Service |
82fcde |
compat_symbol (libm, __finite, __finitel, GLIBC_2_1);
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
weak_alias (__finite, finitel)
|
|
Packit Service |
82fcde |
#endif
|