Liking cljdoc? Tell your friends :D

decimal.core


*cljs

source

*decimal*cljs

source

+cljs

source

+decimal+cljs

source

-cljs

source

/cljs

source

<cljs

(< v x)
(< v x & more)

Returns true if the value of this Decimal is less than the value of x, otherwise returns false.

Returns true if the value of this Decimal is less than
the value of x, otherwise returns false.
sourceraw docstring

<=cljs

(<= v x)
(<= v x & more)

Returns true if the value of this Decimal is less than or equal to the value of x, otherwise returns false.

Returns true if the value of this Decimal is less than
or equal to the value of x, otherwise returns false.
sourceraw docstring

=cljs

(= v x)
(= v x & more)

Returns true if the value of this Decimal is equal to the value of x, otherwise returns false.

Returns true if the value of this Decimal is equal to the
value of x, otherwise returns false.
sourceraw docstring

>cljs

(> v x)
(> v x & more)

Returns true if the value of this Decimal is greater than the value of x, otherwise returns false.

Returns true if the value of this Decimal is greater than
the value of x, otherwise returns false.
sourceraw docstring

>=cljs

(>= v x)
(>= v x & more)

Returns true if the value of this Decimal is greater than or equal to the value of x, otherwise returns false.

Returns true if the value of this Decimal is greater than
or equal to the value of x, otherwise returns false.
sourceraw docstring

abscljs

(abs v)

Returns a new Decimal whose value is the absolute value, i.e. the magnitude, of the value of this Decimal.

Returns a new Decimal whose value is the absolute value, i.e.
the magnitude, of the value of this Decimal.
sourceraw docstring

acoscljs

(acos v)

Returns a new Decimal whose value is the inverse cosine in radians of the value of this Decimal.

Returns a new Decimal whose value is the inverse cosine
in radians of the value of this Decimal.
sourceraw docstring

acoshcljs

(acosh v)

Returns a new Decimal whose value is the inverse hyperbolic cosine in radians of the value of this Decimal.

Returns a new Decimal whose value is the inverse hyperbolic
cosine in radians of the value of this Decimal.
sourceraw docstring

asincljs

(asin v)

Returns a new Decimal whose value is the inverse sine in radians of the value of this Decimal.

Returns a new Decimal whose value is the inverse sine in
radians of the value of this Decimal.
sourceraw docstring

asinhcljs

(asinh v)

Returns a new Decimal whose value is the inverse hyperbolic sine in radians of the value of this Decimal.

Returns a new Decimal whose value is the inverse hyperbolic
sine in radians of the value of this Decimal.
sourceraw docstring

atancljs

(atan v)

Returns a new Decimal whose value is the inverse tangent in radians of the value of this Decimal.

Returns a new Decimal whose value is the inverse tangent
in radians of the value of this Decimal.
sourceraw docstring

atanhcljs

(atanh v)

Returns a new Decimal whose value is the inverse hyperbolic tangent in radians of the value of this Decimal.

Returns a new Decimal whose value is the inverse hyperbolic
tangent in radians of the value of this Decimal.
sourceraw docstring

cbrtcljs

(cbrt v)

Returns a new Decimal whose value is the cube root of this Decimal.

Returns a new Decimal whose value is the cube root of this Decimal.
sourceraw docstring

ceilcljs

(ceil v)

Returns a new Decimal whose value is the value of this Decimal rounded to a whole number in the direction of positive Infinity.

Returns a new Decimal whose value is the value of this Decimal
rounded to a whole number in the direction of positive Infinity.
sourceraw docstring

cmpcljs

(cmp v x)

Returns 1 if the value of this Decimal is greater than the value of x, -1 if the value of this Decimal is less than the value of x, 0 if the value of Decimal is equal to the value of x and NaN if the value of this Decimal or the value of x is NaN

Returns 1 if the value of this Decimal is greater than
the value of x, -1 if the value of this Decimal is less
than the value of x, 0 if the value of Decimal is equal
to the value of x and NaN if the value of this Decimal or
the value of x is NaN
sourceraw docstring

configcljs

(config options)

The same as config but returns an constructor of decimals that can be used for create new instances with provided configuration.

The same as `config` but returns an constructor
of decimals that can be used for create new instances
with provided configuration.
sourceraw docstring

