Liking cljdoc? Tell your friends :D
Mostly clj.
Exceptions indicated.

fastmath.core

Collection of fast math functions and plethora of constants known from other math libraries.

Primitive math operators

Based on Primitive Math by Zach Tellman several operators are introduced and replace clojure.core functions. All operators are macros and can't be used as functions. List includes:

Known from Clojure: * + - / > < >= <= == rem quot mod bit-or bit-and bit-xor bit-not bit-shift-left bit-shift-right unsigned-bit-shift-right inc dec zero? neg? pos? min max even? odd?

And additionally:

  • bool-and - and working on booleans
  • bool-or - boolean or
  • bool-xor - boolean xor
  • bool-not - boolean not
  • << - bit shift left
  • >> - signed bit shift right
  • >>> - unsigned bit shift right
  • not== - not equal

To turn on primitive math on your namespace call use-primitive-operators. To turn off and revert original versions call unuse-primitive-operators

Fast Math

Almost all math functions are backed by FastMath library. Most of them are macros. Some of them are wrapped in Clojure functions. Almost all operates on primitive double and returns double (with an exception round or qround which returns long).

Other functions

Additionally namespace contains functions which are common in frameworks like OpenFrameworks and Processing.

Collection of fast math functions and plethora of constants known from other math libraries.

#### Primitive math operators

