Example usage for java.lang Math log10

List of usage examples for java.lang Math log10

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static double log10(double a) 

Source Link

Document

Returns the base 10 logarithm of a double value.

Usage

From source file:Main.java

public static double getAmplitude(byte[] data, int len) {
    return (MAX_REPORTABLE_DB + (20 * Math.log10(getRawAmplitude(data, len) / MAX_REPORTABLE_AMP)));
}

From source file:Main.java

/**
 * Given a number, round up to the nearest power of ten times 1, 2, or 5.
 * /*from  w  w w  . ja  v  a  2  s  . co  m*/
 * @param val the number, it must be strictly positive
 */
private static double roundUp(final double val) {
    int exponent = (int) Math.floor(Math.log10(val));
    double rval = val * Math.pow(10, -exponent);
    if (rval > 5.0) {
        rval = 10.0;
    } else if (rval > 2.0) {
        rval = 5.0;
    } else if (rval > 1.0) {
        rval = 2.0;
    }
    rval *= Math.pow(10, exponent);
    return rval;
}

From source file:Main.java

public static double getAmplitude(short[] data, int len) {
    return (MAX_REPORTABLE_DB + 20 * Math.log10(getRawAmplitude(data, len)));
}

From source file:Main.java

public static double calculateDistance(int frequency, int level) {
    return Math.pow(10.0, (DISTANCE_MHZ_M - (20 * Math.log10(frequency)) + Math.abs(level)) / 20.0);
}

From source file:Main.java

public static String readableFileSize(long size) {
    if (size <= 0)
        return "0";
    final String[] units = new String[] { "Byte", "KB", "MB", "GB", "TB" };
    int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
    return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
}

From source file:Main.java

/**
 * Convert RSSI to distance using the free space path loss equation. See <a
 * href="http://en.wikipedia.org/wiki/Free-space_path_loss">Free-space_path_loss</a>
 *
 * @param distanceInMeters distance in meters (m)
 * @param txPowerAtSource transmitted power (dBm) calibrated to 0 meter
 * @return the rssi (dBm) that would be measured at that distance
 *//*from   w w w.ja v  a2  s.  co m*/
public static int rssiFromDistance(double distanceInMeters, int txPowerAtSource) {
    double pathLoss = 20 * Math.log10(distanceInMeters);
    return (int) (txPowerAtSource - pathLoss);
}

From source file:dsp.unige.figures.ChannelHelper.java

/**
 * Returns the noise density of a system given Satellite and Station
 * /*from  ww w . ja va  2s  .co m*/
 * @param station
 * @param satellite
 * @return the noise power density in dBW/Hz
 */
public static double getN0dBW(Station sta, Satellite sat) {

    double Te = sta.antennaNoiseTemperature + sta.amplifierNoiseTemperature + sta.getRainNoiseTemperature();
    return -228.6 + 10 * Math.log10(Te);
}

From source file:org.rockyroadshub.planner.core.utils.Utilities.java

public static String stamp(int limit) {
    StringBuilder bld = new StringBuilder("(%0");
    int digits = (int) (Math.log10(limit) + 1);
    bld.append(digits).append("d/").append(limit).append(")");
    return bld.toString();
}

From source file:asr.failure.PhiMeasure.java

/**
 * Compute phi assuming the samples have an exponential distribution.
 * /*from w  w  w. j a  v  a 2s . c o m*/
 * @param samples
 * @param test
 * @return phi
 */
public static double compute(DescriptiveStatistics samples, double test) {
    try {
        double probability = 1 - new ExponentialDistributionImpl(samples.getMean()).cumulativeProbability(test);

        return -1 * Math.log10(probability);
    } catch (MathException e) {
        throw new IllegalArgumentException(e);
    }
}

From source file:org.esa.snap.core.jexp.impl.ExtMath.java

/**
 * Returns the common logarithm, the logarithm with base 10 of a double value. Special cases:
 * <ul>/*from ww w  .  ja  v a 2  s  .  c o  m*/
 * <li>If the argument is NaN or less than zero, then the result is NaN.</li>
 * <li>If the argument is positive infinity, then the result is positive infinity.</li>
 * <li>If the argument is positive zero or negative zero, then the result is negative infinity.</li>
 * </ul>
 *
 * @param x number greater than 0.0.
 *
 * @return the natural logarithm of a.
 *
 * @deprecated since BEAM 4.10,  Use Java Math class
 */
@Deprecated
public static double log10(final double x) {
    return Math.log10(x);
}