config!cljs

(config! options)

Set the global configuration for the decimal constructor.

Possible options:

  • precision: The maximum number of significant digits of the result of an operation (integer 1 to 1e+9 inclusive, default: 20).
  • rounding: The default rounding mode used when rounding the result of an operation (integer 0 to 8 inclusive, default: :round-half-up).
  • min-e: The negative exponent limit, i.e. the exponent value below which underflow to zero occurs (integer, -9e15 to 0 inclusive, default: -9e15).
  • max-e: The positive exponent limit, i.e. the exponent value above which overflow to Infinity occurs (integer, 0 to 9e15 inclusive, default: 9e15).
  • to-exp-neg: The negative exponent value at and below which toString returns exponential notation. (integer, -9e15 to 0 inclusive, default: -7)
  • to-exp-pos: The positive exponent value at and above which toString returns exponential notation. (integer, 0 to 9e15 inclusive, default: 20)
  • modulo: The modulo mode used when calculating the modulus: a mod n. (integer, 0 to 9 inclusive, default: :round-down)
  • crypto: The value that determines whether cryptographically-secure pseudo-random number generation is used. (boolean, default: false)

Rounding modes

Rounding modes are:

KeywordDescription
:round-upRounds away from zero
:round-downRounds towards zero
:round-ceilRounds towards Infinity
:round-floorRounds towards -Infinity
:round-half-upRounds towards nearest neighbour. If equidistant, rounds away from zero
:round-half-downRounds towards nearest neighbour. If equidistant, rounds towards zero
:round-half-evenRounds towards nearest neighbour. If equidistant, rounds towards even neighbour
:round-half-ceilRounds towards nearest neighbour. If equidistant, rounds towards Infinity
:round-half-floorRounds towards nearest neighbour. If equidistant, rounds towards -Infinity
:euclidNot a rounding mode, see modulo

Modulo modes

The modes that are most commonly used for the modulus/remainder operation are shown in the following table. Although the other rounding modes can be used, they may not give useful results.

