Clojure wrapper functions for java.lang.Math static methods.
Function calls are inlined for performance, and type hinted for primitive long or double parameters where appropriate. In general, Math methods are optimized for performance and have bounds for error tolerance. If greater precision is needed, use java.lang.StrictMath directly instead.
For more complete information, see: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html
Clojure wrapper functions for java.lang.Math static methods. Function calls are inlined for performance, and type hinted for primitive long or double parameters where appropriate. In general, Math methods are optimized for performance and have bounds for error tolerance. If greater precision is needed, use java.lang.StrictMath directly instead. For more complete information, see: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html
(acos a)
Returns the arc cosine of a, in the range 0.0 to pi. If a is ##NaN or |a|>1 => ##NaN See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#acos-double-
Returns the arc cosine of a, in the range 0.0 to pi. If a is ##NaN or |a|>1 => ##NaN See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#acos-double-
(add-exact x y)
Returns the sum of x and y, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#addExact-long-long-
Returns the sum of x and y, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#addExact-long-long-
(asin a)
Returns the arc sine of an angle, in the range -pi/2 to pi/2. If a is ##NaN or |a|>1 => ##NaN If a is zero => zero with the same sign as a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#asin-double-
Returns the arc sine of an angle, in the range -pi/2 to pi/2. If a is ##NaN or |a|>1 => ##NaN If a is zero => zero with the same sign as a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#asin-double-
(atan a)
Returns the arc tangent of a, in the range of -pi/2 to pi/2. If a is ##NaN => ##NaN If a is zero => zero with the same sign as a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#atan-double-
Returns the arc tangent of a, in the range of -pi/2 to pi/2. If a is ##NaN => ##NaN If a is zero => zero with the same sign as a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#atan-double-
(atan2 y x)
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). Computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. For more details on special cases, see: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#atan2-double-double-
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). Computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. For more details on special cases, see: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#atan2-double-double-
(cbrt a)
Returns the cube root of a. If a is ##NaN => ##NaN If a is ##Inf or ##-Inf => a If a is zero => zero with sign matching a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cbrt-double-
Returns the cube root of a. If a is ##NaN => ##NaN If a is ##Inf or ##-Inf => a If a is zero => zero with sign matching a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cbrt-double-
(ceil a)
Returns the smallest double greater than or equal to a, and equal to a mathematical integer. If a is ##NaN or ##Inf or ##-Inf or already equal to an integer => a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#ceil-double-
Returns the smallest double greater than or equal to a, and equal to a mathematical integer. If a is ##NaN or ##Inf or ##-Inf or already equal to an integer => a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#ceil-double-
(copy-sign magnitude sign)
Returns a double with the magnitude of the first argument and the sign of the second. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#copySign-double-double-
Returns a double with the magnitude of the first argument and the sign of the second. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#copySign-double-double-
(cos a)
Returns the cosine of an angle. If a is ##NaN, ##-Inf, ##Inf => ##NaN See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cos-double-
Returns the cosine of an angle. If a is ##NaN, ##-Inf, ##Inf => ##NaN See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cos-double-
(cosh x)
Returns the hyperbolic cosine of x, (e^x + e^-x)/2. If x is ##NaN => ##NaN If x is ##Inf or ##-Inf => ##Inf If x is zero => 1.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cosh-double-
Returns the hyperbolic cosine of x, (e^x + e^-x)/2. If x is ##NaN => ##NaN If x is ##Inf or ##-Inf => ##Inf If x is zero => 1.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cosh-double-
(decrement-exact a)
Returns a decremented by 1, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#decrementExact-long-
Returns a decremented by 1, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#decrementExact-long-
Constant for e, the base for natural logarithms. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#E
Constant for e, the base for natural logarithms. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#E
(exp a)
Returns Euler's number e raised to the power of a. If a is ##NaN => ##NaN If a is ##Inf => ##Inf If a is ##-Inf => +0.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#exp-double-
Returns Euler's number e raised to the power of a. If a is ##NaN => ##NaN If a is ##Inf => ##Inf If a is ##-Inf => +0.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#exp-double-
(expm1 x)
Returns e^x - 1. Near 0, expm1(x)+1 is more accurate to e^x than exp(x). If x is ##NaN => ##NaN If x is ##Inf => #Inf If x is ##-Inf => -1.0 If x is zero => x See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#expm1-double-
Returns e^x - 1. Near 0, expm1(x)+1 is more accurate to e^x than exp(x). If x is ##NaN => ##NaN If x is ##Inf => #Inf If x is ##-Inf => -1.0 If x is zero => x See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#expm1-double-
(floor a)
Returns the largest double less than or equal to a, and equal to a mathematical integer. If a is ##NaN or ##Inf or ##-Inf or already equal to an integer => a If a is less than zero but greater than -1.0 => -0.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floor-double-
Returns the largest double less than or equal to a, and equal to a mathematical integer. If a is ##NaN or ##Inf or ##-Inf or already equal to an integer => a If a is less than zero but greater than -1.0 => -0.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floor-double-
(floor-div x y)
Integer division that rounds to negative infinity (as opposed to zero). The special case (floorDiv Long/MIN_VALUE -1) overflows and returns Long/MIN_VALUE. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floorDiv-long-long-
Integer division that rounds to negative infinity (as opposed to zero). The special case (floorDiv Long/MIN_VALUE -1) overflows and returns Long/MIN_VALUE. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floorDiv-long-long-
(floor-mod x y)
Integer modulus x - (floorDiv(x, y) * y). Sign matches y and is in the range -|y| < r < |y|. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floorMod-long-long-
Integer modulus x - (floorDiv(x, y) * y). Sign matches y and is in the range -|y| < r < |y|. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floorMod-long-long-
(get-exponent d)
Returns the exponent of d. If d is ##NaN, ##Inf, ##-Inf => Double/MAX_EXPONENT + 1 If d is zero or subnormal => Double/MIN_EXPONENT - 1 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#getExponent-double-
Returns the exponent of d. If d is ##NaN, ##Inf, ##-Inf => Double/MAX_EXPONENT + 1 If d is zero or subnormal => Double/MIN_EXPONENT - 1 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#getExponent-double-
(hypot x y)
Returns sqrt(x^2 + y^2) without intermediate underflow or overflow. If x or y is ##Inf or ##-Inf => ##Inf If x or y is ##NaN and neither is ##Inf or ##-Inf => ##NaN See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#hypot-double-double-
Returns sqrt(x^2 + y^2) without intermediate underflow or overflow. If x or y is ##Inf or ##-Inf => ##Inf If x or y is ##NaN and neither is ##Inf or ##-Inf => ##NaN See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#hypot-double-double-
(IEEE-remainder dividend divisor)
Returns the remainder per IEEE 754 such that remainder = dividend - divisor * n where n is the integer closest to the exact value of dividend / divisor. If two integers are equally close, then n is the even one. If the remainder is zero, sign will match dividend. If dividend or divisor is ##NaN, or dividend is ##Inf or ##-Inf, or divisor is zero => ##NaN If dividend is finite and divisor is infinite => dividend See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#IEEEremainder-double-double-
Returns the remainder per IEEE 754 such that remainder = dividend - divisor * n where n is the integer closest to the exact value of dividend / divisor. If two integers are equally close, then n is the even one. If the remainder is zero, sign will match dividend. If dividend or divisor is ##NaN, or dividend is ##Inf or ##-Inf, or divisor is zero => ##NaN If dividend is finite and divisor is infinite => dividend See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#IEEEremainder-double-double-
(increment-exact a)
Returns a incremented by 1, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#incrementExact-long-
Returns a incremented by 1, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#incrementExact-long-
(log a)
Returns the natural logarithm (base e) of a. If a is ##NaN or negative => ##NaN If a is ##Inf => ##Inf If a is zero => ##-Inf See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log-double-
Returns the natural logarithm (base e) of a. If a is ##NaN or negative => ##NaN If a is ##Inf => ##Inf If a is zero => ##-Inf See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log-double-
(log10 a)
Returns the logarithm (base 10) of a. If a is ##NaN or negative => ##NaN If a is ##Inf => ##Inf If a is zero => ##-Inf See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log10-double-
Returns the logarithm (base 10) of a. If a is ##NaN or negative => ##NaN If a is ##Inf => ##Inf If a is zero => ##-Inf See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log10-double-
(log1p x)
Returns ln(1+x). For small values of x, log1p(x) is more accurate than log(1.0+x). If x is ##NaN or < -1 => ##NaN If x is ##Inf => ##Inf If x is -1 => ##-Inf If x is 0 => 0 with sign matching x See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log1p-double-
Returns ln(1+x). For small values of x, log1p(x) is more accurate than log(1.0+x). If x is ##NaN or < -1 => ##NaN If x is ##Inf => ##Inf If x is -1 => ##-Inf If x is 0 => 0 with sign matching x See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log1p-double-
(multiply-exact x y)
Returns the product of x and y, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#multiplyExact-long-long-
Returns the product of x and y, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#multiplyExact-long-long-
(negate-exact a)
Returns the negation of a, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#negateExact-long-
Returns the negation of a, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#negateExact-long-
(next-after start direction)
Returns the adjacent floating point number to start in the direction of the second argument. If the arguments are equal, the second is returned. If either arg is #NaN => #NaN If both arguments are signed zeros => direction If start is +-Double/MIN_VALUE and direction would cause a smaller magnitude => zero with sign matching start If start is ##Inf or ##-Inf and direction would cause a smaller magnitude => Double/MAX_VALUE with same sign as start If start is equal to +=Double/MAX_VALUE and direction would cause a larger magnitude => ##Inf or ##-Inf with sign matching start See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextAfter-double-double-
Returns the adjacent floating point number to start in the direction of the second argument. If the arguments are equal, the second is returned. If either arg is #NaN => #NaN If both arguments are signed zeros => direction If start is +-Double/MIN_VALUE and direction would cause a smaller magnitude => zero with sign matching start If start is ##Inf or ##-Inf and direction would cause a smaller magnitude => Double/MAX_VALUE with same sign as start If start is equal to +=Double/MAX_VALUE and direction would cause a larger magnitude => ##Inf or ##-Inf with sign matching start See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextAfter-double-double-
(next-down d)
Returns the adjacent double of d in the direction of ##-Inf. If d is ##NaN => ##NaN If d is ##-Inf => ##-Inf If d is zero => -Double/MIN_VALUE See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextDown-double-
Returns the adjacent double of d in the direction of ##-Inf. If d is ##NaN => ##NaN If d is ##-Inf => ##-Inf If d is zero => -Double/MIN_VALUE See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextDown-double-
(next-up d)
Returns the adjacent double of d in the direction of ##Inf. If d is ##NaN => ##NaN If d is ##Inf => ##Inf If d is zero => Double/MIN_VALUE See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextUp-double-
Returns the adjacent double of d in the direction of ##Inf. If d is ##NaN => ##NaN If d is ##Inf => ##Inf If d is zero => Double/MIN_VALUE See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextUp-double-
Constant for pi, the ratio of the circumference of a circle to its diameter. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#PI
Constant for pi, the ratio of the circumference of a circle to its diameter. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#PI
(pow a b)
Returns the value of a raised to the power of b. For more details on special cases, see: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#pow-double-double-
Returns the value of a raised to the power of b. For more details on special cases, see: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#pow-double-double-
(random)
Returns a positive double between 0.0 and 1.0, chosen pseudorandomly with approximately random distribution. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#random--
Returns a positive double between 0.0 and 1.0, chosen pseudorandomly with approximately random distribution. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#random--
(rint a)
Returns the double closest to a and equal to a mathematical integer. If two values are equally close, return the even one. If a is ##NaN or ##Inf or ##-Inf or zero => a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#rint-double-
Returns the double closest to a and equal to a mathematical integer. If two values are equally close, return the even one. If a is ##NaN or ##Inf or ##-Inf or zero => a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#rint-double-
(round a)
Returns the closest long to a. If equally close to two values, return the one closer to ##Inf. If a is ##NaN => 0 If a is ##-Inf or < Long/MIN_VALUE => Long/MIN_VALUE If a is ##Inf or > Long/MAX_VALUE => Long/MAX_VALUE See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#round-double-
Returns the closest long to a. If equally close to two values, return the one closer to ##Inf. If a is ##NaN => 0 If a is ##-Inf or < Long/MIN_VALUE => Long/MIN_VALUE If a is ##Inf or > Long/MAX_VALUE => Long/MAX_VALUE See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#round-double-
(scalb d scaleFactor)
Returns d * 2^scaleFactor, scaling by a factor of 2. If the exponent is between Double/MIN_EXPONENT and Double/MAX_EXPONENT, the answer is exact. If d is ##NaN => ##NaN If d is ##Inf or ##-Inf => ##Inf or ##-Inf respectively If d is zero => zero of same sign as d See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextDown-double-
Returns d * 2^scaleFactor, scaling by a factor of 2. If the exponent is between Double/MIN_EXPONENT and Double/MAX_EXPONENT, the answer is exact. If d is ##NaN => ##NaN If d is ##Inf or ##-Inf => ##Inf or ##-Inf respectively If d is zero => zero of same sign as d See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextDown-double-
(signum d)
Returns the signum function of d - zero for zero, 1.0 if >0, -1.0 if <0. If d is ##NaN => ##NaN See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#signum-double-
Returns the signum function of d - zero for zero, 1.0 if >0, -1.0 if <0. If d is ##NaN => ##NaN See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#signum-double-
(sin a)
Returns the sine of an angle. If a is ##NaN, ##-Inf, ##Inf => ##NaN If a is zero => zero with the same sign as a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sin-double-
Returns the sine of an angle. If a is ##NaN, ##-Inf, ##Inf => ##NaN If a is zero => zero with the same sign as a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sin-double-
(sinh x)
Returns the hyperbolic sine of x, (e^x - e^-x)/2. If x is ##NaN => ##NaN If x is ##Inf or ##-Inf or zero => x See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sinh-double-
Returns the hyperbolic sine of x, (e^x - e^-x)/2. If x is ##NaN => ##NaN If x is ##Inf or ##-Inf or zero => x See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sinh-double-
(sqrt a)
Returns the positive square root of a. If a is ##NaN or negative => ##NaN If a is ##Inf => ##Inf If a is zero => a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sqrt-double-
Returns the positive square root of a. If a is ##NaN or negative => ##NaN If a is ##Inf => ##Inf If a is zero => a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sqrt-double-
(subtract-exact x y)
Returns the difference of x and y, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#subtractExact-long-long-
Returns the difference of x and y, throws ArithmeticException on overflow. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#subtractExact-long-long-
(tan a)
Returns the tangent of an angle. If a is ##NaN, ##-Inf, ##Inf => ##NaN If a is zero => zero with the same sign as a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tan-double-
Returns the tangent of an angle. If a is ##NaN, ##-Inf, ##Inf => ##NaN If a is zero => zero with the same sign as a See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tan-double-
(tanh x)
Returns the hyperbolic tangent of x, sinh(x)/cosh(x). If x is ##NaN => ##NaN If x is zero => zero, with same sign If x is ##Inf => +1.0 If x is ##-Inf => -1.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tanh-double-
Returns the hyperbolic tangent of x, sinh(x)/cosh(x). If x is ##NaN => ##NaN If x is zero => zero, with same sign If x is ##Inf => +1.0 If x is ##-Inf => -1.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tanh-double-
(to-degrees r)
Converts an angle in radians to an approximate equivalent angle in degrees. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#toDegrees-double-
Converts an angle in radians to an approximate equivalent angle in degrees. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#toDegrees-double-
(to-radians deg)
Converts an angle in degrees to an approximate equivalent angle in radians. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#toRadians-double-
Converts an angle in degrees to an approximate equivalent angle in radians. See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#toRadians-double-
(ulp d)
Returns the size of an ulp (unit in last place) for d. If d is ##NaN => ##NaN If d is ##Inf or ##-Inf => ##Inf If d is zero => Double/MIN_VALUE If d is +/- Double/MAX_VALUE => 2^971 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#ulp-double-
Returns the size of an ulp (unit in last place) for d. If d is ##NaN => ##NaN If d is ##Inf or ##-Inf => ##Inf If d is zero => Double/MIN_VALUE If d is +/- Double/MAX_VALUE => 2^971 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#ulp-double-
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close