A little trick which can be used in programming, to reduce the CPU load, if the value of a Hypotenuse is being Compared.

A scenario which often happens in computing is, that there exists a quantity, call that (a), which will result accurately by squaring the quantities (x), (y) and (z) first, and then computing the square root of the sum. It could then also be said, that the following explicit function has been defined:

F(x, y, z) := sqrt(x^2 + y^2 + z^2)

Further, the idea exists in Computing, that when all one wants to compute, is (x2) for example, it takes fewer CPU cycles actually to compute (x*x), than it takes, to compute a real power function.

But, the object of the exercise could actually be, not to derive (a) from (x), (y) and (z), but rather, to compare two instances of F(x, y, z).

The biggest issue as such, with actually computing F(x, y, z), is, that to compute the square root, is even slower, than it was to compute (x2), (y2) and (z2). Therefore, if one has the luxury of knowing what (a) is in advance, what one can do, for real-number comparisons, is just to square (a), and then, not to compute the square root, which should exist within the function F(). Therefore, when two known quantities are simply being compared, the following way to do it, will run slightly faster:

a^2 < (x^2 + y^2 + z^2)

In Modern Computing, what is often done is, that actual CPU usage is ignored, to make the task of writing complex code easier, and, the situation may not always be recognizable, that two values are going to be compared, which would both have been computed as the square root of one other value. And so, to avoid having to stare at some code cross-eyed, the practice can be just as valid, to compute two instances of F(x, y, z), but, to compute them with the square root function in each case, and somewhere later in the code execution, just to compare the two resulting values.




My Goal in Maintaining Multiple Older Computers

In this posting, among others, I wrote that I am doing private work to keep an old Acer Aspire 5020 laptop running, which has a single-core CPU that runs at 1.8GHz, and which only has 1GB of RAM. And so a good question which some people might ask would be, ‘What is the point?’

One reason I do that, is the fact that I feel a need to have multiple computers on my LAN, that are Linux machines. Most of my up-to-date machines do run Windows, but there are certain things I need Linux to do, and for which only a Linux computer can network properly, with the other Linux computers. And so to keep an old laptop from 2005 alive, seems to make some sense to me.

Besides which, a laptop from 2005 can do things under Linux, that a Windows machine from 2016 can do, as long as the Linux version on the old laptop is decently up-to-date.