Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


That's all fine but X and Y were floats while INVX and INVY were integers due to implicit typing. Probably not what they wanted.


Only 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".


Yes, 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: