Calculation

Add(HyperLib.Hyper)
Subtract(HyperLib.Hyper)
Multiply(System.Int64)
Divide((Int64)Divisor, (Int32)DesiredPrecision)
Divide((Int64)Divisor, (Int32)Exponent64, (Int32)DesiredPrecision)
BitShift((Int64))

Initializers

New(String)
New(LoExp, HiExp)
New(HyperLib.Hyper)

Helper methods

StripZeros()
Round(System.Int32)
Clone()
Compare(HyperLib.Hyper, HyperLib.Hyper)
IsPositive()
IsNegative()
IsNotZero()
FindBottomIndex(HyperLib.Hyper, System.Int32)
FindTopIndex(HyperLib.Hyper [, System.Int32])
Negate()
displayMode
ToString()
DefineFromDecimal(System.Int64, System.String [, System.Boolean])
NewFromString(System.String)
AddX((Hyper)xl0, (Int64)xl1ptr , (Int32)cnt1, (Int32)AtOffset)



#Properties

(int32) maxDigitsInString
(Int32) ExtraDigitsForConversionFromDecimal
TotalSize()
(System.Int32) Precision
(System.Int64) Buffer(System.Int32)
BufferSize()
PartSize()
(System.Int64) DigitAt((Int32)Exp64)
(System.Int32) QuotientPrecision
(System.Int32) DisplayMode




Calculation



Add(HyperLib.Hyper)


Returns: System.Int32 -- The last buffer index that was modified by this operation.
Adds the given Hyper value to this instance.


Subtract(HyperLib.Hyper)


Returns: System.Int32
Subtracts the given Hyper value from this instance.


Multiply(System.Int64)


Returns: System.Void (=null)
Multiplies by the given Int64


Divide((Int64)Divisor, (Int32)DesiredPrecision)


Divisor> The Long integer, which to divide by.
DesiredPrecision> Number of 64-bit digits used after decimal point in the result.
Returns: Int64 -- The remainder

Divides the number by a positive Int64 and returns the remainder.

Example: hyper1.Divide(12341234, 30) '// resize lower bound of buffer to 30 digits (1 digit = 8 bytes) and divide by 12341234


Divide((Int64)Divisor, (Int32)Exponen64, (Int32)DesiredPrecision)


Returns: System.Int64

Same as Divide described above, only that Divisor is shifted for Exponent64 * 64 bits


BitShift((Int64)nBits)


Returns: Nothing

Arithmetic bit shift. Shifts bits for the given amount in nBits. Positive nBits means shift to the left .
Please note: If the least significant digit in a Hyper variable is non-zero, bits might get cut off when performing left bit-shift. Likewise with right bit-shift and the top digit.
Use the following code if you want to preserve all bits (or use similar logic):

' VB.NET .BitShift() example - preserving bits at shifting

Dim a as New Hyper(-12,3) ' set lowest exponent to (2^64)^(-12) and the top exp. to (2^64)^(3)

'assign values
a(3) = 5
a(2) = &h8000000000000000 ' the bottom possible Int64, good for testing
a(1) = a(2) - 1
' ...
a(-12) = -1234

'perform left shift

'check if top digit is zero and enlarge buffer if not
If a(a.GetTopExp) Then a(a.GetTopExp + 1) = 0
a.BitShift(633)

'... 

'perform right shift

If a(a.GetBottExp) Then a(a.GetBottExp - 1) = 0
a.BitShift(-633)

The multiples of 64 bit shifts get handled by the hyper variable's exponent entry, the buffer doesn't resize at shifting. The remainder (nBits Mod 64), if any, gets handled by a native procedure.



Initializers



New(String)


Call to NewFromString method (see NewFromString below)


New(LoExp, HiExp)

HiExp and LoExp are Int32's
Examples:
Dim a As New Hyper(5, 0) ' initialize an integer with 6 * 64 bits
Dim a As New Hyper(-1, -4) ' float with 4 * 64 bits


