Example usage for java.lang StrictMath cbrt

List of usage examples for java.lang StrictMath cbrt

Introduction

In this page you can find the example usage for java.lang StrictMath cbrt.

Prototype

public static double cbrt(double a) 

Source Link

Document

Returns the cube root of a double value.

Usage

From source file:Main.java

public static void main(String[] args) {

    double d1 = 9.00, d2 = 123, d3 = 0;

    System.out.println("Cube root of " + d1 + " = " + StrictMath.cbrt(d1));

    System.out.println("Cube root of " + d2 + " = " + StrictMath.cbrt(d2));

    System.out.println("Cube root of " + d3 + " = " + StrictMath.cbrt(d3));
}

From source file:org.esa.beam.util.math.FastMathPerformance.java

public void testCbrt() {
    System.gc();/*from w  w w . j ava  2s  .  c om*/
    double x = 0;
    long time = System.nanoTime();
    for (int i = 0; i < RUNS; i++)
        x += StrictMath.cbrt(i * F1);
    long strictTime = System.nanoTime() - time;

    System.gc();
    double y = 0;
    time = System.nanoTime();
    for (int i = 0; i < RUNS; i++)
        y += FastMath.cbrt(i * F1);
    long fastTime = System.nanoTime() - time;

    System.gc();
    double z = 0;
    time = System.nanoTime();
    for (int i = 0; i < RUNS; i++)
        z += Math.cbrt(i * F1);
    long mathTime = System.nanoTime() - time;

    report("cbrt", x + y + z, strictTime, fastTime, mathTime);
}