[ODE] What is the ODE approach to denormals?
Jon Watte
hplus-ode at mindcontrol.org
Wed Apr 28 12:12:48 MST 2004
min will give you a number with exponent 1, as exponent 0 means denormalized.
However, we want a number that, WHEN SQUARED, will be "min". Just calling sqrtf(min) doesn't fill me with a warm fuzzy, because sqrtf() may have some internal precision issues. Using sqrtf(min*4) might work better, but we'd have to test it.
Again, the big job is finding all the places where these guards are required, and changing comparision to 0.
Cheers,
/ h+
-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of GARY
VANSICKLE
Sent: Tuesday, April 27, 2004 7:39 PM
To: ode at q12.org
Subject: RE: [ODE] What is the ODE approach to denormals?
> Ah, but those aren't what we actually want.
Wha-huh? According to one (admittedly rather old and crusty but AFAIK still
valid) source:
"static T
min ();
Returns the minimum finite value. For floating point types with
denormalization, min() must return the minimum normalized value."
"minimum normalized value", that's exactly what we want, isn't it?
> Especially for the denormal-
> if-you-square-it number. For numerical precision reasons, using
> <float>::min and taking sqrt() of it won't cut it.
Well <float>::min() will give you a number with an exponent of 0, so isn't
the same mantissa with an exponent of -1 the
(almost-)denormal-if-you-square-it number we seek? Assuming a
numeric_limits::radix of 2 of course.
> And, in addition,
> because I'm a little bit superstitious magic epsilons, I prefer for these
> epsilons to be slightly bigger than the absolutely minimum representable
> number.
>
I prefer that my magic epsilons contain as little magic as possible ;-).
> Anyway, there are zillions of places where ODE compares "> 0" where it
> should compare "> some_epsilon" -- identifying all of them is the hard
> part. Figuring out the value of the epsilon is just a matter of
> preference. (degrees or radians in XML, anyone? :-)
>
Gotta disagree with you there. Say the instance in question works fine with
the minimum non-denormal. Nothing says the next "> 0", even if it should be
an epsilon, would work with the same value. That would have to be evaluated
on a case-by-case basis.
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode
More information about the ODE
mailing list