Math.purs 330 Bytes
Newer Older
1 2 3 4 5 6
module Gargantext.Utils.Math where

import Prelude
import Math as Math

roundToMultiple :: Number -> Number -> Number
7
roundToMultiple eps num = eps * Math.round (num / eps)
8 9 10 11 12 13 14

-- | Logarithm with given base
logb :: Number -> Number -> Number
logb base n = (Math.log n) / (Math.log base)

log10 :: Number -> Number
log10 = logb 10.0