New(Hyper)


Example:
Dim a As New Hyper(hyper1)


Helper methods



StripZeros()


Returns: System.Int32
Removes leading zero values from Buffer of this instance.
Example: hyper1.StripZeros()


Round(System.Int32)


Returns: System.Void
Sets the lowest exponent to negative(-) of the value provided. In other words, the precision of current instance.


Clone()


Returns: HyperLib.Hyper
Creates a copy of this instance.


Compare(HyperLib.Hyper, HyperLib.Hyper)


Returns: System.Int32 -- -1 if xl0 is less than xl1, 0 if xl0 equals xl1 and 1 if xl0 is greater.
Compares two numbers.


IsPositive()


Returns: System.Boolean -- True if positive.
Determines whether the number is positive


IsNegative()


Returns: System.Boolean -- True if negative.
Determines whether the number is negative


IsNotZero()


Returns: System.Boolean


FindBottomIndex(HyperLib.Hyper, System.Int32)


Returns: System.Int32


FindTopIndex(HyperLib.Hyper [, System.Int32])


Returns: System.Int32

Find index of the most significant non-zero Int64 in the buffer.
The second argument is the starting index (optional)


Negate()


Returns: System.Void

Negates this Hyper instance's value.


displayMode


The way in which the ToString method outputs the number.
Expressed as DisplayModeType (decimal and three others are available)


ToString()


Returns: System.String


DefineFromDecimal(System.Int64, System.String [, System.Boolean])


Returns: System.Void
Example:
Dim a As New Hyper(-123456789012345678,"9012345678901234567890123456789012345678901234567890")
Dim a As New Hyper(0,"009012345678901234567890123456789012345678901234567890", True) ' use to input negative numbers below 0 and above -1



NewFromString(System.String)


Returns: System.Int32 -- 0 if successful, -1 if not.
Assigns a value to current instance from a string.
A string, for example: "123.456678"
Until further notice, the integral part size (when inputting from string) is currently limited to maximum of 18 characters, use subsequent multiplication to get larger values
Example:
Dim a As New Hyper("-123456789012345678.9012345678901234567890123456789012345678901234567890")




AddX((Hyper)xl0, (Int64)xl1ptr , (Int32)cnt1, (Int32)AtOffset)


Returns: System.Int32 -- The index of the last array item that was modified as a result of Add operation
xl0> Destination Hyper variable
xl1ptr>Starting array item of the second operand
cnt1>Count of 64-bit digits to add
AtOffset>Starting buffer index in destination (xl0)
A wrapper for the native method. Top buffer array item value (in xl0) must be set to 0 when calling this procedure.


Properties




(int32) maxDigitsInString


Affects how many digits get displayed. This number gets aligned to a multiple of 18 in the decimal ToString method's output


(Int32) ExtraDigitsForConversionFromDecimal


Sets or returns: reserve <This Value> * 64bits extra space for calculations when converting from decimal value - some values in decimal require higher precision during the conversion.


TotalSize()


Returns: System.Int32


(System.Int32) Precision


Sets or returns:


(System.Int64) Buffer(System.Int32)


Sets or returns: Buffer value at index


BufferSize()


Returns: System.Int32


PartSize()


Sets or returns: System.Int32 -- Number of digits reserved for non-integral part of the number
Decreasing this value by 1 mathematically equates to multiplication by 2 ^ 64. May be negative.


(System.Int64) DigitAt((Int32)Exp64)


Sets or returns: The value of digit at Exponent64. Default property - can be used as hyper1(exp64)


QuotientPrecision


Defines the precision of the result of the divide procedure (/), expressed as = -(2 ^ 64) ^ QuotientPrecision. Default is 1.


DisplayMode


Affects the output of the ToString function
Sets or returns: (int32) DisplayModeType:
3 (default) = Decimal - Compared to the below modes, conversion at very low/very high exponents will take significantly longer time to complete
2 = signed hex
1 = hex
0 = Decimal but 2^64 based


Back