Date: 25 Dec 2002 19:16:01 -0000 From: Scott Ballantyne <sdb@ssr.com> To: freebsd-questions@freebsd.org Subject: Re: isnormal() ? Message-ID: <20021225191601.50121.qmail@kimchee.ssr.com> In-Reply-To: <20021225024245.GC31992@raggedclown.net> (message from Cliff Sarginson on Wed, 25 Dec 2002 03:42:45 %2B0100) References: <20021224164935.J62363-100000@cactus.fi.uba.ar> <20021224215932.47800.qmail@kimchee.ssr.com> <20021225024245.GC31992@raggedclown.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Cliff Sarginson <cls@raggedclown.net> writes:
> To be fair, he did use the (appalling) word "mathoid" to imply that it
Appalling? heh heh.. No more spheroid, cuboid, either? Oh dear...
> Well you could write it yourself,,
>
Here 'tis. Seems to work well enough for the moment, although if
anyone notices a bug, boy, I'd sure appreciate hearing about it.
sdb
--
sdb@ssr.com
/* isnormal.c, return non-zero if arg not zero, infinte, subnormal or NaN
FreeBSD 4.7 libm lacks this function
Scott Ballantyne (sdb@ssr.com)
Use at your own risk.
*/
/* You will need the source to the libraries to compile this function */
#include "/usr/src/lib/msun/src/math.h"
#include "/usr/src/lib/msun/src/math_private.h"
int isnormal (double x)
{
int32_t hx,lx;
EXTRACT_WORDS(hx, lx, x);
hx &= 0x7fffffff;
if (((hx | lx) == 0) /* x == 0.0 */
|| (hx >= 0x7ff00000) /* x infinite? */
|| ((hx | ((lx|-lx) >> 31)) > 0x7ff00000) /* NaN? */
|| (hx < 0x00100000)) /* Subnormal? */
return 0;
return 1;
}
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021225191601.50121.qmail>
