Class BigInteger
The BigInteger class is a helper class to represent an arbitrary long integer number.
The Demandware framework doesn't use this class, but in some special cases
web services that declare an XML element with "xsd
The class is designed in a way that it can be used very similar to a desktop calculator. For example:
The above code will return 9 as result.
Deprecated:
Replaced by BigInt.
API Version:
No longer available as of version 22.7.
| Constructor | Description |
|---|---|
| BigInteger() | Constructs a new BigInteger with the value 0. |
| BigInteger(Number) | Constructs a new BigInteger using the specified Number value. |
| BigInteger(String) | Constructs a new BigInteger using the specified string representation of a number. |
| Method | Description |
|---|---|
| abs() | Returns a new BigInteger with the absolute value of this BigInteger. |
| add(BigInteger) | Adds an BigInteger value to this BigInteger and returns the new BigInteger. |
| add(Number) | Adds a Number value to this BigInteger and returns the new BigInteger. |
| divide(BigInteger) | Divides this BigInteger by the specified BigInteger and returns the new BigInteger. |
| divide(Number) | Divides this BigInteger by the specified BigInteger and returns the new BigInteger. |
| equals(Object) | Compares two BigInteger values whether they are equivalent. |
| get() | Returns the value of the BigInteger as a Number. |
| hashCode() | Calculates the hash code for this BigInteger; |
| multiply(BigInteger) | Multiples the specified BigInteger value with this BigInteger and returns the new BigInteger. |
| multiply(Number) | Multiples the specified Number value with this BigInteger and returns the new BigInteger. |
| negate() | Returns a new BigInteger with the negated value of this BigInteger. |
| subtract(BigInteger) | Subtracts the specified BigInteger value from this BigInteger and returns the new BigInteger. |
| subtract(Number) | Subtracts the specified Number value from this BigInteger and returns the new BigInteger. |
| toString() | Returns a string representation of this object. |
| valueOf() | The valueOf() method is called by the ECMAScript interpret to return the "natural" value of an object. |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
- BigInteger()
Constructs a new BigInteger with the value 0.
- BigInteger(value: Number)
Constructs a new BigInteger using the specified Number value.
Parameters:
- value - the value to use.
- BigInteger(value: String)
Constructs a new BigInteger using the specified string representation of a number.
Parameters:
- value - the value to use.
- abs(): BigInteger
Returns a new BigInteger with the absolute value of this BigInteger.
Returns:
- the new BigInteger
- add(value: BigInteger): BigInteger
Adds an BigInteger value to this BigInteger and returns the new BigInteger.
Parameters:
- value - the value to add to this BigInteger.
Returns:
- the new BigInteger with the value added.
- add(value: Number): BigInteger
Adds a Number value to this BigInteger and returns the new BigInteger.
Parameters:
- value - the value to add to this BigInteger.
Returns:
- the new BigInteger with the value added.
- divide(value: BigInteger): BigInteger
Divides this BigInteger by the specified BigInteger and returns the new BigInteger.
Parameters:
- value - the value to use to divide this BigInteger.
Returns:
- the new BigInteger.
- divide(value: Number): BigInteger
Divides this BigInteger by the specified BigInteger and returns the new BigInteger.
Parameters:
- value - the value to use to divide this BigInteger.
Returns:
- the new BigInteger.
- equals(other: Object): Boolean
Compares two BigInteger values whether they are equivalent.
Parameters:
- other - the object to compare against this BigInteger.
- get(): Number
Returns the value of the BigInteger as a Number.
Returns:
- the value of the BigInteger.
- hashCode(): Number
Calculates the hash code for this BigInteger;
- multiply(value: BigInteger): BigInteger
Multiples the specified BigInteger value with this BigInteger and returns the new BigInteger.
Parameters:
- value - the value to multiply with this BigInteger.
Returns:
- the new BigInteger.
- multiply(value: Number): BigInteger
Multiples the specified Number value with this BigInteger and returns the new BigInteger.
Parameters:
- value - the value to multiply with this BigInteger.
Returns:
- the new BigInteger.
- negate(): BigInteger
Returns a new BigInteger with the negated value of this BigInteger.
Returns:
- the new BigInteger
- subtract(value: BigInteger): BigInteger
Subtracts the specified BigInteger value from this BigInteger and returns the new BigInteger.
Parameters:
- value - the value to add to this BigInteger.
Returns:
- the new BigInteger with the value subtracted.
- subtract(value: Number): BigInteger
Subtracts the specified Number value from this BigInteger and returns the new BigInteger.
Parameters:
- value - the value to add to this BigInteger.
Returns:
- the new BigInteger with the value subtracted.
- toString(): String
Returns a string representation of this object.
Returns:
- a string representation of this object.
- valueOf(): Object
The valueOf() method is called by the ECMAScript interpret to return the "natural" value of an object. The BigInteger object returns its current value as number. With this behavior script snippets can be written like:
where x will be at the end 13.
Returns:
- the value of this object.