BCDFloat

Arbitrary Precision Denormalized Floating Point Arithmetic.

For the use in an FX-602P Simulator the precision is fixed at 14 decimal digits.

Note: Local variables are used in trace, and x and y variables are sometimes used inverted to the parameters declared.

Constructors

Link copied to clipboard
constructor()
Create empty value
constructor(Value: BCDFloat)
create new value from existing one.
constructor(Value: BCDInteger)
create new value from existing one.
constructor(Value: Long)
create from java long
constructor(Coefficient: Long, Exponent: Int)
create from Coefficient and Exponent
constructor(Value: String)
create from string

Types

Link copied to clipboard
Floating Point Type
Finite
Normal Real Number
NAN
Not a Number
Type_Positive_Infinity
+∞i
Type_Negative_Infinity
-∞

Properties

Link copied to clipboard
private open var Coefficient: BCDInteger
coefficient - while a 18 digits number can also be represented as an long an 18digits multiplication need a 36digits temporary and that is more then a long can do.
Link copied to clipboard
Compare result.
Link copied to clipboard
Compare result.
Link copied to clipboard
val Compare_Less: Int = -1
Compare result.
Link copied to clipboard
Effectivly needed precision.
Link copied to clipboard
private open var Exponent: Int
current exponent - note that the exponent is based on the internal representation where the radix point is right most.
Link copied to clipboard
private val Logger: Logger
Class logger instance.
Link copied to clipboard
private val Max_Exponent: Int = 1000
Maximum supported Exponent + 1
Link copied to clipboard
val Max_Precision: Int = 18
Max supported precision.
Link copied to clipboard
Not a number
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private val Num_0_5_π: BCDFloat
0.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
100, for example used for percent
Link copied to clipboard
100, for example used for percent
Link copied to clipboard
180, for example used for half a circle in degree
Link copied to clipboard
private val Num_1_div_e: BCDFloat
1 divided by Euler's number (18 digits) Unlike the original BCDFloat from Kai G.
Link copied to clipboard
Link copied to clipboard
200, for example used for half a circle in radiant.
Link copied to clipboard
private val Num_2_π: BCDFloat
2 π (18 digits) Unlike the original BCDFloat from Kai G.
Link copied to clipboard
60, For example used for seconds in an hour.
Link copied to clipboard
60, For example used for minutes in an hour.
Link copied to clipboard
Euler's number (18 digits) Unlike the original BCDFloat from Kai G.
Link copied to clipboard
private val Num_log_e_10: BCDFloat
Loge10 (18 digits) Unlike the original BCDFloat from Kai G.
Link copied to clipboard
Link copied to clipboard
π (18 digits) Unlike the original BCDFloat from Kai G.
Link copied to clipboard
private val TAG: String
Class logger tag.
Link copied to clipboard
private open var Type: BCDFloat.Float_Type
Numeric Type
Finite
Normal Real Number
NaN
Not a Number
Type_Positive_Infinity
+∞dd>
Type_Negative_Infinity
-∞

Functions

