[math-fun] wholesale reciprocals
Question for the old-timers: I'm trying to pin down a (possibly faux) memory from the 1960s. Back in the day, floating point division was a luxury-- frequently missing from the instruction set, handed off to a subroutine, in any case very slow. If your program used it, it was practically guaranteed to be the slow step. One way to reduce the number of FDVs was to calculate several reciprocals at a time, and then use multiplications to calculate the needed quotients. The trick for calculating two reciprocals at once was to notice that 1/(XY) takes one FDV, and then you can get 1/X = X * 1/(XY) and 1/Y similarly. The trick easily generalizes to several reciprocals, changing N reciprocals into 1, plus 3(N-1) multiplies. (If you want N quotients, you pay another N multiplies.) There's also a minor cost in numerical accuracy, using several calculations (with their attendant rounding error), where one would do. Also, for the careful, the analysis of whether intermediate results like XYZW might over/underflow. It's my impression that I'd seen this trick mentioned in a couple of places, possibly Organick's Fortran book, or Numerical Algorithms in Fortran, and also in actual code. Can anyone confirm or refute my fuzzy recollections? Rich
participants (1)
-
rcs@xmission.com