|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--myMath
On the case of J-PHONE's JavaAppli, J-PHONE's JBlend (that is the platform of J-PHONE's Java apolicatoins) has FixedPointed Class and with it we can use pointed-number at a brief accuracy. J-PHONE is a Japanese campany of cellur phones and releases phones that can run Java applications. For more information, see http://www.dp.j-phone.com/.
On the other case, in addition to the J-PHONE's case of requiring more accuracy, we can use MathFP library. This library is made in 64bit and on the most of the cases we can manage with this library.
But both of these libraries are constructed on FixedPoint method, so on some cases we across to calcuration errors. For example, "10000 * 0.0001" results "0.9997" on MathFP. This is caused by a rounded error and buiding on FixedPoint method we cannot avoid it.
To avoid rounded error, the library should be built on FloatedPoint method. For my searching, I found that there existed no pointed-number library that is built on FloatedPoint method. So I decided to make it by myself, and now I released this library.
You can use this library freely almost all of the cases, but only when you customize this library and republish it, please tell me and also tell the users of your customized library the truth that it is a customization of this original library. It is not necessary to publish with sources, which is the deference of GPL. I hope this library will become a much help to you.
Thank you. by rarul
An instance of this library uses one long and an int. And most of the method will cost much machine power. So when you think of using this library on a poor platform, I advise you should not use this library.
Field Summary | |
static myMath |
CON_E
Instance of mathematical e. |
static myMath |
CON_PI
Instance os mathmatical PI. |
static int |
prec
Accuracy of this library. |
Constructor Summary | |
myMath()
Default constructor. |
|
myMath(long in)
Construct with setting number. |
|
myMath(long in,
int i)
Construct with setting number. |
|
myMath(myMath b)
Make clone of b. |
|
myMath(java.lang.String str)
Construct with setting number. |
Method Summary | |
void |
add(myMath b)
Add b to this and set the result. |
static myMath |
add(myMath a,
myMath b)
Add a to b and return the result. |
void |
cos()
|
void |
div(myMath b)
Div this by b and set the result. |
static myMath |
div(myMath a,
myMath b)
Div a by b and return the result. |
static long |
fact(int n)
Calculate n!. |
myMath |
getDecimal()
|
long |
getInteger()
Return the integer part. |
static boolean |
max(myMath n,
myMath m)
If n>=m then return true. |
void |
Mod(myMath b)
|
static myMath |
Mod(myMath a,
myMath b)
|
void |
mul(myMath b)
Mul b to this and set the result. |
static myMath |
mul(myMath a,
myMath b)
Mul a to b and return the result. |
static long |
power(int n,
int m)
Calculate n^m and return it. |
void |
set(long in)
make [in] number. |
void |
set(long in,
int i)
make in*10^i number. |
void |
set(myMath b)
Copy b. |
void |
set(java.lang.String str)
make [str] number. |
void |
sin()
|
void |
sub(myMath b)
Sub b to this and set the result. |
static myMath |
sub(myMath a,
myMath b)
Sub b from a and return the result. |
java.lang.String |
toString()
Print in a format of using "E". |
java.lang.String |
toStringD()
Print in a format of non using "E" |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int prec
public static final myMath CON_E
public static final myMath CON_PI
Constructor Detail |
public myMath()
public myMath(long in)
set(long).
public myMath(java.lang.String str)
set(String).
public myMath(long in, int i)
set(long,int).
public myMath(myMath b)
set(myMath).
Method Detail |
public void set(myMath b)
myMath( myMath).
public void set(long in)
myMath( long).
public void set(long in, int i)
myMath( long, int).
public void set(java.lang.String str)
myMath( String).
public void add(myMath b)
add( myMath, myMath)
public void sub(myMath b)
sub( myMath, myMath)
public void mul(myMath b)
mul( myMath, myMath)
public void div(myMath b)
div( myMath, myMath)
public static myMath add(myMath a, myMath b)
add( myMath)
public static myMath sub(myMath a, myMath b)
sub( myMath)
public static myMath mul(myMath a, myMath b)
mul( myMath)
public static myMath div(myMath a, myMath b)
div( myMath)
public static long fact(int n)
public static long power(int n, int m)
public static boolean max(myMath n, myMath m)
sub( myMath, myMath)
,
div( myMath, myMath)
public long getInteger()
public java.lang.String toString()
toString
in class java.lang.Object
toStringD()
public java.lang.String toStringD()
toString()
public myMath getDecimal()
public void Mod(myMath b)
public static myMath Mod(myMath a, myMath b)
public void cos()
public void sin()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |