aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorGuilherme Andrade <[email protected]>2016-10-25 22:05:10 +0100
committerGuilherme Andrade <[email protected]>2016-11-02 18:55:28 +0000
commite21a6c9ec713219b0aa2b2a4224f97e713d7337f (patch)
tree330e95b1d8328a47d3645031ce1ddaf0e2b63496 /lib/stdlib
parent37122019312c94df2ca0347417ca50dd8daf1084 (diff)
downloadotp-e21a6c9ec713219b0aa2b2a4224f97e713d7337f.tar.gz
otp-e21a6c9ec713219b0aa2b2a4224f97e713d7337f.tar.bz2
otp-e21a6c9ec713219b0aa2b2a4224f97e713d7337f.zip
Add math:fmod/2 BIF
Returns the (floating point) remainder of first argument divided by second argument.
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/doc/src/math.xml1
-rw-r--r--lib/stdlib/src/math.erl8
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/stdlib/doc/src/math.xml b/lib/stdlib/doc/src/math.xml
index 70ca6ae78e..b4f096217a 100644
--- a/lib/stdlib/doc/src/math.xml
+++ b/lib/stdlib/doc/src/math.xml
@@ -62,6 +62,7 @@
<name name="cosh" arity="1"/>
<name name="exp" arity="1"/>
<name name="floor" arity="1"/>
+ <name name="fmod" arity="2"/>
<name name="log" arity="1"/>
<name name="log10" arity="1"/>
<name name="log2" arity="1"/>
diff --git a/lib/stdlib/src/math.erl b/lib/stdlib/src/math.erl
index 1db48cd0a2..3a3b384d8f 100644
--- a/lib/stdlib/src/math.erl
+++ b/lib/stdlib/src/math.erl
@@ -26,7 +26,8 @@
-export([sin/1, cos/1, tan/1, asin/1, acos/1, atan/1, atan2/2, sinh/1,
cosh/1, tanh/1, asinh/1, acosh/1, atanh/1, exp/1, log/1,
log2/1, log10/1, pow/2, sqrt/1, erf/1, erfc/1,
- ceil/1, floor/1]).
+ ceil/1, floor/1,
+ fmod/2]).
-spec acos(X) -> float() when
X :: number().
@@ -99,6 +100,11 @@ exp(_) ->
floor(_) ->
erlang:nif_error(undef).
+-spec fmod(X, Y) -> float() when
+ X :: number(), Y :: number().
+fmod(_, _) ->
+ erlang:nif_error(undef).
+
-spec log(X) -> float() when
X :: number().
log(_) ->