|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.math.FastMath
public class FastMath
This class provides faster replacements for some of the methods of java.lang.Math. Read the comments for each method before using it, since in some cases they return different results from java.lang.Math.
Constructor Summary | |
---|---|
FastMath()
|
Method Summary | |
---|---|
static double |
atan(double d)
This method calculates a fast approximation to the arctan function. |
static int |
ceil(double d)
This method produces identical results to Math.ceil() for all normal input values (one which fall inside the allowed range of the int type). |
static int |
floor(double d)
This method produces identical results to Math.floor() for all normal input values (one which fall inside the allowed range of the int type). |
static double |
pow(double base,
int exponent)
This method produces results which are nearly identical to Math.pow(), although the last few digits may be different due to numerical error. |
static int |
round(double d)
This method produces identical results to Math.round() for all normal input values (one which fall inside the allowed range of the int type). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FastMath()
Method Detail |
---|
public static int floor(double d)
public static int ceil(double d)
public static int round(double d)
public static double pow(double base, int exponent)
public static double atan(double d)
I found this formula on an internet discussion board post by Ranko Bojanic. The reference cited in that post was
Approximation Theory (C. Hastings, Jr., Note 143, Math. Tables Aids. Comp 6, 68 (1953))
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |