Example usage for java.lang Math pow

List of usage examples for java.lang Math pow

Introduction

In this page you can find the example usage for java.lang Math pow.

Prototype

@HotSpotIntrinsicCandidate
public static double pow(double a, double b) 

Source Link

Document

Returns the value of the first argument raised to the power of the second argument.

Usage

From source file:Main.java

public static double f(double t) {
    double bound = Math.pow(6. / 29, 3);
    double a = 1. / 3 * Math.pow(29. / 6, 2);
    double b = 4. / 29;
    double gamma = 1. / 3;
    if (t > bound) {
        return Math.pow(t, gamma);
    } else {//from  www .  j  a  va2s. c  o  m
        return a * t + b;
    }
}

From source file:Main.java

public static float hypo(float a, float b) {
    return (float) Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
}

From source file:Main.java

public static double toPrecision(double v, int precision) {
    double factor = Math.pow(10, precision);
    return Math.round(v * factor) / factor;
}

From source file:Main.java

public static int convertLatLong(double latLong) {
    return new Double(latLong * Math.pow(10, 6)).intValue();
}

From source file:Main.java

public static int transformToInt(double data, int radix) {
    double temp = data * (Math.pow(10.0, radix));
    return (int) temp;
}

From source file:Main.java

public static double roundNumber(double rowNumber, int roundingPoint) {
    double base = Math.pow(10D, roundingPoint);
    return Math.round(rowNumber * base) / base;
}

From source file:Main.java

public static double roundNumber(double rowNumber, int roundingPoint) {
    double base = Math.pow(10D, roundingPoint);
    return (double) Math.round(rowNumber * base) / base;
}

From source file:Main.java

public static double convertLatLongFromE6(int latLong) {
    return (new Double(latLong)) / Math.pow(10, 6);
}

From source file:Main.java

public static Long getDecimalPart(Long source, int begin, int end) {
    long t = source % (long) Math.pow(10, begin);
    t = t / (long) Math.pow(10, end);
    return t;//  w  w w .j av  a 2s .c om
}

From source file:Main.java

private static float distance(double x1, double y1, double x2, double y2) {
    return (float) Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
}