KitchenSink v1.0.1 KitchenSink.Math

Math functions!

Summary

Functions

ceil(number, significance)

See KitchenSink.Math.round_up_to_multiple/2.

div(numerator, denominator, div_by_zero)

handles divide by zero gracefully.

third argument is what to return when you divide by zero.

round_up_to_multiple(number, significance)

Always round up to the nearest multiple of significance.

Parameters

  • number: The number you wish to have rounded.
  • significance: The multiple to which you would like to round. Must not be 0.

Example:

iex> round_up_to_multiple(31, 5) 35

iex> round_up_to_multiple(29.49, 10) 30