dw.util
Class BigInteger
dw.util.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:integer", which is by definition
an arbitrary long integer number, require the use of this class.
The class is designed in a way that it can be used very similar to a desktop calculator. For example:
var i = new BigInteger( 10 ); var result = d.add( 2 ).sub( 3 ).get();The above code will return 9 as result.
API Versioned:
No longer available as of version 22.7.
Deprecated:
Replaced by BigInt.
Constructor Summary
BigInteger()
Constructs a new BigInteger with the value 0.
BigInteger(value
:
Number)
Constructs a new BigInteger using the specified Number value.
BigInteger(value
:
String)
Constructs a new BigInteger using the specified string representation of a number.
Method Summary
abs()
:
BigInteger
Returns a new BigInteger with the absolute value of this BigInteger.
add(value
:
Number)
:
BigInteger
Adds a Number value to this BigInteger and returns the new BigInteger.
add(value
:
BigInteger)
:
BigInteger
Adds an BigInteger value to this BigInteger and returns the new BigInteger.
divide(value
:
Number)
:
BigInteger
Divides this BigInteger by the specified BigInteger and returns the new BigInteger.
divide(value
:
BigInteger)
:
BigInteger
Divides this BigInteger by the specified BigInteger and returns the new BigInteger.
multiply(value
:
Number)
:
BigInteger
Multiples the specified Number value with this BigInteger and returns the new BigInteger.
multiply(value
:
BigInteger)
:
BigInteger
Multiples the specified BigInteger value with this BigInteger and returns the new BigInteger.
negate()
:
BigInteger
Returns a new BigInteger with the negated value of this BigInteger.
subtract(value
:
Number)
:
BigInteger
Subtracts the specified Number value from this BigInteger and returns the new BigInteger.
subtract(value
:
BigInteger)
:
BigInteger
Subtracts the specified BigInteger value from this BigInteger and returns the new BigInteger.
Methods inherited from class
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
Constructor Detail
BigInteger
public BigInteger(value
:
Number)
Constructs a new BigInteger using the specified Number value.
Parameters:
value
-
the value to use.
BigInteger
public BigInteger(value
:
String)
Constructs a new BigInteger using the specified string representation of
a number.
Parameters:
value
-
the value to use.
Method Detail
abs
abs()
:
BigInteger
Returns a new BigInteger with the absolute value of this BigInteger.
Returns:
the new BigInteger
add
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.
add
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.
divide
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
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
equals(other
:
Object)
:
boolean
Compares two BigInteger values whether they are equivalent.
Parameters:
other
-
the object to compare against this BigInteger.
get
get()
:
Number
Returns the value of the BigInteger as a Number.
Returns:
the value of the BigInteger.
multiply
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.
multiply
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.
negate
negate()
:
BigInteger
Returns a new BigInteger with the negated value of this BigInteger.
Returns:
the new BigInteger
subtract
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.
subtract
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.
toString
toString()
:
String
Returns a string representation of this object.
Returns:
a string representation of this object.
valueOf
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:
var i = new BigInteger( 10 ); var x = 1 + d.add( 2 );where x will be at the end 13.
Returns:
the value of this object.
© Copyright 2000-2024, salesforce.com inc. All rights reserved. Various trademarks held by their respective owners.