congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Math.ulp
Code IndexAdd Tabnine to your IDE (free)

How to use
ulp
method
in
java.lang.Math

Best Java code snippets using java.lang.Math.ulp (Showing top 20 results out of 738)

origin: h2oai/h2o-3

public static double find_maxEx(double maxIn, int isInt ) {
 double ulp = Math.ulp(maxIn);
 if( isInt > 0 && 1 > ulp ) ulp = 1;
 double res = maxIn+ulp;
 return Double.isInfinite(res) ? maxIn : res;
}
origin: h2oai/h2o-2

static public float find_maxEx(float maxIn, int isInt ) {
 float ulp = Math.ulp(maxIn);
 if( isInt > 0 && 1 > ulp ) ulp = 1;
 float res = maxIn+ulp;
 return Float.isInfinite(res) ? maxIn : res;
}
origin: robovm/robovm

/**
 * Returns the argument's ulp (unit in the last place). The size of a ulp of
 * a float value is the positive distance between this value and the float
 * value next larger in magnitude. For non-NaN {@code x},
 * {@code ulp(-x) == ulp(x)}.
 * <p>
 * Special cases:
 * <ul>
 * <li>{@code ulp(+0.0) = Float.MIN_VALUE}</li>
 * <li>{@code ulp(-0.0) = Float.MIN_VALUE}</li>
 * <li>{@code ulp(+infinity) = infinity}</li>
 * <li>{@code ulp(-infinity) = infinity}</li>
 * <li>{@code ulp(NaN) = NaN}</li>
 * </ul>
 *
 * @param f
 *            the floating-point value to compute ulp of.
 * @return the size of a ulp of the argument.
 */
public static float ulp(float f) {
  return Math.ulp(f);
}
origin: h2oai/h2o-2

public static boolean equalsWithinOneSmallUlp(double a, double b) {
 if (Double.isInfinite(a) || Double.isInfinite(b) && (a<b || b<a)) return false;
 double ulp_a = Math.ulp(a);
 double ulp_b = Math.ulp(b);
 double small_ulp = Math.min(ulp_a, ulp_b);
 double absdiff_a_b = Math.abs(a - b); // subtraction order does not matter, due to IEEE 754 spec
 return absdiff_a_b <= small_ulp;
}
origin: apache/incubator-druid

 @Override
 protected ExprEval eval(double param)
 {
  return ExprEval.of(Math.ulp(param));
 }
}
origin: h2oai/h2o-2

/**
 * Compare two numbers to see if they are within one ulp of the smaller decade.
 * Order of the arguments does not matter.
 *
 * @param a First number
 * @param b Second number
 * @return true if a and b are essentially equal, false otherwise.
 */
public static boolean equalsWithinOneSmallUlp(float a, float b) {
 if (Float.isInfinite(a) || Float.isInfinite(b) && (a<b || b<a)) return false;
 float ulp_a = Math.ulp(a);
 float ulp_b = Math.ulp(b);
 float small_ulp = Math.min(ulp_a, ulp_b);
 float absdiff_a_b = Math.abs(a - b); // subtraction order does not matter, due to IEEE 754 spec
 return absdiff_a_b <= small_ulp;
}
origin: HdrHistogram/HdrHistogram

/**
 * Get the highest value that is equivalent to the given value within the histogram's resolution.
 * Where "equivalent" means that value samples recorded for any two
 * equivalent values are counted in a common total count.
 *
 * @param value The given value
 * @return The highest value that is equivalent to the given value within the histogram's resolution.
 */
public double highestEquivalentValue(final double value) {
  double nextNonEquivalentValue = nextNonEquivalentValue(value);
  // Theoretically, nextNonEquivalentValue - ulp(nextNonEquivalentValue) == nextNonEquivalentValue
  // is possible (if the ulp size switches right at nextNonEquivalentValue), so drop by 2 ulps and
  // increment back up to closest within-ulp value.
  double highestEquivalentValue = nextNonEquivalentValue - (2 * Math.ulp(nextNonEquivalentValue));
  while (highestEquivalentValue + Math.ulp(highestEquivalentValue) < nextNonEquivalentValue) {
    highestEquivalentValue += Math.ulp(highestEquivalentValue);
  }
  return highestEquivalentValue;
}
origin: HdrHistogram/HdrHistogram

        Math.ceil((value + Math.ulp(value)) / currentHighestValueLimitInAutoRange) - 1.0);
shiftCoveredRangeToTheLeft(shiftAmount);
origin: google/guava

@GwtIncompatible // #trueLog2, Math.ulp
public void testLog2Accuracy() {
 for (double d : POSITIVE_FINITE_DOUBLE_CANDIDATES) {
  double dmLog2 = DoubleMath.log2(d);
  double trueLog2 = trueLog2(d);
  assertTrue(Math.abs(dmLog2 - trueLog2) <= Math.ulp(trueLog2));
 }
}
origin: google/guava

