Tabnine Logo
MathLib.abs
Code IndexAdd Tabnine to your IDE (free)

How to use
abs
method
in
javolution.lang.MathLib

Best Java code snippets using javolution.lang.MathLib.abs (Showing top 20 results out of 315)

origin: org.jscience/jscience

/**
 * Compares the magnitude of this number with that number.
 *
 * @return <code>|this| > |that|</code>
 */
public boolean isLargerThan(Integer64 that) {
  return MathLib.abs(this._value) > MathLib.abs(that._value);
}
origin: org.jscience/jscience

/**
 * Returns the value by which the{@link #getEstimatedValue() estimated 
 * value} may differ from the true value (all stated in base units).
 *
 * @return the absolute error stated in base units.
 */
public double getAbsoluteError() {
  return MathLib.abs(_maximum - _minimum) * 0.5;
}
origin: org.jscience/jscience

/**
 * Compares the absolute value of this number with that number.
 * 
 * @param that the number to compare with.
 * @return <code>|this| > |that|</code>
 */
public boolean isLargerThan(Float64 that) {
  return MathLib.abs(this._value) > MathLib.abs(that._value);
}
origin: org.javolution/javolution-core-java

/**
 * Formats the specified <code>float</code> value.
 *
 * @param  f the <code>float</code> value.
 * @param  a the <code>Appendable</code> to append.
 * @return <code>TypeFormat.format(f, 10, (MathLib.abs(f) >= 1E7) || (MathLib.abs(f) < 0.001), false, a)</code>
 * @throws IOException if an I/O exception occurs.
 */
public static Appendable format(float f, Appendable a) throws IOException {
  return TypeFormat.format(f, 10,
      (MathLib.abs(f) >= 1E7) || (MathLib.abs(f) < 0.001), false, a);
}
origin: javolution/javolution

/**
 * Formats the specified <code>double</code> value (16 or 17 digits output).
 *
 * @param  d the <code>double</code> value.
 * @param  a the <code>Appendable</code> to append.
 * @return <code>TypeFormat.format(d, -1, (MathLib.abs(d) >= 1E7) || (MathLib.abs(d) < 0.001), false, a)</code>
 * @throws IOException if an I/O exception occurs.
 * @see    TextBuilder#append(double)
 */
public static Appendable format(double d, Appendable a) throws IOException {
  return TypeFormat.format(d, -1, (MathLib.abs(d) >= 1E7) || (MathLib.abs(d) < 0.001), false, a);
}
origin: javolution/javolution

/**
 * Appends the textual representation of the specified <code>float</code>.
 *
 * @param  f the <code>float</code> to format.
 * @return <code>append(f, 10, (abs(f) &gt;= 1E7) || (abs(f) &lt; 0.001), false)</code>
 */
public final TextBuilder append(float f) {
  return append(f, 10, (MathLib.abs(f) >= 1E7) || (MathLib.abs(f) < 0.001), false);
}
origin: javolution/javolution

/**
 * Formats the specified <code>float</code> value.
 *
 * @param  f the <code>float</code> value.
 * @param  a the <code>Appendable</code> to append.
 * @return <code>TypeFormat.format(f, 10, (MathLib.abs(f) >= 1E7) || (MathLib.abs(f) < 0.001), false, a)</code>
 * @throws IOException if an I/O exception occurs.
 */
public static Appendable format(float f, Appendable a) throws IOException {
  return TypeFormat.format(f, 10, (MathLib.abs(f) >= 1E7) || (MathLib.abs(f) < 0.001), false, a);
}
origin: org.javolution/javolution-core-java

/**
 * Appends the textual representation of the specified <code>float</code>.
 *
 * @param  f the <code>float</code> to format.
 * @return <code>append(f, 10, (abs(f) &gt;= 1E7) || (abs(f) &lt; 0.001), false)</code>
 */
public final TextBuilder append(float f) {
  return append(f, 10, (MathLib.abs(f) >= 1E7)
      || (MathLib.abs(f) < 0.001), false);
}
origin: javolution/javolution

