Real.java - J2ME浮点数计算包


GPL
跨平台
Java

软件简介

Real.java是一个适合于MIDP设备,也可用于PC平台的浮点型数值计算的开源类库。

示例代码:

public class Sample
{
// Print out 2*PI in hexadecimal form
public static void main(String [] args)
{
Real a = new Real(“0.5”);
Real b = new Real();
a.gamma(); // We all know that gamma(0.5) == sqrt(pi)
a.sqr();
b.assign(2);
a.mul(b);

Real.NumberFormat format = new Real.NumberFormat();
format.base = 16;
System.out.println(a.toString(format));
}
}