From 8e667ffe553c5d6c0e76d3103ed6a416b4d9c3de Mon Sep 17 00:00:00 2001 From: Michael Mclaughlin Date: Wed, 30 Apr 2014 17:24:46 +0100 Subject: [PATCH] Correct links --- index.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 38eb9fb..62f8ccf 100644 --- a/index.html +++ b/index.html @@ -102,7 +102,7 @@ Decimal.random(-0.0125, 16) // '-0.0001963482803540358' // A value in the range [0, 0.9) with 1 significant digit Decimal.random(0.9, 1) // '0.2'
sqrt.sqrt() ⇒ Decimal

See squareRoot.

x = Decimal.sqrt('987654321.123456789')
 y = new Decimal('987654321.123456789').sqrt()
-x.equals(y)                    // true

Properties

The static properties of a Decimal constructor.

ONE

A Decimal instance with value one.

new Decimal(3).times(Decimal.ONE)    // '3'
Configuration properties

The values of the configuration properties precision, rounding, minE, maxE, toExpNeg, toExpPos, errors, modulo and crypto are set using the config method.

As simple object properties they can be set directly without using config, and it is fine to do so, but the values assigned will not then be checked for validity. For example:

Decimal.config({ precision: 0 })
+x.equals(y)                    // true

Properties

The static properties of a Decimal constructor.

ONE

A Decimal instance with value one.

new Decimal(3).times(Decimal.ONE)    // '3'
Configuration properties

The values of the configuration properties precision, rounding, minE, maxE, toExpNeg, toExpPos, errors, modulo and crypto are set using the config method.

As simple object properties they can be set directly without using config, and it is fine to do so, but the values assigned will not then be checked for validity. For example:

Decimal.config({ precision: 0 })
 // 'Decimal Error: config() precision out of range: 0'
 
 Decimal.precision = 0
@@ -233,12 +233,20 @@ y.log(2)                  // '8'

The return value will almost always< 0.3 - 0.1 // 0.19999999999999998 x = new Decimal(0.3) x.minus(0.1) // '0.2' -x.minus(0.6, 20) // '0'

modulo.mod(n [, base]) ⇒ Decimal

n: number|string|Decimal
base: number
See Decimal for further parameter details.

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

The value returned, and in particular its sign, is dependent on the value of the modulo property. 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 modulo for a description of the other modulo modes.

+x.minus(0.6, 20)           // '0'
modulo.mod(n [, base]) ⇒ Decimal

n: number|string|Decimal
base: number
See Decimal for further parameter details.

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

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 modulo for a description of the other modulo modes.

 1 % 0.9                    // 0.09999999999999998
 x = new Decimal(1)
 x.modulo(0.9)              // '0.1'
+
 y = new Decimal(33)
-y.mod('a', 33)             // '3'
naturalLogarithm.ln() ⇒ Decimal

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

The natual logarithm is the inverse of the exponential function.

+y.mod('a', 33)             // '3'
+
+x = new Decimal(8)
+y = new Decimal(-3)
+Decimal.modulo = 1
+x.mod(y)                   // '2'
+Decimal.modulo = 3
+x.mod(y)                   // '-1'
naturalLogarithm.ln() ⇒ Decimal

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

The natual logarithm is the inverse of the exponential function.

 x = new Decimal(10)
 x.naturalLogarithm()            // '2.3026'
 y = new Decimal('1.23e+30')