template bug?
Bill Baxter
dnewsgroup at billbaxter.com
Fri Feb 29 14:40:48 PST 2008
Marius Muja wrote:
> Because of the nature of floating point numbers, you shouldn't use
> equality(==) to compare floating point numbers.
>
> Instead of n==1 you should write something like abs(n-1)<eps (where eps
> is a small number)
It's true generally, but integers (up to a point) have an exact
representation in floating point. Multiplying exact real integers by
exact real integers will yield exact real integers as long as you don't
overlflow the mantissa.
-bb
More information about the Digitalmars-d
mailing list