@GwtIncompatible // Math.ulp
public void testFactorial() {
 for (int i = 0; i <= DoubleMath.MAX_FACTORIAL; i++) {
  double actual = BigIntegerMath.factorial(i).doubleValue();
  double result = DoubleMath.factorial(i);
  assertEquals(actual, result, Math.ulp(actual));
 }
}
origin: MovingBlocks/Terasology

/**
 * Create a region with center point and x,y,z coordinate extents size
 * @param center the center point of region
 * @param extents the extents size of each side of region
 * @return a new region base on the center point and extents size
 */
public static Region3i createFromCenterExtents(BaseVector3f center, BaseVector3f extents) {
  Vector3f min = new Vector3f(center.x() - extents.x(), center.y() - extents.y(), center.z() - extents.z());
  Vector3f max = new Vector3f(center.x() + extents.x(), center.y() + extents.y(), center.z() + extents.z());
  max.x = max.x - Math.ulp(max.x);
  max.y = max.y - Math.ulp(max.y);
  max.z = max.z - Math.ulp(max.z);
  return createFromMinMax(new Vector3i(min), new Vector3i(max));
}
origin: org.apache.commons/commons-math3

boolean done = false;
while (!done) {
  done = b - a <= Math.ulp(c);
  pmc = 1;
  pc = c;
origin: OryxProject/oryx

threshold += Math.ulp(threshold);
origin: org.apache.commons/commons-math3

boolean done = false;
while (!done) {
  done = b - a <= Math.ulp(c);
  hmc = H0;
  hc = H1 * c;
origin: stackoverflow.com

 public class Test1  
{

  public static void main(String[] args) throws Exception 
  {
    long   long1 = Long.MAX_VALUE - 100L;
    double dbl1  = long1;
    long   long2 = long1+1;
    double dbl2  = dbl1+1;
    double dbl3  = dbl2+Math.ulp(dbl2);

    System.out.printf("%d %d\n%f %f %f", long1, long2, dbl1, dbl2, dbl3);
  }

}
origin: opentripplanner/OpenTripPlanner

if (Math.abs(triangleSafetyFactor+ triangleSlopeFactor + triangleTimeFactor - 1) > Math.ulp(1) * 3) {
  throw new ParameterException(Message.TRIANGLE_NOT_AFFINE);
origin: pholser/junit-quickcheck

@Test public void negativeMeanProbability() {
  thrown.expect(IllegalArgumentException.class);
  distro.probabilityOfMean(-ulp(0));
}
origin: pholser/junit-quickcheck

@Test public void negativeProbability() {
  thrown.expect(IllegalArgumentException.class);
  distro.sample(-ulp(0), random);
}
origin: pholser/junit-quickcheck

@Test public void greaterThanOneProbability() {
  thrown.expect(IllegalArgumentException.class);
  distro.sample(1 + ulp(1), random);
}
origin: locationtech/spatial4j

backRadius -= Math.max(Math.ulp(Math.abs(backY)+backRadius), Math.ulp(Math.abs(backX)+backRadius));
if (inverseCircle != null) {
 inverseCircle.reset(backX, backY, backRadius);
java.langMathulp

Javadoc

Returns the argument's ulp (unit in the last place). The size of a ulp of a double value is the positive distance between this value and the double value next larger in magnitude. For non-NaN x, ulp(-x) ==.

Special cases:

  • ulp(+0.0) = Double.MIN_VALUE
  • ulp(-0.0) = Double.MIN_VALUE
  • ulp(+infinity) = infinity
  • ulp(-infinity) = infinity
  • ulp(NaN) = NaN

Popular methods of Math

  • min
    Returns the smaller of two long values. That is, the result is the argument closer to the value of L
  • max
    Returns the greater of two long values. That is, the result is the argument closer to the value of L
  • abs
    Returns the absolute value of a long value. If the argument is not negative, the argument is returne
  • round
    Returns the closest int to the argument, with ties rounding up. Special cases: * If the argument is
  • pow
    Returns the value of the first argument raised to the power of the second argument. Special cases: *
  • sqrt
    Returns the correctly rounded positive square root of a double value. Special cases: * If the argume
  • ceil
    Returns the smallest (closest to negative infinity) double value that is greater than or equal to th
  • floor
    Returns the largest (closest to positive infinity) double value that is less than or equal to the ar
  • random
    Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returne
  • sin
    Returns the trigonometric sine of an angle. Special cases: * If the argument is NaN or an infinit
  • cos
    Returns the trigonometric cosine of an angle. Special cases: * If the argument is NaN or an infin
  • log
    Returns the natural logarithm (base e) of a doublevalue. Special cases: * If the argument is NaN
  • cos,
  • log,
  • exp,
  • toRadians,
  • atan2,
  • log10,
  • acos,
  • tan,
  • toDegrees,
  • atan

Popular in Java

  • Updating database using SQL prepared statement
  • getContentResolver (Context)
  • getSystemService (Context)
  • findViewById (Activity)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now