Math.purs 329 Bytes
Newer Older
1 2
module Gargantext.Utils.Math where

3
import Data.Number as DN
4 5 6
import Prelude

roundToMultiple :: Number -> Number -> Number
7
roundToMultiple eps num = eps * DN.round (num / eps)
8 9 10

-- | Logarithm with given base
logb :: Number -> Number -> Number
11
logb base n = (DN.log n) / (DN.log base)
12 13 14

log10 :: Number -> Number
log10 = logb 10.0