From owner-freebsd-questions Wed Dec 25 11: 6:18 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BCF937B401 for ; Wed, 25 Dec 2002 11:06:16 -0800 (PST) Received: from redhotmomma.ssr.com (ns.ssr.com [199.4.235.2]) by mx1.FreeBSD.org (Postfix) with SMTP id 5589843ED1 for ; Wed, 25 Dec 2002 11:06:13 -0800 (PST) (envelope-from sdb@ssr.com) Received: (qmail 11265 invoked from network); 25 Dec 2002 19:16:01 -0000 Received: from kimchee.ssr.com (199.4.235.5) by ns.ssr.com with QMQP; 25 Dec 2002 19:16:01 -0000 Date: 25 Dec 2002 19:16:01 -0000 Message-ID: <20021225191601.50121.qmail@kimchee.ssr.com> From: Scott Ballantyne To: freebsd-questions@freebsd.org In-reply-to: <20021225024245.GC31992@raggedclown.net> (message from Cliff Sarginson on Wed, 25 Dec 2002 03:42:45 +0100) Subject: Re: isnormal() ? References: <20021224164935.J62363-100000@cactus.fi.uba.ar> <20021224215932.47800.qmail@kimchee.ssr.com> <20021225024245.GC31992@raggedclown.net> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Cliff Sarginson 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