Based on [Primitive Math by Zach Tellman](https://github.com/ztellman/primitive-math) several operators are introduced and replace `clojure.core` functions. All operators are macros and can't be used as functions. List includes:

Known from Clojure: `*` `+` `-` `/` `>` `<` `>=` `<=` `==` `rem` `quot` `mod` `bit-or` `bit-and` `bit-xor` `bit-not` `bit-shift-left` `bit-shift-right` `unsigned-bit-shift-right` `inc` `dec` `zero?` `neg?` `pos?` `min` `max` `even?` `odd?`

And additionally:

* `bool-and` - `and` working on booleans
* `bool-or` - boolean `or`
* `bool-xor` - boolean `xor`
* `bool-not` - boolean `not`
* `<<` - bit shift left
* `>>` - signed bit shift right
* `>>>` - unsigned bit shift right
* `not==` - not equal

To turn on primitive math on your namespace call [[use-primitive-operators]].
To turn off and revert original versions call [[unuse-primitive-operators]]

#### Fast Math

Almost all math functions are backed by [FastMath](https://github.com/jeffhain/jafama) library. Most of them are macros. Some of them are wrapped in Clojure functions. Almost all operates on primitive `double` and returns `double` (with an exception [[round]] or [[qround]] which returns `long`).

#### Other functions

Additionally namespace contains functions which are common in frameworks like OpenFrameworks and Processing.

* For random/noise functions check [[fastmath.random]] namespace.
* [[fastmath.vector]] contains vector (2,3,4 dim. + double array + clojure vector) protocol and implementations.
* [[fastmath.complex]] contains complex number operations.
raw docstring

*clj/smacro

(* x)
(* x y)
(* x y & rest)

A primitive math version of *

A primitive math version of `*`
sourceraw docstring

+clj/smacro

(+ x)
(+ x y)
(+ x y & rest)

A primitive math version of +

A primitive math version of `+`
sourceraw docstring

-clj/smacro

(- x)
(- x y)
(- x y & rest)

A primitive math version of -

A primitive math version of `-`
sourceraw docstring

/clj/smacro

(/ x)
(/ x y)
(/ x y & rest)

A primitive math version of /

A primitive math version of `/`
sourceraw docstring

<clj/smacro

(< x)
(< x y)
(< x y & rest)

A primitive math version of <

A primitive math version of `<`
sourceraw docstring

<<clj/smacro

(<< x y)

fastmath.java.PrimitiveMath/shiftLeft function wrapped in macro.

fastmath.java.PrimitiveMath/shiftLeft function wrapped in macro.
sourceraw docstring

<=clj/smacro

(<= x)
(<= x y)
(<= x y & rest)

A primitive math version of <=

A primitive math version of `<=`
sourceraw docstring

==clj/smacro

(== x)
(== x y)
(== x y & rest)

Equality. See also eq for function version.

Equality. See also [[eq]] for function version.
sourceraw docstring

>clj/smacro

(> x)
(> x y)
(> x y & rest)

A primitive math version of >

A primitive math version of `>`
sourceraw docstring

>=clj/smacro

(>= x)
(>= x y)
(>= x y & rest)

A primitive math version of >=

A primitive math version of `>=`
sourceraw docstring

>>clj/smacro

(>> x y)

fastmath.java.PrimitiveMath/shiftRight function wrapped in macro.

fastmath.java.PrimitiveMath/shiftRight function wrapped in macro.
sourceraw docstring

>>>clj/smacro

(>>> x y)

fastmath.java.PrimitiveMath/unsignedShiftRight function wrapped in macro.

fastmath.java.PrimitiveMath/unsignedShiftRight function wrapped in macro.
sourceraw docstring

absclj

(abs x)

\(|x|\) - double version. See iabs.

\\(|x|\\) - `double` version. See [[iabs]].
sourceraw docstring

acosclj/smacro

(acos x)

net.jafama.FastMath/acos function wrapped in macro.

net.jafama.FastMath/acos function wrapped in macro.
sourceraw docstring

acoshclj/smacro

(acosh x)

net.jafama.FastMath/acosh function wrapped in macro.

net.jafama.FastMath/acosh function wrapped in macro.
sourceraw docstring

acotclj

(acot v)

Arccotangent

Arccotangent
sourceraw docstring

acothclj

(acoth v)

Area hyperbolic cotangent

Area hyperbolic cotangent
sourceraw docstring

acscclj

(acsc v)

Arccosecant

Arccosecant
sourceraw docstring

acschclj

(acsch v)

Area hyperbolic cosecant

Area hyperbolic cosecant
sourceraw docstring

approxclj

(approx v)
(approx v digits)

Round v to specified (default: 2) decimal places. Be aware of double number accuracy.

Round `v` to specified (default: 2) decimal places. Be aware of `double` number accuracy.
sourceraw docstring

approx-eqclj

(approx-eq a b)
(approx-eq a b digits)

Checks equality approximately. See approx.

Checks equality approximately. See [[approx]].
sourceraw docstring

asecclj

(asec v)

Arcsecant

Arcsecant
sourceraw docstring

asechclj

(asech v)

Area hyperbolic secant

Area hyperbolic secant
sourceraw docstring

asinclj/smacro

(asin x)

net.jafama.FastMath/asin function wrapped in macro.

net.jafama.FastMath/asin function wrapped in macro.
sourceraw docstring

asinhclj/smacro

(asinh x)

net.jafama.FastMath/asinh function wrapped in macro.

net.jafama.FastMath/asinh function wrapped in macro.
sourceraw docstring

atanclj/smacro

(atan x)

net.jafama.FastMath/atan function wrapped in macro.

net.jafama.FastMath/atan function wrapped in macro.
sourceraw docstring

atan2clj/smacro

(atan2 x y)

net.jafama.FastMath/atan2 function wrapped in macro.

net.jafama.FastMath/atan2 function wrapped in macro.
sourceraw docstring

atanhclj/smacro

(atanh x)

net.jafama.FastMath/atanh function wrapped in macro.

net.jafama.FastMath/atanh function wrapped in macro.
sourceraw docstring

bessel-jclj/smacro

(bessel-j x y)

Bessel J function value for given order and argument.

Bessel J function value for given order and argument.
sourceraw docstring

bit-andclj/smacro

(bit-and x)
(bit-and x y)
(bit-and x y & rest)

A primitive math version of bit-and

A primitive math version of `bit-and`
sourceraw docstring

bit-notclj/smacro

(bit-not x)

fastmath.java.PrimitiveMath/bitNot function wrapped in macro.

fastmath.java.PrimitiveMath/bitNot function wrapped in macro.
sourceraw docstring

bit-orclj/smacro

(bit-or x)
(bit-or x y)
(bit-or x y & rest)

A primitive math version of bit-or

A primitive math version of `bit-or`
sourceraw docstring

bit-shift-leftclj/smacro

(bit-shift-left x y)

fastmath.java.PrimitiveMath/shiftLeft function wrapped in macro.

fastmath.java.PrimitiveMath/shiftLeft function wrapped in macro.
sourceraw docstring

bit-shift-rightclj/smacro

(bit-shift-right x y)

fastmath.java.PrimitiveMath/shiftRight function wrapped in macro.

fastmath.java.PrimitiveMath/shiftRight function wrapped in macro.
sourceraw docstring

bit-xorclj/smacro

(bit-xor x)
(bit-xor x y)
(bit-xor x y & rest)

A primitive math version of bit-xor

A primitive math version of `bit-xor`
sourceraw docstring

bool-andclj/smacro

(bool-and x)
(bool-and x y)
(bool-and x y & rest)

A primitive math version of bool-and

A primitive math version of `bool-and`
sourceraw docstring

bool-notclj/smacro

(bool-not x)

fastmath.java.PrimitiveMath/not function wrapped in macro.

fastmath.java.PrimitiveMath/not function wrapped in macro.
sourceraw docstring

bool-orclj/smacro

(bool-or x)
(bool-or x y)
(bool-or x y & rest)

A primitive math version of bool-or

A primitive math version of `bool-or`
sourceraw docstring

bool-xorclj/smacro

(bool-xor x)
(bool-xor x y)
(bool-xor x y & rest)

A primitive math version of bool-xor

A primitive math version of `bool-xor`
sourceraw docstring

cbrtclj/smacro

(cbrt x)

\(\sqrt[3]{x}\)

\\(\sqrt[3]{x}\\)
sourceraw docstring

ceilclj

(ceil x)

\(\lceil x \rceil\). See: qceil.

\\(\lceil x \rceil\\). See: [[qceil]].
sourceraw docstring

cnormclj

(cnorm v start stop)
(cnorm v start1 stop1 start2 stop2)

Constrained version of norm. Result of norm is applied to constrain to [0,1] or [start2,stop2] ranges.

Constrained version of norm. Result of [[norm]] is applied to [[constrain]] to `[0,1]` or `[start2,stop2]` ranges.
sourceraw docstring

constrainclj/smacro

(constrain value mn mx)

Clamp value to the range [mn,mx].

Clamp `value` to the range `[mn,mx]`.
sourceraw docstring

cosclj/smacro

(cos x)

net.jafama.FastMath/cos function wrapped in macro.

net.jafama.FastMath/cos function wrapped in macro.
sourceraw docstring

cos-interpolationclj

(cos-interpolation start stop t)

oF interpolateCosine interpolation. See also lerp/mlerp, quad-interpolation or smooth-interpolation.

oF interpolateCosine interpolation. See also [[lerp]]/[[mlerp]], [[quad-interpolation]] or [[smooth-interpolation]].
sourceraw docstring

coshclj/smacro

(cosh x)

net.jafama.FastMath/cosh function wrapped in macro.

net.jafama.FastMath/cosh function wrapped in macro.
sourceraw docstring

cotclj

(cot v)

Cotangent

Cotangent
sourceraw docstring

cothclj

(coth v)

Hyperbolic cotangent

Hyperbolic cotangent
sourceraw docstring

cscclj

(csc v)

Cosecant

Cosecant
sourceraw docstring

cschclj

(csch v)

Hyperbolic cosecant

Hyperbolic cosecant
sourceraw docstring

decclj/smacro

(dec x)

fastmath.java.PrimitiveMath/dec function wrapped in macro.

fastmath.java.PrimitiveMath/dec function wrapped in macro.
sourceraw docstring

deg-in-radclj

\(\frac{\pi}{180}\)

\\(\frac{\pi}{180}\\)
sourceraw docstring

degreesclj

(degrees rad)

Convert radians into degrees.

Convert radians into degrees.
sourceraw docstring

digammaclj/smacro

(digamma x)

Logarithmic derivative of \(\Gamma\).

Logarithmic derivative of \\(\Gamma\\).
sourceraw docstring

distclj

(dist x1 y1 x2 y2)

Euclidean distance between points (x1,y1) and (x2,y2). See fastmath.vector namespace to see other metrics which work on vectors.

Euclidean distance between points `(x1,y1)` and `(x2,y2)`. See [[fastmath.vector]] namespace to see other metrics which work on vectors.
sourceraw docstring

double-array->seqclj

Convert double array into sequence.

Alias for seq.

Convert double array into sequence.

Alias for `seq`.
sourceraw docstring

double-array-typeclj

source

double-double-array->seqclj

(double-double-array->seq res)

Convert double array of double arrays into sequence of sequences.

Convert double array of double arrays into sequence of sequences.
sourceraw docstring

double-double-array-typeclj

source

Eclj

Value of \(e\)

Value of \\(e\\)
sourceraw docstring

EPSILONclj

Very small number \(\varepsilon\)

Very small number \\(\varepsilon\\)
sourceraw docstring

eqclj

(eq a)
(eq a b)
(eq a b c)
(eq a b c d)

Primitive math equality function for doubles. See ==.

Primitive math equality function for doubles. See [[==]].
sourceraw docstring

erfclj/smacro

(erf x)
(erf x y)

Error function. For two arguments return difference between (erf x) and (erf y).

Error function. For two arguments return difference between `(erf x)` and `(erf y)`.
sourceraw docstring

erfcclj/smacro

(erfc x)

Complementary error function.

Complementary error function.
sourceraw docstring

even?clj/smacro

(even? x)

fastmath.java.PrimitiveMath/isEven function wrapped in macro.

fastmath.java.PrimitiveMath/isEven function wrapped in macro.
sourceraw docstring

expclj/smacro

(exp x)

net.jafama.FastMath/exp function wrapped in macro.

net.jafama.FastMath/exp function wrapped in macro.
sourceraw docstring

floorclj

(floor x)

\(\lfloor x \rfloor\). See: qfloor.

\\(\lfloor x \rfloor\\). See: [[qfloor]].
sourceraw docstring

fpowclj/smacro

(fpow x y)

Fast version of pow where exponent is integer.

Fast version of pow where exponent is integer.
sourceraw docstring

fracclj

(frac v)

Fractional part, always returns values from 0.0 to 1.0 (exclusive). See sfrac for signed version.

Fractional part, always returns values from 0.0 to 1.0 (exclusive). See [[sfrac]] for signed version.
sourceraw docstring

gammaclj/smacro

(gamma x)

Gamma function \(\Gamma(x)\)

Gamma function \\(\Gamma(x)\\)
sourceraw docstring

GAMMAclj

Lanchos approximation g constant

Lanchos approximation `g` constant
sourceraw docstring

gcdclj

(gcd a b)
source

HALF_PIclj

Value of \(\frac{\pi}{2}\)

Value of \\(\frac{\pi}{2}\\)
sourceraw docstring

high-2-expclj

(high-2-exp v)

Find lowest exponent (power of 2) which is greater or equal x. See low-2-exp.

Find lowest exponent (power of 2) which is greater or equal `x`. See [[low-2-exp]].
sourceraw docstring

high-expclj

(high-exp b x)

Find lowest exponent for base b which is higher or equalx. See also low-exp.

Find lowest exponent for base `b` which is higher or equal`x`. See also [[low-exp]].
sourceraw docstring

hypotclj

(hypot x y)
(hypot x y z)

Hypot. See also hypot-sqrt.

Hypot.
See also [[hypot-sqrt]].
sourceraw docstring

hypot-sqrtclj

(hypot-sqrt x y)
(hypot-sqrt x y z)

Hypot, sqrt version: \(\sqrt{x^2+y^2}\) or \(\sqrt{x^2+y^2+z^2}\). Should be faster than hypot.

Hypot, sqrt version: \\(\sqrt{x^2+y^2}\\) or \\(\sqrt{x^2+y^2+z^2}\\).
Should be faster than [[hypot]].
sourceraw docstring

iabsclj

(iabs x)

\(|x|\) - long version. See abs.

\\(|x|\\) - `long` version. See [[abs]].
sourceraw docstring

incclj/smacro

(inc x)

fastmath.java.PrimitiveMath/inc function wrapped in macro.

fastmath.java.PrimitiveMath/inc function wrapped in macro.
sourceraw docstring

inv-erfclj/smacro

(inv-erf x)

Inverse erf.

Inverse [[erf]].
sourceraw docstring

inv-erfcclj/smacro

(inv-erfc x)

Inverse erfc.

Inverse [[erfc]].
sourceraw docstring

inv-gamma-1pm1clj/smacro

(inv-gamma-1pm1 x)

\(\frac{1}{\Gamma(1+x)}\).

\\(\frac{1}{\Gamma(1+x)}\\).
sourceraw docstring

INV_LN2clj

\(\frac{1}{\ln{2}}\)

\\(\frac{1}{\ln{2}}\\)
sourceraw docstring

INV_LOG_HALFclj

\(\frac{1}{\ln{0.5}}\)

\\(\frac{1}{\ln{0.5}}\\)
sourceraw docstring

itruncclj

(itrunc v)

Truncate fractional part, keep sign. Returns long.

Truncate fractional part, keep sign. Returns `long`.
sourceraw docstring

lerpclj

(lerp start stop t)

Linear interpolation between start and stop for amount t. See also mlerp, cos-interpolation, quad-interpolation or smooth-interpolation.

Linear interpolation between `start` and `stop` for amount `t`. See also [[mlerp]], [[cos-interpolation]], [[quad-interpolation]] or [[smooth-interpolation]].
sourceraw docstring

lnclj/smacro

(ln x)

net.jafama.FastMath/log function wrapped in macro.

net.jafama.FastMath/log function wrapped in macro.
sourceraw docstring

LN10clj

\(\ln{10}\)

\\(\ln{10}\\)
sourceraw docstring

LN2clj

\(\ln{2}\)

\\(\ln{2}\\)
sourceraw docstring

LN2_2clj

\(\frac{\ln{2}}{2}\)

\\(\frac{\ln{2}}{2}\\)
sourceraw docstring

logclj/smacro

(log x)

net.jafama.FastMath/log function wrapped in macro.

net.jafama.FastMath/log function wrapped in macro.
sourceraw docstring

log-betaclj/smacro

(log-beta x y)

Logarithm of Beta function.

Logarithm of Beta function.
sourceraw docstring

log-gammaclj/smacro

(log-gamma x)

Gamma function \(\ln\Gamma(x)\)

Gamma function \\(\ln\Gamma(x)\\)
sourceraw docstring

log-gamma-1pclj/smacro

(log-gamma-1p x)

Gamma function \(\ln\Gamma(1+x)\)

Gamma function \\(\ln\Gamma(1+x)\\)
sourceraw docstring

log10clj/smacro

(log10 x)

\(\ln_{10}{x}\)

\\(\ln_{10}{x}\\)
sourceraw docstring

LOG10Eclj

\(\log_{10}{e}\)

\\(\log_{10}{e}\\)
sourceraw docstring

log1pclj/smacro

(log1p x)

net.jafama.FastMath/log1p function wrapped in macro.

net.jafama.FastMath/log1p function wrapped in macro.
sourceraw docstring

log2clj

(log2 x)

Logarithm with base 2.

\(\ln_2{x}\)

Logarithm with base 2.

\\(\ln_2{x}\\)
sourceraw docstring

LOG2Eclj

\(\log_{2}{e}\)

\\(\log_{2}{e}\\)
sourceraw docstring

logbclj

(logb b x)

Logarithm with base b.

\(\ln_b{x}\)

Logarithm with base `b`.

\\(\ln_b{x}\\)
sourceraw docstring

low-2-expclj

(low-2-exp x)

Find greatest exponent (power of 2) which is lower or equal x. See high-2-exp.

Find greatest exponent (power of 2) which is lower or equal `x`. See [[high-2-exp]].
sourceraw docstring

low-expclj

(low-exp b x)

Find greatest exponent for base b which is lower or equal x. See also high-exp.

Find greatest exponent for base `b` which is lower or equal `x`. See also [[high-exp]].
sourceraw docstring

M_1_PIclj

\(\frac{1}{\pi}\)

\\(\frac{1}{\pi}\\)
sourceraw docstring

M_2_PIclj

\(\frac{2}{\pi}\)

\\(\frac{2}{\pi}\\)
sourceraw docstring

M_2_SQRTPIclj

\(\frac{2}{\sqrt\pi}\)

\\(\frac{2}{\sqrt\pi}\\)
sourceraw docstring

M_3PI_4clj

\(\frac{3\pi}{4}\)

\\(\frac{3\pi}{4}\\)
sourceraw docstring

M_Eclj

\(e\)

\\(e\\)
sourceraw docstring

M_INVLN2clj

\(\frac{1}{\ln{2}}\)

\\(\frac{1}{\ln{2}}\\)
sourceraw docstring

M_IVLN10clj

\(\frac{1}{\ln{10}}\)

\\(\frac{1}{\ln{10}}\\)
sourceraw docstring

M_LN10clj

\(\ln{10}\)

\\(\ln{10}\\)
sourceraw docstring

M_LN2clj

\(\ln{2}\)

\\(\ln{2}\\)
sourceraw docstring

M_LOG10Eclj

\(\log_{10}{e}\)

\\(\log_{10}{e}\\)
sourceraw docstring

M_LOG2_Eclj

\(\ln{2}\)

\\(\ln{2}\\)
sourceraw docstring

M_LOG2Eclj

\(\log_{2}{e}\)

\\(\log_{2}{e}\\)
sourceraw docstring

M_PIclj

\(\pi\)

\\(\pi\\)
sourceraw docstring

M_PI_2clj

\(\frac{\pi}{2}\)

\\(\frac{\pi}{2}\\)
sourceraw docstring

M_PI_4clj

\(\frac{\pi}{4}\)

\\(\frac{\pi}{4}\\)
sourceraw docstring

M_SQRT1_2clj

\(\frac{1}{\sqrt{2}}\)

\\(\frac{1}{\sqrt{2}}\\)
sourceraw docstring

M_SQRT2clj

\(\sqrt{2}\)

\\(\sqrt{2}\\)
sourceraw docstring

M_SQRT3clj

\(\sqrt{3}\)

\\(\sqrt{3}\\)
sourceraw docstring

M_SQRT_PIclj

\(\sqrt\pi\)

\\(\sqrt\pi\\)
sourceraw docstring

M_TWOPIclj

\(2\pi\)

\\(2\pi\\)
sourceraw docstring

MACHINE-EPSILONclj

Smallest machine number. Value is calculated during evaluation and may differ on different processors.

Smallest machine number. Value is calculated during evaluation and may differ on different processors.
sourceraw docstring

make-normclj

(make-norm start stop)
(make-norm start stop dstart dstop)

Make norm function for given range. Resulting function accepts double value (with optional target [dstart,dstop] range) and returns double.

Make [[norm]] function for given range. Resulting function accepts `double` value (with optional target `[dstart,dstop]` range) and returns `double`.
sourceraw docstring

maxclj/smacro

(max x)
(max x y)
(max x y & rest)

A primitive math version of max

A primitive math version of `max`
sourceraw docstring

minclj/smacro

(min x)
(min x y)
(min x y & rest)

A primitive math version of min

A primitive math version of `min`
sourceraw docstring

mlerpclj/smacro

(mlerp start stop t)

lerp as macro. For inline code. See also lerp, cos-interpolation, quad-interpolation or smooth-interpolation.

[[lerp]] as macro. For inline code. See also [[lerp]], [[cos-interpolation]], [[quad-interpolation]] or [[smooth-interpolation]].
sourceraw docstring

modclj/smacro

(mod x y)

fastmath.java.PrimitiveMath/modulus function wrapped in macro.

fastmath.java.PrimitiveMath/modulus function wrapped in macro.
sourceraw docstring

neg?clj/smacro

(neg? x)

fastmath.java.PrimitiveMath/isNeg function wrapped in macro.

fastmath.java.PrimitiveMath/isNeg function wrapped in macro.
sourceraw docstring

next-doubleclj

(next-double v)
(next-double v delta)

Next double value. Optional value delta sets step amount.

Next double value. Optional value `delta` sets step amount.
sourceraw docstring

normclj

(norm v start stop)
(norm v start1 stop1 start2 stop2)

Normalize v from the range [start,stop] to the range [0,1] or map v from the range [start1,stop1] to the range [start2,stop2]. See also make-norm.

Normalize `v` from the range `[start,stop]` to the range `[0,1]` or map `v` from the range `[start1,stop1]` to the range `[start2,stop2]`. See also [[make-norm]].
sourceraw docstring

not==clj/smacro

(not== x)
(not== x y)
(not== x y & rest)

A primitive math version of not==

A primitive math version of `not==`
sourceraw docstring

odd?clj/smacro

(odd? x)

fastmath.java.PrimitiveMath/isOdd function wrapped in macro.

fastmath.java.PrimitiveMath/isOdd function wrapped in macro.
sourceraw docstring

PHIclj

Golden ratio \(\varphi\)

Golden ratio \\(\varphi\\)
sourceraw docstring

PIclj

Value of \(\pi\)

Value of \\(\pi\\)
sourceraw docstring

pos?clj/smacro

(pos? x)

fastmath.java.PrimitiveMath/isPos function wrapped in macro.

fastmath.java.PrimitiveMath/isPos function wrapped in macro.
sourceraw docstring

powclj/smacro

(pow x y)

net.jafama.FastMath/pow function wrapped in macro.

net.jafama.FastMath/pow function wrapped in macro.
sourceraw docstring

pow2clj

(pow2 x)

Same as sq. \(x^2\)

Same as [[sq]]. \\(x^2\\)
sourceraw docstring

pow3clj

(pow3 x)

\(x^3\)

\\(x^3\\)
sourceraw docstring

prev-doubleclj

(prev-double v)
(prev-double v delta)

Previous double value. Optional value delta sets step amount.

Previous double value. Optional value `delta` sets step amount.
sourceraw docstring

qceilclj/smacro

(qceil x)

Fast version of ceil. Returns long. See: ceil.

Fast version of [[ceil]]. Returns `long`. See: [[ceil]].
sourceraw docstring

qcosclj/smacro

(qcos x)

Fast and less accurate cos.

Fast and less accurate [[cos]].
sourceraw docstring

qdistclj

(qdist x1 y1 x2 y2)

Quick version of Euclidean distance between points. qsqrt is used instead of sqrt.

Quick version of Euclidean distance between points. [[qsqrt]] is used instead of [[sqrt]].
sourceraw docstring

qexpclj/smacro

(qexp x)

Quick and less accurate version of exp.

Quick and less accurate version of [[exp]].
sourceraw docstring

qfloorclj/smacro

(qfloor x)

Fast version of floor. Returns long. See: floor.

Fast version of [[floor]]. Returns `long`. See: [[floor]].
sourceraw docstring

qlogclj/smacro

(qlog x)

Fast and less accurate version of log.

Fast and less accurate version of [[log]].
sourceraw docstring

qpowclj/smacro

(qpow x y)

Fast and less accurate version of pow.

Fast and less accurate version of [[pow]].
sourceraw docstring

qroundclj/smacro

(qround x)

Fast version of round. Returns long. See: rint, round.

Fast version of [[round]]. Returns `long`. See: [[rint]], [[round]].
sourceraw docstring

qsinclj/smacro

(qsin x)

Fast and less accurate sin.

Fast and less accurate [[sin]].
sourceraw docstring

qsqrtclj/smacro

(qsqrt x)

Approximated sqrt using binary operations with error 1.0E-2.

Approximated [[sqrt]] using binary operations with error `1.0E-2`.
sourceraw docstring

quad-interpolationclj

(quad-interpolation start stop t)

Quad interpolation. See also lerp/mlerp, cos-interpolation or smooth-interpolation.

Quad interpolation. See also [[lerp]]/[[mlerp]], [[cos-interpolation]] or [[smooth-interpolation]].
sourceraw docstring

QUARTER_PIclj

Value of \(\frac{\pi}{4}\)

Value of \\(\frac{\pi}{4}\\)
sourceraw docstring

quotclj/smacro

(quot x y)

fastmath.java.PrimitiveMath/quotient function wrapped in macro.

fastmath.java.PrimitiveMath/quotient function wrapped in macro.
sourceraw docstring

rad-in-degclj

\(\frac{180}{\pi}\)

\\(\frac{180}{\pi}\\)
sourceraw docstring

radiansclj

(radians deg)

Convert degrees into radians.

Convert degrees into radians.
sourceraw docstring

regularized-betaclj/smacro

(regularized-beta x y z)

Regularized Beta.

Regularized `Beta`.
sourceraw docstring

regularized-gamma-pclj/smacro

(regularized-gamma-p x y)

Regularized gamma P

Regularized `gamma` P
sourceraw docstring

regularized-gamma-qclj/smacro

(regularized-gamma-q x y)

Regularized gamma Q

Regularized `gamma` Q
sourceraw docstring

remclj/smacro

(rem x y)

fastmath.java.PrimitiveMath/remainder function wrapped in macro.

fastmath.java.PrimitiveMath/remainder function wrapped in macro.
sourceraw docstring

remainderclj/smacro

(remainder x y)

From FastMath doc: returns dividend - divisor * n, where n is the mathematical integer closest to dividend/divisor. Returned value in [-|divisor|/2,|divisor|/2]

From `FastMath` doc: returns dividend - divisor * n,
where n is the mathematical integer closest to dividend/divisor. Returned value in `[-|divisor|/2,|divisor|/2]`
sourceraw docstring

rintclj

(rint x)

Round to double. See round, qround.

Round to `double`. See [[round]], [[qround]].
sourceraw docstring

roundclj

(round x)

Round to long. See: rint, qround.

Round to `long`. See: [[rint]], [[qround]].
sourceraw docstring

round-up-pow2clj

(round-up-pow2 v)

Round long to the next power of 2

Round long to the next power of 2
sourceraw docstring

rqsqrtclj/smacro

(rqsqrt x)

Inversed version of qsqrt. Quick and less accurate.

Inversed version of [[qsqrt]]. Quick and less accurate.
sourceraw docstring

safe-sqrtclj

(safe-sqrt value)

Safe sqrt, for value <= 0 result is 0.

\( \left\{ \begin{array}{lr} 0 & : x \leq 0\\ \sqrt{x} & : x > 0 \end{array} \right. \)

Safe sqrt, for value <= 0 result is 0.

\\(
\left\\{
\begin{array}{lr}
0 & : x \leq 0\\\\
\sqrt{x} & : x > 0
\end{array}
\\right.
\\)
sourceraw docstring

sampleclj

(sample f number-of-values)
(sample f range-min range-max number-of-values)

Sample function f and return sequence of values.

range-min defaults to 0.0, range-max to 1.0.

Range is inclusive.

Sample function `f` and return sequence of values.

`range-min` defaults to 0.0, `range-max` to 1.0.

Range is inclusive.
sourceraw docstring

secclj

(sec v)

Secant

Secant
sourceraw docstring

sechclj

(sech v)

Hyperbolic secant

Hyperbolic secant
sourceraw docstring

seq->double-arrayclj

(seq->double-array vs)

Convert sequence to double-array.

If sequence is double-array do not convert.

Convert sequence to double-array.

If sequence is double-array do not convert.
sourceraw docstring

seq->double-double-arrayclj

(seq->double-double-array vss)

Convert sequence to double-array of double-arrays.

If sequence is double-array of double-arrays do not convert

Convert sequence to double-array of double-arrays.

If sequence is double-array of double-arrays do not convert
sourceraw docstring

sfracclj

(sfrac v)

Fractional part, always returns values from -1.0 to 1.0 (exclusive). See frac for unsigned version.

Fractional part, always returns values from -1.0 to 1.0 (exclusive). See [[frac]] for unsigned version.
sourceraw docstring

sgnclj

(sgn value)

Return -1 when value is negative, 1 otherwise. See also signum.

\( \left\{ \begin{array}{lr} 1.0 & : x \geq 0\\ -1.0 & : x < 0\\ \end{array} \right. \)

Return -1 when `value` is negative, 1 otherwise. See also [[signum]].

\\(
\left\\{
\begin{array}{lr}
1.0 & : x \geq 0\\\\
-1.0 & : x < 0\\\\
\end{array}
\\right.
\\)
sourceraw docstring

sigmoidclj

(sigmoid x)

Sigmoid function

Sigmoid function
sourceraw docstring

signumclj

(signum value)

Return 1 if value is > 0, 0 if it is 0, -1 otherwise. See also sgn.

\( \left\{ \begin{array}{lr} 1.0 & : x > 0\\ -1.0 & : x < 0\\ 0.0 & : x = 0 \end{array} \right. \)

Return 1 if `value` is > 0, 0 if it is 0, -1 otherwise. See also [[sgn]].

\\(
\left\\{
\begin{array}{lr}
1.0 & : x > 0\\\\
-1.0 & : x < 0\\\\
0.0 & : x = 0
\end{array}
\\right.
\\)
sourceraw docstring

sinclj/smacro

(sin x)

net.jafama.FastMath/sin function wrapped in macro.

net.jafama.FastMath/sin function wrapped in macro.
sourceraw docstring

sincclj

(sinc v)

Sinc function.

Sinc function.
sourceraw docstring

sinhclj/smacro

(sinh x)

net.jafama.FastMath/sinh function wrapped in macro.

net.jafama.FastMath/sinh function wrapped in macro.
sourceraw docstring

SIXTHclj

Value of \(\frac{1}{6}\)

Value of \\(\frac{1}{6}\\)
sourceraw docstring

smooth-interpolationclj

(smooth-interpolation start stop t)

Smoothstep based interpolation. See also lerp/mlerp, quad-interpolation or cos-interpolation.

Smoothstep based interpolation. See also [[lerp]]/[[mlerp]], [[quad-interpolation]] or [[cos-interpolation]].
sourceraw docstring

smoothstepclj

(smoothstep edge0 edge1 x)
GL [smoothstep](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/smoothstep.xhtml).
sourceraw docstring

sqclj

(sq x)

Same as pow2. \(x^2\)

Same as [[pow2]]. \\(x^2\\)
sourceraw docstring

sqrtclj/smacro

(sqrt x)

\(\sqrt{x}\)

\\(\sqrt{x}\\)
sourceraw docstring

SQRT2clj

\(\sqrt{2}\)

\\(\sqrt{2}\\)
sourceraw docstring

SQRT2_2clj

\(\frac{\sqrt{2}}{2}\)

\\(\frac{\sqrt{2}}{2}\\)
sourceraw docstring

SQRT2PIclj

\(\sqrt{2\pi}\)

\\(\sqrt{2\pi}\\)
sourceraw docstring

SQRT3clj

\(\sqrt{3}\)

\\(\sqrt{3}\\)
sourceraw docstring

SQRT5clj

\(\sqrt{5}\)

\\(\sqrt{5}\\)
sourceraw docstring

SQRTPIclj

\(\sqrt{\pi}\)

\\(\sqrt{\pi}\\)
sourceraw docstring

tanclj/smacro

(tan x)

net.jafama.FastMath/tan function wrapped in macro.

net.jafama.FastMath/tan function wrapped in macro.
sourceraw docstring

tanhclj/smacro

(tanh x)

net.jafama.FastMath/tanh function wrapped in macro.

net.jafama.FastMath/tanh function wrapped in macro.
sourceraw docstring

TAUclj

Alias for TWO_PI

Alias for [[TWO_PI]]
sourceraw docstring

THIRDclj

Value of \(\frac{1}{3}\)

Value of \\(\frac{1}{3}\\)
sourceraw docstring

THIRD_PIclj

Value of \(\frac{\pi}{3}\)

Value of \\(\frac{\pi}{3}\\)
sourceraw docstring

trigammaclj/smacro

(trigamma x)

Derivative of digamma.

Derivative of [[digamma]].
sourceraw docstring

truncclj

(trunc v)

Truncate fractional part, keep sign. Returns double.

Truncate fractional part, keep sign. Returns `double`.
sourceraw docstring

TWO_PIclj

Value of \(2 {\pi}\)

Value of \\(2 {\pi}\\)
sourceraw docstring

TWO_THIRDclj

Value of \(\frac{2}{3}\)

Value of \\(\frac{2}{3}\\)
sourceraw docstring

unsigned-bit-shift-rightclj/smacro

(unsigned-bit-shift-right x y)

fastmath.java.PrimitiveMath/unsignedShiftRight function wrapped in macro.

fastmath.java.PrimitiveMath/unsignedShiftRight function wrapped in macro.
sourceraw docstring

unuse-primitive-operatorsclj

(unuse-primitive-operators)

Undoes the work of use-primitive-operators. This is idempotent.

Undoes the work of [[use-primitive-operators]]. This is idempotent.
sourceraw docstring

use-primitive-operatorsclj

(use-primitive-operators)

Replaces Clojure's arithmetic and number coercion functions with primitive equivalents. These are defined as macros, so they cannot be used as higher-order functions. This is an idempotent operation. Undo with unuse-primitive-operators.

Replaces Clojure's arithmetic and number coercion functions with primitive equivalents.  These are
defined as macros, so they cannot be used as higher-order functions. This is an idempotent operation. Undo with [[unuse-primitive-operators]].
sourceraw docstring

wrapclj

(wrap start stop value)

Wrap overflowed value into the range, similar to ofWrap.

Wrap overflowed value into the range, similar to [ofWrap](http://openframeworks.cc/documentation/math/ofMath/#!show_ofWrap).
sourceraw docstring

zero?clj/smacro

(zero? x)

fastmath.java.PrimitiveMath/isZero function wrapped in macro.

fastmath.java.PrimitiveMath/isZero function wrapped in macro.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close