Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Terje Mathisen <terje.mathisen@hda.hydro.com>
Subject: Re: Can POWER4, 5 etc continue where Alpha was stopped?
Date: Sat, 01 Sep 2001 21:51:05 +0200	[thread overview]
Message-ID: <3B913C29.A2F6A9F8@hda.hydro.com> (raw)
In-Reply-To: 9mocr6$ljk$1@nserve1.acs.ucalgary.ca

Serguei Patchkovskii wrote:
> 
> Terje Mathisen (terje.mathisen@hda.hydro.com) wrote:
> : BTW, the same test on a single prec fp number is even easier, since it
> : just needs to verify that the fractional part of the mantissa is zero:
> 
> : #define float_ispowerof2(n) (((*(t_uint32 *) &n) & 0x07ffffff) == 0)
> 
> Ugh, doesn't it miss all denormalized powers of two?

Well, yes.

That's why you might need to replace the macro with a real function,
i.e. if you cannot guarantee that all numbers will be normalized.

One way to do so is to expand the float values to double, the test is
still nearly the same.

Going from double to extended precision isn't nearly so nice however:
Very unportable, and sometimes extremely slow. :-(

Terje
-- 
- <Terje.Mathisen@hda.hydro.com>
Using self-discipline, see http://www.eiffel.com/discipline
"almost all programming can be viewed as an exercise in caching"


  reply	other threads:[~2001-09-01 19:51 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-26 17:14 Can POWER4, 5 etc continue where Alpha was stopped? Nova
2001-08-26 22:30 ` del cecchi
2001-08-28 17:39   ` Niels Jørgen Kruse
2001-08-28 18:47     ` Christer Palm
2001-08-28 20:00       ` Del Cecchi
2001-08-27  1:38 ` Robert Deininger
2001-08-27 17:12   ` Richard Tomkins
2001-08-28 19:02 ` McCalpin
2001-08-28 10:14   ` Bruce Hoult
2001-08-29  0:03     ` McCalpin
2001-08-28 15:27       ` Bruce Hoult
2001-08-29  6:25       ` Terje Mathisen
2001-08-29 11:48         ` George Coulouris
2001-08-29 17:30           ` Terje Mathisen
2001-08-29 19:32             ` Terje Mathisen
2001-08-29 21:45         ` Maynard Handley
2001-08-31 10:09           ` Terje Mathisen
2001-08-31 16:09             ` Serguei Patchkovskii
2001-09-01 19:51               ` Terje Mathisen [this message]
2001-08-28 20:38   ` Andi Kleen
2001-08-28 10:16     ` Bruce Hoult
2001-08-28 20:51     ` Nick Maclaren
2001-08-28 23:04       ` Andi Kleen
2001-08-29  7:59         ` Nick Maclaren
2001-08-30 20:18         ` Wow
2001-08-31  7:47           ` Terry C. Shannon
2001-08-31  9:09             ` Ketil Z Malde
2001-08-31 12:52               ` Terry C. Shannon
2001-08-31 13:14                 ` McCalpin
2001-09-03 12:23                   ` Alexis Cousein
2001-09-05  1:27                   ` del cecchi
2001-09-05  2:07                     ` Chris Morgan
2001-09-05 18:13                       ` Del Cecchi
2001-09-05 18:57                         ` Larry Kilgallen
2001-09-05 12:49                     ` Sander Vesik
2001-09-05 14:17                       ` McCalpin
2001-09-05 14:59                         ` Michael Kraemer
2001-09-05 16:32                       ` Pentyern
2001-09-06  0:32                       ` del cecchi
2001-09-05 18:08                     ` Terry C. Shannon
2001-09-06 13:42                       ` Stefaan A Eeckels
2001-09-06 15:08                         ` Alexis Cousein
2001-09-06 16:40                           ` Mark Smotherman
2001-09-06 21:57                           ` Stefaan A Eeckels
2001-09-07 16:22                             ` Peter da Silva
2001-08-31 12:20             ` Nick Maclaren
2001-09-03 15:07               ` bad bob
2001-08-28 21:16     ` Greg Lindahl
2001-08-29  0:06     ` McCalpin
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox