Package org.jbox2d.tests.math
Class SinCosTest
- java.lang.Object
-
- org.jbox2d.tests.math.SinCosTest
-
public class SinCosTest extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static intaccuracyIterationsstatic intCOLUMN_PADDINGstatic floatleastPreciseTablestatic floatmostPreciseTablestatic intNUM_DECIMALSstatic intnumTablesstatic intspeedIterationsstatic intspeedTrialsprivate static SinCosTable[]tables
-
Constructor Summary
Constructors Constructor Description SinCosTest()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static doubleaccuracyTest(SinCosTable table, int iterations)static voidconstructTables()constructs the tables from the static parametersstatic double[][]doAccuracyTest(boolean print)accuracy test from the static parameters, the tables array needs to be constructed as well, returns double[tables][0-3 (no lerp, lerp, then the difference)]static double[][]doSpeedTest(boolean print)speed test from the static parameters the tables array needs to be constructed as well, returns double[tables][0-3 (no lerp, lerp, then the difference)]private static java.lang.StringformatDecimal(double n, int decimals)static voidmain(java.lang.String[] args)private static voidprintTable(java.lang.String[] header, java.lang.String[] side, double[][] results)private static java.lang.StringspaceString(java.lang.String str, int space)private static longspeedTest(SinCosTable table, int numIterations, int numTrials)private static longspeedTestMath(int numIterations, int numTrials)
-
-
-
Field Detail
-
COLUMN_PADDING
public static final int COLUMN_PADDING
- See Also:
- Constant Field Values
-
NUM_DECIMALS
public static final int NUM_DECIMALS
- See Also:
- Constant Field Values
-
numTables
public static int numTables
-
mostPreciseTable
public static float mostPreciseTable
-
leastPreciseTable
public static float leastPreciseTable
-
accuracyIterations
public static int accuracyIterations
-
speedTrials
public static int speedTrials
-
speedIterations
public static int speedIterations
-
tables
private static SinCosTable[] tables
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
- Parameters:
args-
-
constructTables
public static final void constructTables()
constructs the tables from the static parameters
-
doAccuracyTest
public static final double[][] doAccuracyTest(boolean print)
accuracy test from the static parameters, the tables array needs to be constructed as well, returns double[tables][0-3 (no lerp, lerp, then the difference)]- Returns:
-
doSpeedTest
public static final double[][] doSpeedTest(boolean print)
speed test from the static parameters the tables array needs to be constructed as well, returns double[tables][0-3 (no lerp, lerp, then the difference)]- Returns:
-
accuracyTest
private static double accuracyTest(SinCosTable table, int iterations)
-
printTable
private static void printTable(java.lang.String[] header, java.lang.String[] side, double[][] results)
-
speedTest
private static long speedTest(SinCosTable table, int numIterations, int numTrials)
-
speedTestMath
private static long speedTestMath(int numIterations, int numTrials)
-
spaceString
private static java.lang.String spaceString(java.lang.String str, int space)
-
formatDecimal
private static java.lang.String formatDecimal(double n, int decimals)
-
-