Movatterモバイル変換


[0]ホーム

URL:


Clojure

Clojure Core API Reference

Clojurev1.13.0 API
Namespaces
Other Versions
Clojure Home

API forclojure.math -Clojurev1.13.0 (in development)

byAlex Miller

Full namespace name:clojure.math

Overview

Clojure wrapper functions for java.lang.Math static methods.Function calls are inlined for performance, and type hinted for primitivelong or double parameters where appropriate. In general, Math methods areoptimized for performance and have bounds for error tolerance. Ifgreater 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

Public Variables and Functions



E

var
Constant for e, the base for natural logarithms.See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#E
Added in Clojure version 1.11
Source


IEEE-remainder

function
Usage: (IEEE-remainder dividend divisor)
Returns the remainder per IEEE 754 such that  remainder = dividend - divisor * nwhere 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 => ##NaNIf dividend is finite and divisor is infinite => dividendSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#IEEEremainder-double-double-
Added in Clojure version 1.11
Source


PI

var
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
Added in Clojure version 1.11
Source


acos

function
Usage: (acos a)
Returns the arc cosine of a, in the range 0.0 to pi.If a is ##NaN or |a|>1 => ##NaNSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#acos-double-
Added in Clojure version 1.11
Source


add-exact

function
Usage: (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-
Added in Clojure version 1.11
Source


asin

function
Usage: (asin a)
Returns the arc sine of an angle, in the range -pi/2 to pi/2.If a is ##NaN or |a|>1 => ##NaNIf a is zero => zero with the same sign as aSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#asin-double-
Added in Clojure version 1.11
Source


atan

function
Usage: (atan a)
Returns the arc tangent of a, in the range of -pi/2 to pi/2.If a is ##NaN => ##NaNIf a is zero => zero with the same sign as aSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#atan-double-
Added in Clojure version 1.11
Source


atan2

function
Usage: (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-
Added in Clojure version 1.11
Source


cbrt

function
Usage: (cbrt a)
Returns the cube root of a.If a is ##NaN => ##NaNIf a is ##Inf or ##-Inf => aIf a is zero => zero with sign matching aSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cbrt-double-
Added in Clojure version 1.11
Source


ceil

function
Usage: (ceil a)
Returns the smallest double greater than or equal to a, and equal to amathematical integer.If a is ##NaN or ##Inf or ##-Inf or already equal to an integer => aSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#ceil-double-
Added in Clojure version 1.11
Source


copy-sign

function
Usage: (copy-sign magnitude sign)
Returns a double with the magnitude of the first argument and the sign ofthe second.See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#copySign-double-double-
Added in Clojure version 1.11
Source


cos

function
Usage: (cos a)
Returns the cosine of an angle.If a is ##NaN, ##-Inf, ##Inf => ##NaNSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cos-double-
Added in Clojure version 1.11
Source


cosh

function
Usage: (cosh x)
Returns the hyperbolic cosine of x, (e^x + e^-x)/2.If x is ##NaN => ##NaNIf x is ##Inf or ##-Inf => ##InfIf x is zero => 1.0See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cosh-double-
Added in Clojure version 1.11
Source


decrement-exact

function
Usage: (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-
Added in Clojure version 1.11
Source


exp

function
Usage: (exp a)
Returns Euler's number e raised to the power of a.If a is ##NaN => ##NaNIf a is ##Inf => ##InfIf a is ##-Inf => +0.0See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#exp-double-
Added in Clojure version 1.11
Source


expm1

function
Usage: (expm1 x)
Returns e^x - 1. Near 0, expm1(x)+1 is more accurate to e^x than exp(x).If x is ##NaN => ##NaNIf x is ##Inf => #InfIf x is ##-Inf => -1.0If x is zero => xSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#expm1-double-
Added in Clojure version 1.11
Source


floor

function
Usage: (floor a)
Returns the largest double less than or equal to a, and equal to amathematical integer.If a is ##NaN or ##Inf or ##-Inf or already equal to an integer => aIf a is less than zero but greater than -1.0 => -0.0See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floor-double-
Added in Clojure version 1.11
Source


floor-div

function
Usage: (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-
Added in Clojure version 1.11
Source


floor-mod

function
Usage: (floor-mod x y)
Integer modulus x - (floorDiv(x, y) * y). Sign matches y and is in therange -|y| < r < |y|.See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floorMod-long-long-
Added in Clojure version 1.11
Source


get-exponent

function
Usage: (get-exponent d)
Returns the exponent of d.If d is ##NaN, ##Inf, ##-Inf => Double/MAX_EXPONENT + 1If d is zero or subnormal => Double/MIN_EXPONENT - 1See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#getExponent-double-
Added in Clojure version 1.11
Source


hypot

function
Usage: (hypot x y)
Returns sqrt(x^2 + y^2) without intermediate underflow or overflow.If x or y is ##Inf or ##-Inf => ##InfIf x or y is ##NaN and neither is ##Inf or ##-Inf => ##NaNSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#hypot-double-double-
Added in Clojure version 1.11
Source


increment-exact

function
Usage: (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-
Added in Clojure version 1.11
Source


log

function
Usage: (log a)
Returns the natural logarithm (base e) of a.If a is ##NaN or negative => ##NaNIf a is ##Inf => ##InfIf a is zero => ##-InfSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log-double-
Added in Clojure version 1.11
Source


log10

function
Usage: (log10 a)
Returns the logarithm (base 10) of a.If a is ##NaN or negative => ##NaNIf a is ##Inf => ##InfIf a is zero => ##-InfSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log10-double-
Added in Clojure version 1.11
Source


log1p

function
Usage: (log1p x)
Returns ln(1+x). For small values of x, log1p(x) is more accurate thanlog(1.0+x).If x is ##NaN or < -1 => ##NaNIf x is ##Inf => ##InfIf x is -1 => ##-InfIf x is 0 => 0 with sign matching xSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log1p-double-
Added in Clojure version 1.11
Source


multiply-exact

function
Usage: (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-
Added in Clojure version 1.11
Source


negate-exact

function
Usage: (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-
Added in Clojure version 1.11
Source


next-after

function
Usage: (next-after start direction)
Returns the adjacent floating point number to start in the direction ofthe second argument. If the arguments are equal, the second is returned.If either arg is #NaN => #NaNIf both arguments are signed zeros => directionIf start is +-Double/MIN_VALUE and direction would cause a smaller magnitude  => zero with sign matching startIf start is ##Inf or ##-Inf and direction would cause a smaller magnitude  => Double/MAX_VALUE with same sign as startIf start is equal to +=Double/MAX_VALUE and direction would cause a larger magnitude  => ##Inf or ##-Inf with sign matching startSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextAfter-double-double-
Added in Clojure version 1.11
Source


next-down

function
Usage: (next-down d)
Returns the adjacent double of d in the direction of ##-Inf.If d is ##NaN => ##NaNIf d is ##-Inf => ##-InfIf d is zero => -Double/MIN_VALUESee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextDown-double-
Added in Clojure version 1.11
Source


next-up

function
Usage: (next-up d)
Returns the adjacent double of d in the direction of ##Inf.If d is ##NaN => ##NaNIf d is ##Inf => ##InfIf d is zero => Double/MIN_VALUESee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextUp-double-
Added in Clojure version 1.11
Source


pow

function
Usage: (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-
Added in Clojure version 1.11
Source


random

function
Usage: (random)
Returns a positive double between 0.0 and 1.0, chosen pseudorandomly withapproximately random distribution.See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#random--
Added in Clojure version 1.11
Source


rint

function
Usage: (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 => aSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#rint-double-
Added in Clojure version 1.11
Source


round

function
Usage: (round a)
Returns the closest long to a. If equally close to two values, return the onecloser to ##Inf.If a is ##NaN => 0If a is ##-Inf or < Long/MIN_VALUE => Long/MIN_VALUEIf a is ##Inf or > Long/MAX_VALUE => Long/MAX_VALUESee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#round-double-
Added in Clojure version 1.11
Source


scalb

function
Usage: (scalb d scaleFactor)
Returns d * 2^scaleFactor, scaling by a factor of 2. If the exponentis between Double/MIN_EXPONENT and Double/MAX_EXPONENT, the answer is exact.If d is ##NaN => ##NaNIf d is ##Inf or ##-Inf => ##Inf or ##-Inf respectivelyIf d is zero => zero of same sign as dSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextDown-double-
Added in Clojure version 1.11
Source


signum

function
Usage: (signum d)
Returns the signum function of d - zero for zero, 1.0 if >0, -1.0 if <0.If d is ##NaN => ##NaNSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#signum-double-
Added in Clojure version 1.11
Source


sin

function
Usage: (sin a)
Returns the sine of an angle.If a is ##NaN, ##-Inf, ##Inf => ##NaNIf a is zero => zero with the same sign as aSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sin-double-
Added in Clojure version 1.11
Source


sinh

function
Usage: (sinh x)
Returns the hyperbolic sine of x, (e^x - e^-x)/2.If x is ##NaN => ##NaNIf x is ##Inf or ##-Inf or zero => xSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sinh-double-
Added in Clojure version 1.11
Source


sqrt

function
Usage: (sqrt a)
Returns the positive square root of a.If a is ##NaN or negative => ##NaNIf a is ##Inf => ##InfIf a is zero => aSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sqrt-double-
Added in Clojure version 1.11
Source


subtract-exact

function
Usage: (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-
Added in Clojure version 1.11
Source


tan

function
Usage: (tan a)
Returns the tangent of an angle.If a is ##NaN, ##-Inf, ##Inf => ##NaNIf a is zero => zero with the same sign as aSee:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tan-double-
Added in Clojure version 1.11
Source


tanh

function
Usage: (tanh x)
Returns the hyperbolic tangent of x, sinh(x)/cosh(x).If x is ##NaN => ##NaNIf x is zero => zero, with same signIf x is ##Inf => +1.0If x is ##-Inf => -1.0See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tanh-double-
Added in Clojure version 1.11
Source


to-degrees

function
Usage: (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-
Added in Clojure version 1.11
Source


to-radians

function
Usage: (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-
Added in Clojure version 1.11
Source


ulp

function
Usage: (ulp d)
Returns the size of an ulp (unit in last place) for d.If d is ##NaN => ##NaNIf d is ##Inf or ##-Inf => ##InfIf d is zero => Double/MIN_VALUEIf d is +/- Double/MAX_VALUE => 2^971See:https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#ulp-double-
Added in Clojure version 1.11
Source
Copyright 2007-2025 by Rich Hickey
Logo & site design byTom Hickey.
Clojure auto-documentation system by Tom Faulhaber.

[8]ページ先頭

©2009-2025 Movatter.jp