Class Calculation
Class defined in:src/js/Calculation.js:15
Class to compute the result of an operation of two ordinal numbers.
The intended usage to perform an arithmetic operation is as follows: First, you create a Calculation object by invoking the constructor. Then you invoke the simplify-Method on the object, which returns a normalized Ordinal as an object of type Ord. When comparing two Ordinals (type Ord) against each other, directly call the static Calculation.compare method. All other methods should not be used from outside the class.
Calculation( leftOpnd, rightOpnd, optor )
src/js/Calculation.js:15
Parameters:
-
leftOpnd<Operand / Ord / OrdSummand / number> -
rightOpnd<Operand / Ord / OrdSummand / number> -
optor<Operator>
checkOpnds( ) /* private method */
src/js/Calculation.js:839
Checks if the operands of the calculation object are of type Ord and have at least one summand (i.e. are not undefined).
cmpNatural( a, b ) /* private method */
src/js/Calculation.js:684
Compare two integers (type "number") operands.
Parameters:cmpNaturalOrdinal( natural, ordinal ) /* private method */
src/js/Calculation.js:649
Compare an Operand of type Ord with a primitive integer operand.
Parameters:compare( a, b )
src/js/Calculation.js:136
The main compare function. Use this method from outside the Calculation class to compare two ordinals -- which may also be of type 'number' -- against each other.
Parameters:-
a<Ord / number>The first operand. Might be an instance of Ord or a simple integer of type 'number'.
-
b<Ord / number>The second operand. Same type conventions.
compareOrdinals( a, b )
src/js/Calculation.js:709
Compare the value of two Ordinal numbers (objects of type Ord).
Parameters:decreaseOne( ord ) /* private method */
src/js/Calculation.js:764
Decrease the argument "ord" by one, so that: 1 + ( decreaseOne(ord) ) = ord.
Parameters:-
ord<Ord / number>
expOrdinals( ) /* private method */
src/js/Calculation.js:330
Calculates the ordinal (left ^ right).
Might pass through an exception from the method sFinitePower
multiplyOrdinals( ) /* private method */
src/js/Calculation.js:255
Calculates the ordinal (left * right).
natToOrd( num )
src/js/Calculation.js:821
Converts a value of type 'number' into an Ord object. If num is already an Ord object, it will be returned unchanged.
Parameters:-
num<Ord / number>
sFinitePower( oBase, nExp, cObj ) /* private method */
src/js/Calculation.js:425
Helper method for expOrdinals(): Calculates the power
of an infinite base and a finite exponent.
Should only be used from inside the Calculation class.
Throws an error (of type ClassedError) when the exponent is too great.
-
oBase<Ord>The Base. Must be an Ordinal. (And should be greater than / equal to omega).
-
nExp<Number>The exponent. Must be an instance of number!
-
cObj<Calculation>Optional. If defined, the static method can register an error to the object.
simplify( )
src/js/Calculation.js:101
Simplifies the expression consisting of left operand, right operand and operator.
sInfPower( oBase, oExp, cObj ) /* private method */
src/js/Calculation.js:561
Helper method for expOrdinals(): Calculates the power of an infinite base and an infinite exponent. Should only be used from inside the Calculation class.
Parameters:-
oBase<Ord>The Base. Must be an Ord AND must be greater than / equal to omega.
-
oExp<Ord>The exponent. Must be an instance of Ord
-
cObj<Calculation>Optional. If defined, the static method can register an error to the object.
sIsValidNatural( val )
src/js/Calculation.js:801
Tests if a value is inside a range from 0 to Calculation.maxNatural. Natural numbers shouldn't exceed this value in this application, as there could result inaccurate calculations due to javascripts floating arithmetic.
Parameters:-
val<Number>The value to test
sIsValueNull( val ) /* private method */
src/js/Calculation.js:782
Static function to check if value is 0, whether it is of type Ord or a number.
Parameters:-
val<Ord / number>
sumOrdinals( ) /* private method */
src/js/Calculation.js:193
Calculates the ordinal sum of (left + right).
calcErr <ClassedError>src/js/Calculation.js:55
If there is an error message, then that indicates that an error has occurred
Transfinite Ordinal Calculator: Calculation