/**
 * Appends the textual representation of the specified <code>double</code>;
 * the number of digits is 17 or 16 when the 16 digits representation 
 * can be parsed back to the same <code>double</code> (mimic the standard
 * library formatting).
 * 
 * @param  d the <code>double</code> to format.
 * @return <code>append(d, -1, (MathLib.abs(d) >= 1E7) ||
 *        (MathLib.abs(d) < 0.001), false)</code>
 */
public final TextBuilder append(double d) {
  return append(d, -1, (MathLib.abs(d) >= 1E7) ||
      (MathLib.abs(d) < 0.001), false);
}
origin: org.javolution/javolution-core-java

/**
 * Formats the specified <code>double</code> value (16 or 17 digits output).
 *
 * @param  d the <code>double</code> value.
 * @param  a the <code>Appendable</code> to append.
 * @return <code>TypeFormat.format(d, -1, (MathLib.abs(d) >= 1E7) || (MathLib.abs(d) < 0.001), false, a)</code>
 * @throws IOException if an I/O exception occurs.
 * @see    TextBuilder#append(double)
 */
public static Appendable format(double d, Appendable a) throws IOException {
  return TypeFormat.format(d, -1,
      (MathLib.abs(d) >= 1E7) || (MathLib.abs(d) < 0.001), false, a);
}
origin: org.javolution/javolution-core-java

/**
 * Appends the textual representation of the specified <code>double</code>;
 * the number of digits is 17 or 16 when the 16 digits representation 
 * can be parsed back to the same <code>double</code> (mimic the standard
 * library formatting).
 * 
 * @param  d the <code>double</code> to format.
 * @return <code>append(d, -1, (MathLib.abs(d) >= 1E7) ||
 *        (MathLib.abs(d) < 0.001), false)</code>
 */
public final TextBuilder append(double d) {
  return append(d, -1, (MathLib.abs(d) >= 1E7)
      || (MathLib.abs(d) < 0.001), false);
}
origin: org.jscience/jscience

/**
 * Returns the absolute value of this number.
 *
 * @return <code>|this|</code>.
 */
public Float64 abs() {
  Float64 r = FACTORY.object();
  r._value = MathLib.abs(this._value);
  return r;
}
origin: org.jscience/jscience

/**
 * Returns the absolute value of this number.
 *
 * @return <code>|this|</code>.
 */
public Integer64 abs() {
  Integer64 r = FACTORY.object();
  r._value = MathLib.abs(this._value);
  return r;
}
origin: org.javolution/javolution-core-java

/**
 * Returns the remainder of the division of the specified two arguments.
 *
 * @param x the dividend.
 * @param y the divisor.
 * @return <code>x - round(x / y) * y</code>
 **/
public static double rem(double x, double y) {
  double tmp = x / y;
  if (MathLib.abs(tmp) <= Long.MAX_VALUE)
    return x - MathLib.round(tmp) * y;
  else
    return NaN;
}
origin: javolution/javolution

/**
 * Returns the remainder of the division of the specified two arguments.
 *
 * @param x the dividend.
 * @param y the divisor.
 * @return <code>x - round(x / y) * y</code>
 **/
public static double rem(double x, double y) {
  double tmp = x / y;
  if (MathLib.abs(tmp) <= Long.MAX_VALUE)
    return x - MathLib.round(tmp) * y;
  else
    return NaN;
}
/**/
origin: org.apache.marmotta/marmotta-commons

/**
 * Returns the remainder of the division of the specified two arguments.
 *
 * @param x the dividend.
 * @param y the divisor.
 * @return <code>x - round(x / y) * y</code>
 **/
public static double rem(double x, double y) {
  double tmp = x / y;
  if (MathLib.abs(tmp) <= Long.MAX_VALUE)
    return x - MathLib.round(tmp) * y;
  else
    return NaN;
}
origin: apache/marmotta

