Math float equivalence
Lucas Goss
lgoss007 at gmail.com
Wed Jul 5 14:01:30 PDT 2006
Don Clugston wrote:
>
> It stands for "relative floating point equality". If you have a better
> name, let me know (I wrote it).
>
> > but I would think it would take a lot more processing than to just check
> > equivalence.
>
> Check the source in std.math. It's actually a very fast function (it
> only has a couple of subtractions and two predictable branches).
> It's a comparison that exactly captures the precision of IEEE arithmetic.
> In the Helix library on dsource is a version which is more applicable to
> games, since it has an absolute difference as well.
>
Ah, I take it you didn't like the name relativeFloatingPointEquality,
haha, I guess that's understandable. Maybe something like
"relativeEquality" would be nice, but I guess it's as short as possible
because that's how mathematicians (I'm partially one) like it? Ever
since using the Java and .NET libraries, I now loathe short names
because it always seems to be more work to find what you're looking for
or to understand something that's unfamiliar.
I looked at the std.math code and the feqrel does look pretty fast, I
also looked at helix as well. I'll have to see what best fits my need.
Thanks,
Lucas
More information about the Digitalmars-d
mailing list