Skip to content

add logBase #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Data/Number.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Data.Number
, exp
, floor
, log
, logBase
, max
, min
, pow
Expand All @@ -36,6 +37,7 @@ module Data.Number
, tau
) where

import Data.EuclideanRing ((/))
import Data.Function.Uncurried (Fn4, runFn4)
import Data.Maybe (Maybe(..))

Expand Down Expand Up @@ -190,6 +192,13 @@ foreign import floor :: Number -> Number
-- | 1.0
foreign import log :: Number -> Number

-- | Returns the logarithm of a number with a given base
-- | ```purs
-- | > logBase 2.0 8.0
-- | 3.0
logBase :: Number -> Number -> Number
logBase base number = log number / log base

-- | Returns the largest of two numbers. Unlike `max` in Data.Ord this version
-- | returns NaN if either argument is NaN.
foreign import max :: Number -> Number -> Number
Expand Down