Working with Classic Units of Measurements (AutoHotkey Tricks)

Figuring Odd or Even, Working with Fractions, and Calculating Quarts, Pints, and Cups

Last time in “Fake Math Tricks Using the Floor() and Mod() Functions (AutoHotkey Tips),” I introduced math techniques based upon the Floor() and Mod() functions. Although making basic calculations more complicated, many age-old units of measurement (e.g. yards, feet, and inches with fractions or gallons, quarts, pints, and cups with fractions) persist in common use among everyday endeavors. By obtaining the results from old-fashion division arithmetic showing quotients and remainders, we can write AutoHotkey routines for calculations in these varied types of units.

In order to provide more insight into how to use the Floor() function (quotient without remainder) and Mod() function (remainder or modulo), I offer a few examples of how to build calculators for these types of classic measurements.

Odd or Even?

Depending upon your line of work, you may or may not need to determine the parity (odd or even) of an integer. As humans, we instantly recognize odd or even with a glance at the last digit (1, 3, 5, 7, 9 odd or 0, 2, 4, 6, 8 even). Computers must make a calculation—the easiest in AutoHotkey divides the number by 2 and looks at the remainder using the Mod() function:

test := 35
MsgBox % Mod(test, 2)=1 ? test " is odd!" : test " is even!"
Continue reading

Fake Math Tricks Using the Floor() and Mod() Functions (AutoHotkey Tips)

Although Not Really Fake Math, These Two AutoHotkey Functions Can Solve Eclectic, Yet Practical, Everyday Problems!

The Irish philosopher George Berkeley proved that mathematics does not exist in reality. It turns out nobody cares! Even though math resides only in our heads, we continue to use it anyway.

Berkeley did not doubt that calculus produced real-world truth; simple physics experiments could verify that Newton’s method did what it claimed to do. “The cause of Fluxions cannot be defended by reason”,[48] but the results could be defended by empirical observation, Berkeley’s preferred method of acquiring knowledge at any rate. Berkeley, however, found it paradoxical that “Mathematicians should deduce true Propositions from false Principles, be right in Conclusion, and yet err in the Premises.” In The Analyst, he endeavoured to show “how Error may bring forth Truth, though it cannot bring forth Science”.[49] Newton’s science, therefore, could not on purely scientific grounds justify its conclusions, and the mechanical, deistic model of the universe could not be rationally justified.[50]

https://en.wikipedia.org/wiki/George_Berkeley#Philosophy_of_mathematics

Fortunately, we don’t need to agree with (or even understand) the above citation to take advantage of the results from mental calculation. Scientists may show concern about the theoretical but engineers only care about what works.

Continue reading