lkml.org 
[lkml]   [1996]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Faster make depend
Date
Matti E Aarnio  <mea@mea.cc.utu.fi> wrote:
> In addition, calculating inverse ("1/x") of constant (at
> compile time), and then doing multiplication with it is
> (at Alphas) blinding fast... Sure it overflows, but the
> result is correct for division :-) You can't get reminder

Don't do such tricks without proper regard for precision. If you
compute x/10 with FP arithmetic, the result is _exact_ e.g. for x=10
or x=5. If you optimize this to be x*0.1, however, the result is
_never_ exact because there is no exact binary FP representation for
0.1. (In simple cases you have the chance that the round-off errors
compensate, but you can _never_ be sure of that - in precision
calculations, round-off errors are always accounted for the worst
case.)

The numerics people would be very upset if someone implemented the
above "optimization" in a compiler without telling them...

olaf
--
___ Olaf.Titz@inka.de or @{stud,informatik}.uni-karlsruhe.de ____
__ o <URL:http://www.inka.de/~bigred/> <IRC:praetorius>
__/<_ >> Just as long as the wheels keep on turning round
_)>(_)______________ I will live for the groove 'til the sun goes down << ____


\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.111 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site