|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fixbin.FixBin
FixBin the light version of the FixBin library this class can be used in 2 ways: either the static methods are used or alternatively it can be used to instantiate objects that handle the values (much like the StringBuffer class). Example 1: FixBin myVal = new FixBin("1.234"); myVal.mul(3); System.out.println("Result: " + myVal); Example 2: long myVal = FixBin-toFixBin("1.234"); long val3 = FixBin.toFixBin("3"); myVal = FixBin.mul(myVal, val3); System.out.println("Result: " + FixBin.toString(myVal));
| Field Summary | |
protected static int |
commaBitPos
|
protected static long |
commaBitVal
|
protected static long |
cosHelp1
Calculates the cosinus of the given fixbin-encoded val |
protected static long |
cosHelp2
|
static FixBin |
E
|
static long |
E_f
|
static long |
FIFTH
|
static long |
NUM105_3456
|
static long |
NUM15_336
|
static long |
NUM3_40
|
static long |
ONE
|
static FixBin |
PI
|
static long |
PI_f
|
static FixBin |
PI2
|
static long |
PI2_f
|
protected static long |
sinHelp1
Calculates the sin of a given fixbin-encoded value |
protected static long |
sinHelp2
|
| Constructor Summary | |
FixBin()
create a new instance of FixBin with value 0.0 |
|
FixBin(FixBin init)
Create a new instance of FixBin with the same value as another FixBin object |
|
FixBin(int init)
Create a new instance of FixBin with a given integer value |
|
FixBin(long init)
Create a new instance of FixBin with a given long value |
|
FixBin(java.lang.String init)
Create a new instance of FixBin with a String as initializer. |
|
| Method Summary | |
FixBin |
abs()
Turns this object into its absolute (non-negative) value |
static long |
abs(long val)
Returns the absolute value of a fixbin-encoded val |
FixBin |
add(FixBin other)
Add another fixbin object to this object |
FixBin |
add(int other)
Add an integer to this object |
FixBin |
add(long other)
Add a long value to this object |
static long |
add(long x,
long y)
adds two fixbin-values |
FixBin |
arccos()
Calculates the arccos of the current object |
static long |
arccos(long val)
Calculates the arccos of the given fixbin-encoded val |
FixBin |
arccot()
Calculates the arccot of the current object |
static long |
arccot(long val)
Calculates the arccot of the given fixbin-encoded val |
FixBin |
arcsin()
Calculates the arcsin of the current object |
static long |
arcsin(long val)
Calculates the arcsin of the given fixbin-encoded val UPDATED: modification by Petr Kuhlheim |
FixBin |
arctan()
Calculates the arctan of the current object |
static long |
arctan(long val)
Calculates the arctan of the given fixbin-encoded val UPDATED: modification by Petr Kuhlheim |
FixBin |
clone()
creates a new Instance of FixBin with the same content. |
static int |
compareTo(long x,
long y)
Compares two (fixbin-encoded) values and returns 1 if x > y, -1 if x < y, 0 if x == y |
FixBin |
cos()
Calculates the cosinus of the current object |
static long |
cos(long val)
|
FixBin |
cot()
Calculates the cotangens of the current object |
static long |
cot(long val)
Calculates the cotangens of the given fixbin-encoded val |
FixBin |
diff(FixBin other)
Returns the difference (as absolute value) between this and another FixBin-object |
FixBin |
div(FixBin other)
Divide current object by another fixbin object |
FixBin |
div(int other)
Divide current object by an int value |
FixBin |
div(long other)
Divide current object by a long int value |
static long |
div(long val1,
long val2)
Divide two fixbin-encoded values |
boolean |
equals(java.lang.Object other)
Checks, wether this object is equal to another object |
FixBin |
exp()
Calculates e to the power of the current object |
static long |
exp(long val)
Calculates e^val val should be fixbin encoded |
java.lang.String |
format(int decimals)
returns the content of the object-instance as a String with a given number of digits after the decimal point |
static java.lang.String |
format(long fixVal,
int decimals)
formats a fixbin-coded value to a String with a given number of figures after the decimal point |
boolean |
greaterEqual(FixBin other)
Checks, wether this object is greater than or equal to another object |
boolean |
greaterThan(FixBin other)
Checks, wether this object is greater than another object |
int |
intValue()
Returns the integer-value of the current object |
static int |
intValue(long val)
Returns the integer-value of a given fixbin-encoded val |
boolean |
lessEqual(FixBin other)
Checks, wether this object is less than or equal to another object |
boolean |
lessThan(FixBin other)
Checks, wether this object is less than another object |
FixBin |
ln()
Calculates the natural log of the current object |
static long |
ln(long val)
Calculates the natural log of the given fixbin-encoded val |
protected static long |
lngt1(long val)
Calculates the natural log for values > 1 |
protected static long |
lnlt1(long val)
Calculates the natural log for values < 1 |
long |
longValue()
Returns the long-value of the current object |
static long |
longValue(long val)
Returns the long-value of a given fixbin-encoded val |
FixBin |
mul(FixBin other)
Multiply another FixBin with this object |
FixBin |
mul(int other)
Multiply this object with an integer value |
FixBin |
mul(long other)
Multiply this object with a long int value |
static long |
mul(long val1,
long val2)
Multiply two fixbin encoded values |
FixBin |
pow(FixBin exp)
Calculate the current object's value by the power of the given Fixbin object. |
FixBin |
pow(int howmany)
Calculate the current object's value by the power if the given integer value |
static long |
pow(long x,
int howmany)
Calculates the power of the first parameter by the second. |
static long |
pow(long bas,
long exp)
Calculates the power of the first parameter by the second. |
static long |
quickdiv(long val1,
long val2)
Method to quickly divide two fixbin values. |
static long |
quickmul(long val1,
long val2)
Method to quickly multiply two Fixbin values. |
void |
setRawData(long value)
sets the "raw" long (fixbin-coded) value |
FixBin |
sin()
Calculates the sin of the current object |
static long |
sin(long val)
|
static long |
sqr(long x)
Calculate the square of the given fixbin-encoded value |
FixBin |
sqrt()
Calculates the square root of the current object |
FixBin |
sqrt(int nth)
Calculates the nth root of the current object |
static long |
sqrt(long val)
Calculates the square root of the given fixbin-encoded value |
static long |
sqrt(long val,
int nth)
Calculates the nth root of the given value (val). val should be fixbin-encoded, nth is just an integer value |
FixBin |
sub(FixBin other)
Substract another fixbin object from this object |
FixBin |
sub(int other)
Substract an integer value from the current Object |
FixBin |
sub(long other)
Substract a long int value from the current Object |
static long |
sub(long x,
long y)
Substract two fixbin-coded values |
FixBin |
tan()
Calculates the tangens of the current object |
static long |
tan(long val)
Calculates the tangens of the given fixbin-encoded val |
static long |
toFixBin(int val)
Transform an integer to a FixBin coded long |
static long |
toFixBin(long val)
Transform a long value to a FixBin coded long |
static long |
toFixBin(java.lang.String init)
Transform a String into a fixbin-coded LONG |
java.lang.String |
toString()
returns the content of the object-instance as a String |
static java.lang.String |
toString(long fixVal)
returns the value of the fixbin-coded value as a String |
protected static long |
xbyndivnfact(long x,
int n)
This is a helper method required by other exponential methods it calculates x ^ n / n! |
protected static long |
xmmbyndivnxppbynx2(long x,
int n)
calculates an intermediate value for ln |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final int commaBitPos
protected static final long commaBitVal
public static FixBin PI
public static FixBin E
public static FixBin PI2
public static long PI_f
public static long E_f
public static long PI2_f
public static long ONE
public static long FIFTH
public static long NUM3_40
public static long NUM15_336
public static long NUM105_3456
protected static long sinHelp1
protected static long sinHelp2
protected static long cosHelp1
protected static long cosHelp2
| Constructor Detail |
public FixBin()
public FixBin(int init)
init - (int)public FixBin(long init)
init - (long)public FixBin(FixBin init)
init - (org.fixbin.FixBin)public FixBin(java.lang.String init)
init - (String)| Method Detail |
public static long toFixBin(java.lang.String init)
init - (String)
public static long toFixBin(int val)
val - (int)
public static long toFixBin(long val)
val - (long)
public void setRawData(long value)
value - (long)public FixBin clone()
public static java.lang.String format(long fixVal,
int decimals)
fixVal - (long)decimals - (int)
public java.lang.String format(int decimals)
decimals - (int)
public static java.lang.String toString(long fixVal)
fixVal - (long)
public java.lang.String toString()
public FixBin add(FixBin other)
other - (FixBin)
public FixBin add(int other)
other - (int)
public FixBin add(long other)
other - (long)
public static long add(long x,
long y)
x - (long)y - (long)
public FixBin sub(FixBin other)
other - (FixBin)
public FixBin sub(int other)
other - (int)
public FixBin sub(long other)
other - (long)
public static long sub(long x,
long y)
x - (long)y - (long)
public FixBin mul(FixBin other)
other - (FixBin)
public FixBin mul(int other)
other - (int)
public FixBin mul(long other)
other - (long)
public static long mul(long val1,
long val2)
val1 - (long)val2 - (long)
public static long quickmul(long val1,
long val2)
val1 - (long) the first operandval2 - (long) the second operand
public FixBin div(FixBin other)
other - (FixBin)
public FixBin div(int other)
other - (int)
public FixBin div(long other)
other - (long)
public static long div(long val1,
long val2)
val1 - (long)val2 - (long)
public static long quickdiv(long val1,
long val2)
val1 - (long) the dividendval2 - (long) the divisor
public static long sqr(long x)
x - (long)
public FixBin pow(int howmany)
howmany - (int)
public FixBin pow(FixBin exp)
throws java.lang.Exception
exp - (FixBin)
java.lang.Exception
public static long pow(long x,
int howmany)
x - (long)howmany - (int)
public static long pow(long bas,
long exp)
throws java.lang.Exception
java.lang.Exception
public FixBin sqrt()
throws java.lang.Exception
java.lang.Exception
public FixBin sqrt(int nth)
throws java.lang.Exception
nth - (int)
java.lang.Exception
public static long sqrt(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
public static long sqrt(long val,
int nth)
throws java.lang.Exception
val - (long)nth - (int)
java.lang.Exception
protected static long xbyndivnfact(long x,
int n)
x - (long)n - (int)
public FixBin exp()
throws java.lang.Exception
java.lang.Exception
public static long exp(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
protected static long xmmbyndivnxppbynx2(long x,
int n)
x - (long)n - (int)
public FixBin ln()
throws java.lang.Exception
java.lang.Exception
protected static long lngt1(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
protected static long lnlt1(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
public static long ln(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
public FixBin sin()
throws java.lang.Exception
java.lang.Exception
public static long sin(long val)
throws java.lang.Exception
java.lang.Exception
public FixBin cos()
throws java.lang.Exception
java.lang.Exception
public static long cos(long val)
throws java.lang.Exception
java.lang.Exception
public FixBin tan()
throws java.lang.Exception
java.lang.Exception
public static long tan(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
public FixBin cot()
throws java.lang.Exception
java.lang.Exception
public static long cot(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
public FixBin arcsin()
throws java.lang.Exception
java.lang.Exception
public static long arcsin(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
public FixBin arccos()
throws java.lang.Exception
java.lang.Exception
public static long arccos(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
public FixBin arctan()
throws java.lang.Exception
java.lang.Exception
public static long arctan(long val)
throws java.lang.Exception
val - (long)
java.lang.Exception
public FixBin arccot()
throws java.lang.Exception
java.lang.Exception
public static long arccot(long val)
throws java.lang.Exception
val - (long)
java.lang.Exceptionpublic int intValue()
public static int intValue(long val)
val - (long)
public long longValue()
public static long longValue(long val)
val - (long)
public boolean greaterThan(FixBin other)
public boolean lessThan(FixBin other)
public boolean equals(java.lang.Object other)
public boolean greaterEqual(FixBin other)
public boolean lessEqual(FixBin other)
public static int compareTo(long x,
long y)
x - (long)y - (long)
public FixBin abs()
public static long abs(long val)
public FixBin diff(FixBin other)
other - (FixBin)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||