We needed a floating point math library for the Bash bundler, so we wrote a very small one, but that means you have access to it when using the bundler.
Adds two floats.
result=$(Math::Plus 1.2 3.6)
# 4.8
Subtracts one float from another.
result=$(Math::Minus 1.2 3.6)
# -2.4
Multiplies two floats.
result=$(Math::Times 1.2 3.6)
# 4.32
Divides a float by another.
result=$(Math::Divide 1.2 2.43)
# 0.493827
Floors a float.
result=$(Math::Floor 1.7)
# 1
Rounds a float.
result=$(Math::Round 1.7)
# 2
Gets the modulus of two floats.
result=$(Math::Divide 3.7 0.3)
# 12.3333333
Absolute value of a float.
result=$(Math::Abs -9.7)
# 9.7
Tests if one float is less than another.
result=$(Math::LT 1.2 3.7)
# 1
Tests if one float is greater than another.
result=$(Math::GT 1.2 3.7)
# 0
Tests if one float is equal to another.
result=$(Math::Equals 2.54 2.54)
# 1
Get the minimum of a list of floats.
result=$(Math::Min 3.7 0.3 433 37.2)
# 0.3
Gets the maximum of a list of floats.
result=$(Math::Max 3.7 0.3 433 37.2)
# 433
Averages a list of floats.
result=$(Math::Mean 3.7 0.3 433 37.2)
# 118.55
Converts base16 to base10.
result=$(Math::hex_to_dec 3F)
# 63
Converts base10 to base16.
result=$(Math::dec_to_hex 237)
# ED
Post on the Alfred Forum thread.
Open an issue in the Github queue.