Link copied to clipboard
fun $div(Y: Number): Number
x ÷ y
Link copied to clipboard
open fun $minus(Y: Number): Number
x - y
Link copied to clipboard
x + Y
Link copied to clipboard
x × Y
Link copied to clipboard
Link copied to clipboard
fun abs(): Number
|x|
Link copied to clipboard
open fun and(y: Number): Number
Logical and
Link copied to clipboard
fun arc_cos(Half_Circle: Number): Number
arc cosine
Link copied to clipboard
area hyperbolic cosine: loge (x + √(x-1) × √(x+1))
Link copied to clipboard
fun arc_sin(Half_Circle: Number): Number
arc sine
Link copied to clipboard
area hyperbolic sine: loge (x + √(x² + 1))
Link copied to clipboard
fun arc_tan(Half_Circle: Number): Number
arc tangent
Link copied to clipboard
area hyperbolic tangent: loge ((1 + x) ÷ (1 - x)) / 2
Link copied to clipboard
open fun As_BCDFloat(): BCDFloat
Either convert to a BCDFloat or return this.
Link copied to clipboard
Either convert to a or return this.
Link copied to clipboard
Either convert to a BCDInteger or return this.
Link copied to clipboard
open fun Clone(): Number
clone the float - but it might be easier to use the provided copy Constructor instead.
Link copied to clipboard
open fun clone(): Any
clone the float - but it might be easier to use the provided copy Constructor instead.
Link copied to clipboard
coefficient - while a 18 digits number can also be represented as an long an 18digits multiplication need a 36digits temporary and that is more then a long can do.
Link copied to clipboard
coefficient - while a 18 digits number can also be represented as an long an 18digits multiplication need a 36digits temporary and that is more then a long can do.
Link copied to clipboard
fun Compare(Value: Number): Int
Compare values
Link copied to clipboard
abstract fun compareTo(p: T): Int
open fun compareTo(rightValue: Number): Int
Link copied to clipboard
fun cos(): Number
cos (x)
fun cos(Half_Circle: Number): Number
cosine
Link copied to clipboard
Hyperbolic cosine: (Exponent^x + Exponent^-x)/2
Link copied to clipboard
open fun Digits(): Array<Byte>
number: sum(i = 0 ...
Link copied to clipboard
open fun div(y: Number): Number
x ÷ y
Link copied to clipboard
open fun equals(rightValue: Any): Boolean
Link copied to clipboard
fun exp_10(): Number
10x
Link copied to clipboard
fun exp_e(): Number
ex
Link copied to clipboard
private open fun expI(): BCDFloat
Exponent^x using series expansion, usable around 0
Link copied to clipboard
fun Exponent(): Int
current exponent - note that the exponent is based on the internal representation where the radix point is right most.
Link copied to clipboard
protected open fun finalize()
Link copied to clipboard
fun Fix(Decimal: Int, Exponent: Int): BCDFloat
Round to a given Precision after the decimal point.
Link copied to clipboard
fun Frac(): BCDFloat
Recompose a frac double from the given data.
Link copied to clipboard
current exponent so that the ratix point is 1 digit to right.
Link copied to clipboard
fun getClass(): Class<out Any>
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
open fun Indirect_Value(Digit_Count: Int): Int
Get valuef or indirect addressing.
Link copied to clipboard
open fun Integer(): Number
integer part of the BCDFloat Do not mix up with To_Integer - This version returns another BCDFloat!
Link copied to clipboard
current value is a normal number
Link copied to clipboard
current value is Infinity (but not N/A).
Link copied to clipboard
open fun Is_Integer(): Boolean
Current value is integer value.
Link copied to clipboard
current value is not a number
Link copied to clipboard
Current value us negative
Link copied to clipboard
value is 0
Link copied to clipboard
private open fun lnI(): Number
loge x using series expansion, usable around 1
Link copied to clipboard
fun log_10(): Number
log10 (x)
Link copied to clipboard
fun log_e(): Number
loge (x)
Link copied to clipboard
open fun minus(y: Number): Number
x - y
Link copied to clipboard
fun neg(): Number
Link copied to clipboard
fun Normalize()
normalize the value
private open fun Normalize(maxE: Int)
Link copied to clipboard
open fun not(): Number
Logical not
Link copied to clipboard
fun notify()
Link copied to clipboard
fun notifyAll()
Link copied to clipboard
open fun Num_Digits(): Int
the current number of digits - not that when the number is not normalised there might be more 0's in the number then strictly needed.
Link copied to clipboard
open fun or(y: Number): Number
Logical or
Link copied to clipboard
fun P_To_X(θ: Number): Number
fun P_To_X(θ: Number, Half_Circle: Number): Number
Convert Polar to Rectangle Coordinates
Link copied to clipboard
fun P_To_Y(θ: Number): Number
fun P_To_Y(θ: Number, Half_Circle: Number): Number
Convert Polar to Rectangle Coordinates
Link copied to clipboard
open fun plus(y: Number): Number
x + y
Link copied to clipboard
open fun pow(y: Number): Number
xy
Link copied to clipboard
Convert Rectangle to Polar Coordinates
Link copied to clipboard
fun R_To_θ(y: Number, Half_Circle: Number): Number
Convert Rectangle to Polar Coordinates
Link copied to clipboard
fun root(r: Number): Number
r√x
Link copied to clipboard
open fun Round(): Number
Round to Effective and Max_Exponent.
fun Round(Precision: Int, Exponent: Int): Number
Round to a given Precision and Exponent.
Link copied to clipboard
private open fun Round_Effective()
Round to Effective and Max_Exponent.
Link copied to clipboard
private open fun Round_Max()
Round to Max_Precision and Max_Exponent.
Link copied to clipboard
private open fun Round_To(Precision: Int, Exponent: Int)
Round to a given Precision and Exponent.
Link copied to clipboard
fun sin(): Number
fun sin(Half_Circle: Number): Number
sine
Link copied to clipboard
hyperbolic sine: (ex - e-x) ÷ 2
Link copied to clipboard
private open fun sinI(): Number
sin using series expansion, usable around 0 (-π ..
Link copied to clipboard
fun square(): Number
x2
Link copied to clipboard
2√x
Link copied to clipboard
fun tan(): Number
tan x
fun tan(Half_Circle: Number): Number
tangent
Link copied to clipboard
Hyperbolic tangent: (e2x - 1) ÷ (e2x + 1)
Link copied to clipboard
open fun times(y: Number): Number
x × y
Link copied to clipboard
convert to native/debug string representation
Link copied to clipboard
open fun To_Integer(): Int
Convert to integer Do not mix up with Integer - This version returns a Java int!
Link copied to clipboard
open fun To_Long(): Long
Convert to long integer Do not mix up with Integer - This version returns a Java int!
Link copied to clipboard
open fun toString(): String
convert to scientific string representation
Link copied to clipboard
fun wait()
Link copied to clipboard
open fun xor(y: Number): Number
Logical xor