4 ms·
This is quite common in legacy Fortran codes. The reason is that these reciprocals are probably later used in many multiplications (e.g. for scaling a vector) w
by photon-torpedo 10y ago
This is quite common in legacy Fortran codes. The reason is that these reciprocals are probably later used in many multiplications (e.g. for scaling a vector) which is faster than doing many divisions. Well, nowadays the compiler would optimize that for you, but back then either compilers wouldn't do that, or people woudn't want to rely on it.
- germanier 10y agoThat's all fine but X and Y were floats while INVX and INVY were integers due to implicit typing. Probably not what they wanted.
- alephnil 10y agoOnly if implicitly declared. You could define them as reals, and in well written code, you would. That is why you have the old joke that "God is real, unless declared otherwise".
- moomin 10y agoYes, you could, but the poor sap who'd only just started programming ended up having to ask the mathmo who knew a bit about computers.