/**
 * Returns the remainder of the division of the specified two arguments.
 *
 * @param x the dividend.
 * @param y the divisor.
 * @return <code>x - round(x / y) * y</code>
 **/
public static double rem(double x, double y) {
  double tmp = x / y;
  if (MathLib.abs(tmp) <= Long.MAX_VALUE)
    return x - MathLib.round(tmp) * y;
  else
    return NaN;
}
origin: org.jscience/jscience

/**
 * Indicates if two complexes are "sufficiently" alike to be considered
 * equal.
 *
 * @param  that the complex to compare with.
 * @param  tolerance the maximum magnitude of the difference between
 *         them before they are considered <i>not</i> equal.
 * @return <code>true</code> if they are considered equal;
 *         <code>false</code> otherwise.
 */
public boolean equals(Complex that, double tolerance) {
  return MathLib.abs(this.minus(that).magnitude()) <= tolerance;
}
origin: org.jscience/jscience

/** 
 * Returns the product of this large integer with the specified 
 * <code>long</code> multiplier.
 * 
 * @param multiplier the <code>long</code> multiplier.
 * @return <code>this · multiplier</code>.
 */
public LargeInteger times(long multiplier) {
  if ((this._size == 0) || (multiplier == 0))
    return LargeInteger.ZERO;
  if (multiplier == Long.MIN_VALUE)
    return times(LONG_MIN_VALUE); // Size 2.
  boolean isNegative = _isNegative ^ (multiplier < 0);
  multiplier = MathLib.abs(multiplier);
  LargeInteger li = ARRAY_FACTORY.array(_size + 1);
  li._size = Calculus.multiply(_words, _size, multiplier, li._words);
  li._isNegative = isNegative;
  return li;
}
origin: org.jscience/jscience

/**
 * Returns the real number (inexact except for <code>0.0</code>) 
 * corresponding to the specified <code>double</code> value. 
 * The error is derived from the inexact representation of 
 * <code>double</code> values intrinsic to the 64 bits IEEE 754 format.
 * 
 * @param doubleValue the <code>double</code> value to convert.
 * @return the corresponding real number.
 */
public static Real valueOf(double doubleValue) {
  if (doubleValue == 0.0)
    return Real.ZERO;
  if (Double.isNaN(doubleValue) || Double.isInfinite(doubleValue))
    return Real.NaN;
  // Find the exponent e such as: value == x.xxx * 10^e
  int e = MathLib.floorLog10(MathLib.abs(doubleValue)) - 18 + 1; // 18 digits significand.
  long significand = MathLib.toLongPow10(doubleValue, -e);
  int error = (int) MathLib.toLongPow10(Math.ulp(doubleValue), -e) + 1;
  return Real.valueOf(LargeInteger.valueOf(significand), error, e);
}
javolution.langMathLibabs

Javadoc

Returns the absolute value of the specified double argument.

Popular methods of MathLib

  • min
    Returns the smaller of two long values.
  • sqrt
    Returns the positive square root of the specified value.
  • bitLength
    Returns the number of bits in the minimal two's-complement representation of the specified long, exc
  • exp
    Returns #E raised to the specified power.
  • floor
    Returns the largest (closest to positive infinity)double value that is not greater than the argument
  • log
    Returns the natural logarithm (base #E) of the specified value.
  • max
    Returns the greater of two long values.
  • pow
    Returns the value of the first argument raised to the power of the second argument.
  • round
    Returns the closest int to the specified argument.
  • toDoublePow10
    Returns the closest double representation of the specified long number multiplied by a power of ten.
  • toDoublePow2
    Returns the closest double representation of the specified long number multiplied by a power of two.
  • toLongPow10
    Returns the closest long representation of the specified double number multiplied by a power of ten.
  • toDoublePow2,
  • toLongPow10,
  • _atan,
  • _ieee754_exp,
  • _ieee754_log,
  • asin,
  • atan,
  • digitLength,
  • floorLog10

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • onCreateOptionsMenu (Activity)
  • putExtra (Intent)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • JComboBox (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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