KeywordDescription
:round-upThe remainder is positive if the dividend is negative, else is negative
:round-downThe remainder has the same sign as the dividend. This uses truncating division and matches the behaviour of JavaScript's remainder operator %.
:round-floorThe remainder has the same sign as the divisor. (This matches Python's % operator)
:round-half-evenThe IEEE 754 remainder function
:euclidThe remainder is always positive.

Other options

The underlying library supports more options that and this function also accepts. You can read more about here: http://mikemcl.github.io/decimal.js/#Dconfig

Set the global configuration for the decimal constructor.

Possible options:

- `precision`: The maximum number of significant digits of
  the result of an operation (integer 1 to 1e+9 inclusive,
  default: 20).
- `rounding`: The default rounding mode used when rounding
  the result of an operation (integer 0 to 8 inclusive,
  default: :round-half-up).
- `min-e`: The negative exponent limit, i.e. the exponent value below
  which underflow to zero occurs (integer, -9e15 to 0 inclusive, default:
  -9e15).
- `max-e`: The positive exponent limit, i.e. the exponent value above
  which overflow to Infinity occurs (integer, 0 to 9e15 inclusive, default:
  9e15).
- `to-exp-neg`: The negative exponent value at and below which `toString`
  returns exponential notation. (integer, -9e15 to 0 inclusive, default: -7)
- `to-exp-pos`: The positive exponent value at and above which `toString`
  returns exponential notation. (integer, 0 to 9e15 inclusive, default: 20)
- `modulo`: The modulo mode used when calculating the modulus: `a mod n`.
  (integer, 0 to 9 inclusive, default: :round-down)
- `crypto`: The value that determines whether cryptographically-secure
  pseudo-random number generation is used. (boolean, default: false)

**Rounding modes**

Rounding modes are:

Keyword           |  Description
------------------|-------------
:round-up         |  Rounds away from zero
:round-down       |  Rounds towards zero
:round-ceil       |  Rounds towards Infinity
:round-floor      |  Rounds towards -Infinity
:round-half-up    |  Rounds towards nearest neighbour. If equidistant, rounds away from zero
:round-half-down  |  Rounds towards nearest neighbour. If equidistant, rounds towards zero
:round-half-even  |  Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour
:round-half-ceil  |  Rounds towards nearest neighbour. If equidistant, rounds towards Infinity
:round-half-floor |  Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity
:euclid           |  Not a rounding mode, see modulo

**Modulo modes**

The modes that are most commonly used for the modulus/remainder operation
are shown in the following table. Although the other rounding modes can be used,
they may not give useful results.

Keyword           | Description
------------------|------------
:round-up         | The remainder is positive if the dividend is negative, else is negative
:round-down       | The remainder has the same sign as the dividend. This uses truncating division and matches the behaviour of JavaScript's remainder operator %.
:round-floor      | The remainder has the same sign as the divisor. (This matches Python's % operator)
:round-half-even  | The IEEE 754 remainder function
:euclid           | The remainder is always positive.

**Other options**

The underlying library supports more options that and this
function also accepts. You can read more about here:
http://mikemcl.github.io/decimal.js/#Dconfig
sourceraw docstring

coscljs

(cos v)

Returns a new Decimal whose value is the cosine of the value in radians of this Decimal.

Returns a new Decimal whose value is the cosine of the value
in radians of this Decimal.
sourceraw docstring

coshcljs

(cosh v)

Returns a new Decimal whose value is the hyperbolic cosine of the value in radians of this Decimal.

Returns a new Decimal whose value is the hyperbolic cosine
of the value in radians of this Decimal.
sourceraw docstring

decimalcljs

(decimal v)

Create a new Decimal instance from v value.

Create a new Decimal instance from `v` value.
sourceraw docstring

decimal-placescljs

(decimal-places v)

Returns the number of decimal places, i.e. the number of digits after the decimal point, of the value of this Decimal.

Returns the number of decimal places, i.e. the number
of digits after the decimal point, of the value of this Decimal.
sourceraw docstring

decimal?cljs

(decimal? v)

Return true if v is a instance of Decimal.

Return true if `v` is a instance of Decimal.
sourceraw docstring

divcljs

(div v x)

Returns a new Decimal whose value is the value of this Decimal divided by x, rounded to significant digits.

Returns a new Decimal whose value is the value of this
Decimal divided by x, rounded to significant digits.
sourceraw docstring

div'cljs

(div' v x)

Return a new Decimal whose value is the integer part of dividing this Decimal by x, rounded to significant digits.

Return a new Decimal whose value is the integer part
of dividing this Decimal by x, rounded to significant digits.
sourceraw docstring

expcljs

(exp v)

Returns a new Decimal whose value is the base e (Euler's number, the base of the natural logarithm) exponential of the value of this Decimal.

The ln is the invese of this function.

Returns a new Decimal whose value is the base e (Euler's number,
the base of the natural logarithm) exponential of the value of
this Decimal.

The `ln` is the invese of this function.
sourceraw docstring

finite?cljs

(finite? v)

Returns true if the value of this Decimal is a finite number, otherwise returns false. The only possible non-finite values of a Decimal are NaN, Infinity and -Infinity.

Returns true if the value of this Decimal is a finite
number, otherwise returns false.
The only possible non-finite values of a Decimal are
NaN, Infinity and -Infinity.
sourceraw docstring

floorcljs

(floor v)

Returns a new Decimal whose value is the value of this Decimal rounded to a whole number in the direction of negative Infinity.

Returns a new Decimal whose value is the value of this Decimal
rounded to a whole number in the direction of negative Infinity.
sourceraw docstring

hypotcljs

(hypot & params)

Returns a new Decimal whose value is the square root of the sum of the squares of the arguments.

Returns a new Decimal whose value is the square root of the sum
of the squares of the arguments.
sourceraw docstring

IDecimalcljsprotocol

-decimalcljs

(-decimal v)

return a decimal instance.

return a decimal instance.
source

integer?cljs

(integer? v)

Returns true if the value of this Decimal is a whole number, otherwise returns false.

Returns true if the value of this Decimal is a whole
number, otherwise returns false.
sourceraw docstring

lncljs

(ln v)

Returns a new Decimal whose value is the natural logarithm of the value of this Decimal.

Returns a new Decimal whose value is the natural logarithm of
the value of this Decimal.
sourceraw docstring

logcljs

(log v)
(log v x)

Returns a new Decimal whose value is the base x logarithm of the value of this Decimal. If x is omitted, the base 10 logarithm of the value of this Decimal will be returned.

Returns a new Decimal whose value is the base `x` logarithm
of the value of this Decimal.
If x is omitted, the base 10 logarithm of the value of
this Decimal will be returned.
sourceraw docstring

log10cljs

(log10 x)

Returns a new Decimal whose value is the base 10 logarithm of x.

Returns a new Decimal whose value is the base 10 logarithm of `x`.
sourceraw docstring

log2cljs

(log2 x)

Returns a new Decimal whose value is the base 2 logarithm of x.

Returns a new Decimal whose value is the base 2 logarithm of `x`.
sourceraw docstring

maxcljs

(max a)
(max a b)
(max a b & more)

Returns a new Decimal whose value is the maximum.

Returns a new Decimal whose value is the maximum.
sourceraw docstring

mincljs

(min a)
(min a b)
(min a b & more)

Returns a new Decimal whose value is the minimum.

Returns a new Decimal whose value is the minimum.
sourceraw docstring

minuscljs

(minus v x)

Returns a new Decimal whose value is the value of this Decimal minus x, rounded to significant digits.

Returns a new Decimal whose value is the value of this
Decimal minus x, rounded to significant digits.
sourceraw docstring

modcljs

(mod v x)

Returns a new Decimal whose value is the value of this Decimal modulo x.

The value returned, and in particular its sign, is dependent on the value of the modulo property of this Decimal's constructor. If it is 1 (default value), the result will have the same sign as this Decimal, and it will match that of Javascript's % operator (within the limits of double precision) and BigDecimal's remainder method.

See config! function docstrings for a description and available options for modulo.

Returns a new Decimal whose value is the value of
this Decimal modulo `x`.

The value returned, and in particular its sign, is
dependent on the value of the modulo property of this
Decimal's constructor. If it is 1 (default value), the
result will have the same sign as this Decimal, and it
will match that of Javascript's `%` operator (within
the limits of double precision) and `BigDecimal`'s
remainder method.

See `config!` function docstrings for a description
and available options for `modulo`.
sourceraw docstring

modulo-mappingcljs

source

mulcljs

(mul v x)

Returns a new Decimal whose value is the value of this Decimal times x, rounded to significant digits using.

Returns a new Decimal whose value is the value of this
Decimal times x, rounded to significant digits using.
sourceraw docstring

NaN?cljs

(NaN? v)

Returns true if the value of this Decimal is NaN, otherwise returns false.

Returns true if the value of this Decimal is NaN,
otherwise returns false.
sourceraw docstring

negcljs

(neg v)

Returns a new Decimal whose value is the value of this Decimal negated.

Returns a new Decimal whose value is the value of this Decimal negated.
sourceraw docstring

neg?cljs

(neg? v)

Returns true if the value of this Decimal is negative, otherwise returns false.

Returns true if the value of this Decimal is negative,
otherwise returns false.
sourceraw docstring

pluscljs

(plus v x)

Returns a new Decimal whose value is the value of this Decimal plus x, rounded to significant digits.

Returns a new Decimal whose value is the value of this
Decimal plus x, rounded to significant digits.
sourceraw docstring

pos?cljs

(pos? v)

Returns true if the value of this Decimal is negative, otherwise returns false.

Returns true if the value of this Decimal is negative,
otherwise returns false.
sourceraw docstring

powcljs

(pow v x)

Returns a new Decimal whose value is the value of this Decimal raised to the power x, rounded to precision significant digits using rounding mode rounding.

The performance of this method degrades exponentially with increasing digits. For non-integer exponents in particular, the performance of this method may not be adequate.

Returns a new Decimal whose value is the value of this Decimal raised to the
power x, rounded to precision significant digits using rounding mode
rounding.

The performance of this method degrades exponentially with increasing digits.
For non-integer exponents in particular, the performance of this method may
not be adequate.
sourceraw docstring

precisioncljs

(precision v)
(precision v include-zeros)

Returns the number of significant digits of the value of this Decimal.

If include-zeros is true, then the trailing zeros of the integer part will be included in the counter of significant digits.

Returns the number of significant digits of the value of this Decimal.

If `include-zeros` is `true`, then the trailing zeros of the integer
part will be included in the counter of significant digits.
sourceraw docstring

randomcljs

(random dp)

Returns a new Decimal with a pseudo-random value equal to or greater than 0 and less than 1. The return value will have dp decimal places (or less if trailing zeros are produced). If dp is omitted then the default will be used.

Detailed doc: http://mikemcl.github.io/decimal.js/#Drandom

Returns a new Decimal with a pseudo-random value equal to or greater
than 0 and less than 1.
The return value will have `dp` decimal places (or less if trailing
zeros are produced). If dp is omitted then the default will be used.

Detailed doc: http://mikemcl.github.io/decimal.js/#Drandom
sourceraw docstring

roundcljs

(round v)

Returns a new Decimal whose value is the value of this Decimal rounded to a whole number. To emulate Math.round, set rounding to 7 (or :round/hanf-ceil).

Returns a new Decimal whose value is the value of this Decimal
rounded to a whole number.
To emulate Math.round, set rounding to 7 (or :round/hanf-ceil).
sourceraw docstring

round-mappingcljs

source

signcljs

(sign v)

Returns the sign of the value of this Decimal.

Returns the sign of the value of this Decimal.
sourceraw docstring

sincljs

(sin v)

Returns a new Decimal whose value is the sine of the value in radians of this Decimal.

Returns a new Decimal whose value is the sine of the value
in radians of this Decimal.
sourceraw docstring

sinhcljs

(sinh v)

Returns a new Decimal whose value is the hyperbolic sine of the value in radians of this Decimal.

Returns a new Decimal whose value is the hyperbolic sine of
the value in radians of this Decimal.
sourceraw docstring

sqrtcljs

(sqrt v)

Returns a new Decimal whose value is the square root of this Decimal.

Returns a new Decimal whose value is the square root of this Decimal.
sourceraw docstring

tancljs

(tan v)

Returns a new Decimal whose value is the tangent of the value in radians of this Decimal.

Returns a new Decimal whose value is the tangent of the value
in radians of this Decimal.
sourceraw docstring

tanhcljs

(tanh v)

Returns a new Decimal whose value is the hyperbolic tangent of the value in radians of this Decimal.

Returns a new Decimal whose value is the hyperbolic
tangent of the value in radians of this Decimal.
sourceraw docstring

to-binarycljs

(to-binary v)
(to-binary v sd)
(to-binary v sd rm)

Returns a string representing the value of this Decimal in binary format.

If sd is specified, the return value will use binary exponential notation. If sd is omitted, the return value will be rounded to default significant digits. If rm is omitted, default rounding mode will be used.

Returns a string representing the value of this Decimal in binary format.

If `sd` is specified, the return value will use binary exponential notation.
If `sd` is omitted, the return value will be rounded to default significant
digits. If `rm` is omitted, default rounding mode will be used.
sourceraw docstring

to-decimal-placescljs

(to-decimal-places v)
(to-decimal-places v dp)
(to-decimal-places v dp rm)

Returns a new Decimal whose value is the value of this Decimal rounded to dp decimal places using rounding mode rm.

If dp is omitted, the return value will have the same value as this Decimal.

If rm is omitted, rounding mode rounding will be used.

Throws on an invalid dp or rm value.

Returns a new Decimal whose value is the value of this Decimal rounded to
`dp` decimal places using rounding mode `rm`.

If `dp` is omitted, the return value will have the same value as this
Decimal.

If `rm` is omitted, rounding mode `rounding` will be used.

Throws on an invalid `dp` or `rm` value.
sourceraw docstring

to-exponentialcljs

(to-exponential v)
(to-exponential v dp)
(to-exponential v dp rm)

Returns a string representing the value of this Decimal in exponential notation rounded using rounding mode rm to dp decimal places.

If the value of this Decimal in exponential notation has fewer than dp fraction digits, the return value will be appended with zeros accordingly.

If dp is omitted, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly.

If rm is omitted, rounding mode rounding is used.

Throws on an invalid dp or rm value.

Returns a string representing the value of this Decimal in
exponential notation rounded using rounding mode `rm` to `dp`
decimal places.

If the value of this Decimal in exponential notation has fewer
than `dp` fraction digits, the return value will be appended
with zeros accordingly.

If `dp` is omitted, the number of digits after the decimal
point defaults to the minimum number of digits necessary to
represent the value exactly.

If `rm` is omitted, rounding mode rounding is used.

Throws on an invalid `dp` or `rm` value.
sourceraw docstring

to-fixedcljs

(to-fixed v)
(to-fixed v dp)
(to-fixed v dp rm)

Returns a string representing the value of this Decimal in normal (fixed-point) notation rounded to dp decimal places using rounding mode rm.

If the value of this Decimal in normal notation has fewer than dp fraction digits, the return value will be appended with zeros accordingly.

Unlike Number/toFixed, which returns exponential notation if a number is greater or equal to 10^21, this method will always return normal notation.

If dp is omitted, the return value will be unrounded and in normal notation. This is unlike Number/toFixed, which returns the value to zero decimal places, but is useful when because of the current toExpNeg or toExpNeg values, toString returns exponential notation.

If rm is omitted, default rounding mode is used.

Throws on an invalid dp or rm value.

Returns a string representing the value of this Decimal in
normal (fixed-point) notation rounded to `dp` decimal places
using rounding mode `rm`.

If the value of this Decimal in normal notation has fewer
than `dp` fraction digits, the return value will be appended
with zeros accordingly.

Unlike `Number/toFixed`, which returns exponential notation
if a number is greater or equal to 10^21, this method will
always return normal notation.

If `dp` is omitted, the return value will be unrounded and
in normal notation. This is unlike `Number/toFixed`, which
returns the value to zero decimal places, but is useful when
because of the current `toExpNeg` or `toExpNeg` values,
toString returns exponential notation.

If `rm` is omitted, default rounding mode is used.

Throws on an invalid `dp` or `rm` value.
sourceraw docstring

to-fractioncljs

(to-fraction v)
(to-fraction v max-denominator)

Returns an array of two Decimals representing the value of this Decimal as a simple fraction with an integer numerator and an integer denominator. The denominator will be a positive non-zero value less than or equal to max_denominator.

If a maximum denominator is omitted, the denominator will be the lowest value necessary to represent the number exactly.

Throws on an invalid max_denominator value.

Returns an array of two Decimals representing the value of this Decimal as a
simple fraction with an integer numerator and an integer denominator. The
denominator will be a positive non-zero value less than or equal to
`max_denominator`.

If a maximum denominator is omitted, the denominator will be the lowest value
necessary to represent the number exactly.

Throws on an invalid `max_denominator` value.
sourceraw docstring

to-hexcljs

(to-hex v)
(to-hex v sd)
(to-hex v sd rm)

Returns a string representing the value of this Decimal in hexadecimal notation rounded to sd significant digits using rounding mode rm.

If sd is defined, the return value will use binary exponential notation.

If sd is omitted, the return value will be rounded to precision significant digits.

If rm is omitted, rounding mode rounding will be used.

Throws on an invalid sd or rm value.

Returns a string representing the value of this Decimal in
hexadecimal notation rounded to `sd` significant digits
using rounding mode `rm`.

If `sd` is defined, the return value will use binary
exponential notation.

If `sd` is omitted, the return value will be rounded to
`precision` significant digits.

If `rm` is omitted, rounding mode `rounding` will be used.

Throws on an invalid `sd` or `rm` value.
sourceraw docstring

to-nearestcljs

(to-nearest v n)
(to-nearest v n rm)

Returns a new Decimal whose value is the nearest multiple of x to the value of this Decimal.

If the value of this Decimal is equidistant from two multiples of x, the rounding mode rm, or rounding if rm is omitted, determines the direction of the nearest.

In this context, rounding mode :round-half-up is interpreted the same as rounding mode :round-up, and so on, i.e. the rounding is either up, down, to ceil, to floor or to even.

The return value will always have the same sign as this Decimal, unless either this Decimal or x is NaN, in which case the return value will be also be NaN.

The return value is not affected by the value of the precision setting.

Returns a new Decimal whose value is the nearest multiple of `x` to the value
of this Decimal.

If the value of this Decimal is equidistant from two multiples of `x`, the
rounding mode `rm`, or `rounding` if `rm` is omitted, determines the
direction of the nearest.

In this context, rounding mode `:round-half-up` is interpreted the same as
rounding mode `:round-up`, and so on, i.e. the rounding is either up, down,
to ceil, to floor or to even.

The return value will always have the same sign as this Decimal, unless
either this Decimal or `x` is `NaN`, in which case the return value will be
also be `NaN`.

The return value is not affected by the value of the `precision` setting.
sourceraw docstring

to-numbercljs

(to-number v)

Returns the value of this Decimal converted to a primitive number.

Type coercion with, for example, JavaScript's unary plus operator will also work, except that a Decimal with the value minus zero will convert to positive zero.

Returns the value of this Decimal converted to a primitive number.

Type coercion with, for example, JavaScript's unary plus operator will also
work, except that a Decimal with the value minus zero will convert to
positive zero.
sourceraw docstring

to-octalcljs

(to-octal v)
(to-octal v sd)
(to-octal v sd rm)

Returns a string representing the value of this Decimal in octal notation rounded to sd significant digits using rounding mode rm.

If sd is defined, the return value will use binary exponential notation.

If sd is omitted, the return value will be rounded to precision significant digits.

If rm is omitted, rounding mode rounding will be used.

Throws on an invalid sd or rm value.

Returns a string representing the value of this Decimal in
octal notation rounded to `sd` significant digits
using rounding mode `rm`.

If `sd` is defined, the return value will use binary
exponential notation.

If `sd` is omitted, the return value will be rounded to
`precision` significant digits.

If `rm` is omitted, rounding mode `rounding` will be used.

Throws on an invalid `sd` or `rm` value.
sourceraw docstring

to-precisioncljs

(to-precision v)
(to-precision v sd)
(to-precision v sd rm)

Returns a string representing the value of this Decimal in rounded to sd significant digits using rounding mode rm.

If sd is less than the number of digits necessary to represent the integer part of the value in normal (fixed-point) notation, then exponential notation is used.

If sd is omitted, the return value is the same as to-string.

If rm is omitted, rounding mode rounding will be used.

Throws on an invalid sd or rm value.

Returns a string representing the value of this Decimal in
rounded to `sd` significant digits using rounding mode `rm`.

If `sd` is less than the number of digits necessary to represent the integer
part of the value in normal (fixed-point) notation, then exponential notation
is used.

If `sd` is omitted, the return value is the same as to-string.

If `rm` is omitted, rounding mode `rounding` will be used.

Throws on an invalid `sd` or `rm` value.
sourceraw docstring

to-significant-digitscljs

(to-significant-digits v)
(to-significant-digits v sd)
(to-significant-digits v sd rm)

Returns a new Decimal whose value is the value of this Decimal rounded to sd significant digits using rounding mode rm.

If sd is omitted, the return value will be rounded to precision significant digits.

If rm is omitted, rounding mode rounding will be used.

Throws on an invalid sd or rm value.

Returns a new Decimal whose value is the value of this Decimal rounded to
`sd` significant digits using rounding mode `rm`.

If `sd` is omitted, the return value will be rounded to
`precision` significant digits.

If `rm` is omitted, rounding mode `rounding` will be used.

Throws on an invalid `sd` or `rm` value.
sourceraw docstring

to-stringcljs

(to-string v)

Returns a string representing the value of this Decimal.

If this Decimal has a positive exponent that is equal to or greater than to-exp-pos, or a negative exponent equal to or less than to-exp-neg, then exponential notation will be returned.

Returns a string representing the value of this Decimal.

If this Decimal has a positive exponent that is equal to or greater than
`to-exp-pos`, or a negative exponent equal to or less than `to-exp-neg`, then
exponential notation will be returned.
sourceraw docstring

truncatecljs

(truncate v)

Returns a new Decimal whose value is the value of this Decimal truncated to a whole number.

Returns a new Decimal whose value is the value of this Decimal
truncated to a whole number.
sourceraw docstring

value-ofcljs

(value-of v)

As toString, but zero is signed.

As toString, but zero is signed.
sourceraw docstring

with-configcljmacro

(with-config config & body)
source

zero?cljs

(zero? v)

Returns true if the value of this Decimal is zero or minus zero, otherwise returns false.

Returns true if the value of this Decimal is zero or
minus zero, otherwise returns false.
sourceraw docstring

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

× close