Example usage for org.apache.commons.math4.util FastMath floor

List of usage examples for org.apache.commons.math4.util FastMath floor

Introduction

In this page you can find the example usage for org.apache.commons.math4.util FastMath floor.

Prototype

public static double floor(double x) 

Source Link

Document

Get the largest whole number smaller than x.

Usage

From source file:com.ericbarnhill.arrayMath.ArrayMath.java

/**
  * In-place element-wise {@code floor} of a {@code double[]}. Returns reference to first passed array.
  */* www .ja  va 2s.c  om*/
  * @param f {@code double[]} array.
  * @return  {@code double[] array}
  * 
  * @since 0.1
  */
public static double[] floor(double[] f) {
    final int fi = f.length;
    for (int i = 0; i < fi; i++) {
        f[i] = FastMath.floor(f[i]);
    }
    return f;
}

From source file:com.ericbarnhill.arrayMath.ArrayMath.java

/**
  * Element-wise {@code floor} of a {@code double[]}. Returns deep copy.
  *//from  w ww.  j a va 2  s . com
  * @param f {@code double[]} array.
  * @return  {@code double[]} array.
  * 
  * @since 0.1
  */
public static double[] floorC(double[] f) {
    final int fi = f.length;
    double[] h = new double[fi];
    for (int i = 0; i < fi; i++) {
        h[i] = FastMath.floor(f[i]);
    }
    return h;
}