[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Full-disclosure] Major gcc 4.1.1 and up security issue



On Wed, 17 Jan 2007 19:07:19 +0100, Marcus Graf said:
> off topic thoughts:
> 
> > (twice 1.15 will likely be a bit or two different than 3.30).  As Fortran
> > geeks have known for over half a century, a better way to code this is:
> > 
> >     if (abs(a-b) < n*epsilon*a)
> > 
> > where 'epsilon' is the hardware constant defining the smallest number such
> > that 1+a is different from 1, and 'n' controls how many significant digits
> > we require in the test.

> Hm...
> 
> assume a = b = -1.0
> 
> abs(a-b) is zero or maybe a little bit above
> n*epsilon*a is negative (n>0, epsilon>0, a=-1)
> 
> Test fails :-(
>

D'Oh!  n*epsilon*(abs(a)).  :)   (And I *don't* want to hear from the propeller
beany crowd that points out that (1+epsilon)*a isn't *exactly* the smallest
floating point distinguishable from a.  :)

Attachment: pgpuxksAucNjF.pgp
Description: PGP signature

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/