evm v0.1.2 MathHelper

Simple functions to help with common math functions.

Link to this section Summary

Functions

Simple floor function that makes sure we return an integer type

Simple helper to calculate a log in any given base. E.g. the log_15(30), which would be expressed at MathHelper.log(30, 15)

Link to this section Functions

Link to this function floor(x)
floor(number) :: integer

Simple floor function that makes sure we return an integer type.

Examples

iex> MathHelper.floor(3.5)
3

iex> MathHelper.floor(-3.5)
-4

iex> MathHelper.floor(5)
5
Link to this function log(x, b)
log(number, number) :: number

Simple helper to calculate a log in any given base. E.g. the log_15(30), which would be expressed at MathHelper.log(30, 15).

Examples

iex> MathHelper.log(225, 15)
2.0

iex> MathHelper.log(240, 15)
2.0238320992392618

iex> MathHelper.log(1024, 10)
3.0102999566398116

iex> MathHelper.log(999999, 9999)
1.500016178459417