exupero's blog
RSSApps

New stack math compendium

In the previous post I described a couple new approaches to my original compendium of stack math algorithms. Below is the updated compendium. The error is calculated using this script, which for algorithms that aren't simple multiplication or division checks the error at a few powers of ten and reports the worst accuracy.

If you have any improvements to suggest, or would like to see some additional conversions, feel free to email me.

ConversionLess accurateMore accurate
Celsius → Fahrenheit
9 * 5 / 32 +
double -tenth +32
(exact)
Fahrenheit → Celsius
32 - 5 * 9 /
-32 halve +tenth
(1% error)
15% tip
0.15 *
tenth +half
(exact)
Multiply by π
3.14159 *
triple +tenth
(5% error)
triple +twentieth
(0.3% error)
Divide by π
3.14159 /
third -tenth
(6% error)
third -twentieth
(0.5% error)
kilometers → miles
0.6214 *
two-thirds
(7% error)
two-thirds -tenth +twentieth
(1% error)
miles → kilometers
1.609 *
+half
(7% error)
[+half] left [tenth] right +
(0.6% error)
meters → feet
3.281 *
triple
(9% error)
triple +tenth
(0.6% error)
feet → meters
3.281 /
third
(9% error)
third -tenth
(2% error)
inches → centimeters
2.54 *
tenfold quarter
(2% error)
centimeters → inches
2.54 /
tenth quadruple
(2% error)
miles → feet
5280 *
five-thousandfold
(5% error)
five-thousandfold +twentieth
(0.6% error)
feet → miles
5280 /
five-thousandth
(6% error)
five-thousandth -twentieth
(0.3% error)
kilograms → pounds
2.205 *
double
(9% error)
double +tenth
(0.2% error)
pounds → kilograms
2.205 /
halve
(10% error)
halve -tenth
(0.8% error)
hours → seconds
3600 *
four-thousandfold
(10% error)
four-thousandfold -tenth
(exact)
seconds → hours
3600 /
four-thousandth
(10% error)
four-thousandth +tenth
(1% error)
mi/h → ft/s
1.467 *
+half
(2% error)
ft/s → mi/h
1.467 /
two-thirds
(2% error)
sq. miles → acres
640 *
seven-hundredfold
(9% error)
seven-hundredfold -tenth
(2% error)
acres → sq. miles
640 /
seven-hundredth
(9% error)
seven-hundredth +tenth
(0.6% error)
acres → sq. feet
43560 *
ten-thousandfold quadruple
(8% error)
ten-thousandfold quadruple +tenth
(1% error)
sq. feet → acres
43560 /
ten-thousandth quarter
(9% error)
ten-thousandth quarter -tenth
(2% error)
sq. kilometers → acres
247.1 *
thousandfold quarter
(1% error)
acres → sq. kilometers
247.1 /
thousandth quadruple
(1% error)
pounds → troy ounces
14.58 *
tenfold +half
(3% error)
[tenfold +half] left [halve] right -
(0.5% error)
troy ounces → pounds
14.58 /
tenth two-thirds
(3% error)
US cups → fluid ounces
8 *
quadruple double
(exact)
fluid ounces → US cups
8 /
quarter halve
(exact)
liquid gallons → US cups
16 *
quadruple quadruple
(exact)
US cups → liquid gallons
16 /
quarter quarter
(exact)
liquid gallons → liters
3.785 *
quadruple
(6% error)
quadruple -twentieth
(0.4% error)
liters → liquid gallons
3.785 /
quarter
(5% error)
quarter +twentieth
(0.6% error)
sphere radius → surface area
square 4 * 3.14159 *
square tenfold +quarter
(0.5% error)
sphere radius → volume
cube 4 * 3 / 3.14159 *
cube quadruple
(5% error)
cube quadruple +twentieth
(0.3% error)
sphere surface area → radius
4 / 3.14159 / sqrt
tenth -quarter sqrt
(3% error)
hundredth quadruple double sqrt
(0.3% error)
sphere volume → radius
4 / 3 * 3.14159 / cube-root
quarter cube-root
(2% error)