diff --git a/pom.xml b/pom.xml index a76485b..c96b223 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.mvohm.quadruple Quadruple - 1.0.0 + 1.1.0 Quadruple, 128-bit floating-point arithmetics https://github.com/m-vokhm/Quadruple 128-bit floating-point arithmetics diff --git a/src/main/java/com/mvohm/quadruple/Quadruple.java b/src/main/java/com/mvohm/quadruple/Quadruple.java index 6087afb..b431e7b 100644 --- a/src/main/java/com/mvohm/quadruple/Quadruple.java +++ b/src/main/java/com/mvohm/quadruple/Quadruple.java @@ -660,7 +660,6 @@ public Quadruple assign(long[] value) { return this; } // public Quadruple assign(long[] value) { - /** * Assigns the value of a IEEE-754 quadruple value passed in as an array * of two {@code long}s containing the 128 bits of the IEEE-754 quadruple to the given instance.
@@ -1746,6 +1745,15 @@ public Quadruple negate() { return this; } // public Quadruple negate() { + /** + * Returns a new instance of {@code Quadruple} with the value of the absolute value of this instance + * @return a new instance of {@code Quadruple} with the value of the absolute value of this instance + */ + public Quadruple abs() { + return new Quadruple(exponent, mantHi, mantLo); + } // public Quadruple abs() { + + /** * Returns 1 for positive values, -1 for negative values (including -0), and 0 for the positive zero value * @return 1 for positive values, -1 for negative values (including -0), and 0 for the positive zero value diff --git a/src/main/javadoc/com/mvohm/quadruple/Quadruple.html b/src/main/javadoc/com/mvohm/quadruple/Quadruple.html index b626294..9608853 100644 --- a/src/main/javadoc/com/mvohm/quadruple/Quadruple.html +++ b/src/main/javadoc/com/mvohm/quadruple/Quadruple.html @@ -2,9 +2,9 @@ - + Quadruple (Quadruple class documentation) - + @@ -18,7 +18,7 @@ catch(err) { } //--> -var methods = {"i0":10,"i1":10,"i2":10,"i3":9,"i4":9,"i5":9,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":9,"i25":9,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":9,"i34":9,"i35":9,"i36":10,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":9,"i51":9,"i52":9,"i53":9,"i54":9,"i55":10,"i56":10,"i57":10,"i58":9,"i59":9,"i60":9,"i61":9,"i62":10,"i63":9,"i64":9,"i65":9,"i66":9,"i67":9,"i68":9,"i69":10,"i70":10,"i71":9,"i72":10,"i73":10,"i74":10,"i75":9,"i76":9,"i77":9,"i78":9,"i79":10,"i80":10,"i81":10,"i82":10,"i83":10,"i84":9,"i85":10}; +var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":9,"i5":9,"i6":9,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":9,"i26":9,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":9,"i35":9,"i36":9,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":10,"i51":9,"i52":9,"i53":9,"i54":9,"i55":9,"i56":10,"i57":10,"i58":10,"i59":9,"i60":9,"i61":9,"i62":9,"i63":10,"i64":9,"i65":9,"i66":9,"i67":9,"i68":9,"i69":9,"i70":10,"i71":10,"i72":9,"i73":10,"i74":10,"i75":10,"i76":9,"i77":9,"i78":9,"i79":9,"i80":10,"i81":10,"i82":10,"i83":10,"i84":10,"i85":9,"i86":10}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; @@ -387,23 +387,29 @@

Method Summary

Quadruple +abs() +
Returns a new instance of Quadruple with the value of the absolute value of this instance
+ + + +Quadruple add(double summand)
Adds the value of the given double summand to the value of this Quadruple.
- + Quadruple add(long summand)
Adds the value of the given long summand to the value of this Quadruple.
- + Quadruple add(Quadruple summand)
Adds the value of the given Quadruple summand to the value of this Quadruple.
- + static Quadruple add(Quadruple op1, double op2) @@ -411,7 +417,7 @@

Method Summary

and creates a new instance of Quadruple containing the sum. - + static Quadruple add(Quadruple op1, long op2) @@ -419,7 +425,7 @@

Method Summary

and creates a new instance of Quadruple containing the sum. - + static Quadruple add(Quadruple op1, Quadruple op2) @@ -427,13 +433,13 @@

Method Summary

and creates a new instance of Quadruple containing the sum. - + Quadruple assign(BigDecimal value)
Converts the given value to Quadruple, and assigns it to the instance.
- + Quadruple assign(boolean negative, int exponent, @@ -442,13 +448,13 @@

Method Summary

Builds a Quadruple value from the given low-level parts and assigns it to the instance.
- + Quadruple assign(double value)
Converts the given value to quadruple and assigns it to the instance.
- + Quadruple assign(int exponent, long mantHi, @@ -456,26 +462,26 @@

Method Summary

Builds a non-negative Quadruple value from the given low-level parts and assigns it to the instance.
- + Quadruple assign(long value)
Converts the given value to quadruple and assigns it to the instance.
- + Quadruple assign(long[] value)
Builds a Quadruple from the low-level parts given as an array of long.
- + Quadruple assign(Quadruple qValue)
Assigns the given value to the instance (copies the values of the private fields of the parameter to the respective fields of this instance).
- + Quadruple assign(String source)
Parses the given String that is expected to contain @@ -483,53 +489,53 @@

Method Summary

of one of special values, and assigns the corresponding value to the instance.
- + Quadruple assignIeee754(byte[] value)
Assigns the value of a IEEE-754 quadruple value passed in as an array of 16 bytes containing the 128 bits of the IEEE-754 quadruple to the given instance.
- + Quadruple assignIeee754(long[] value)
Assigns the value of a IEEE-754 quadruple value passed in as an array of two longs containing the 128 bits of the IEEE-754 quadruple to the given instance.
- + Quadruple assignMax(Quadruple other)
Assigns to this instance the maximum of the values of this instance and the operand.
- + Quadruple assignMin(Quadruple other)
Assigns to this instance the minimum of the values of this instance and the operand.
- + Quadruple assignNaN()
Assigns the value of "Not a Number" (NaN) to this instance.
- + Quadruple assignNegativeInfinity()
Assigns the value of -Infinity to this instance.
- + Quadruple assignPositiveInfinity()
Assigns the value of +Infinity to this instance.
- + Quadruple assignWithUnbiasedExponent(boolean negative, int exponent, @@ -538,7 +544,7 @@

Method Summary

Builds a Quadruple value from the given low-level parts and assigns it to the instance.
- + Quadruple assignWithUnbiasedExponent(int exponent, long mantHi, @@ -546,71 +552,71 @@

Method Summary

Builds a non-negative Quadruple value from the given low-level parts and assigns it to the instance.
- + BigDecimal bigDecimalValue()
Builds and returns a BigDecimal instance holding the same value as the given Quadruple (rounded to 100 significant decimal digits).
- + static int compare(Quadruple q1, Quadruple q2)
Compares the values of two instances.
- + static int compareMagnitudes(Quadruple q1, Quadruple q2)
Compares the magnitudes (absolute values) of the two Quadruples.
- + int compareMagnitudeTo(Quadruple other)
Compares the magnitude (absolute value) of this instance with the magnitude of the other instance.
- + int compareTo(double other)
Compares the value of this instance with the specified double value.
- + int compareTo(long other)
Compares the value of this instance with the specified long value.
- + int compareTo(Quadruple other)
Compares the value of this instance with the value of the specified instance.
- + Quadruple divide(double divisor)
Divides the value of this Quadruple by the value of the given double divisor.
- + Quadruple divide(long divisor)
Divides the value of this Quadruple by the value of the given long divisor.
- + Quadruple divide(Quadruple divisor)
Divides the value of this Quadruple by the value of the given Quadruple divisor.
- + static Quadruple divide(Quadruple dividend, double divisor) @@ -618,7 +624,7 @@

Method Summary

creates and returns a new instance of Quadruple containing the quotient. - + static Quadruple divide(Quadruple dividend, long divisor) @@ -626,7 +632,7 @@

Method Summary

creates and returns a new instance of Quadruple containing the quotient. - + static Quadruple divide(Quadruple dividend, Quadruple divisor) @@ -634,98 +640,98 @@

Method Summary

creates and returns a new instance of Quadruple containing the quotient. - + double doubleValue()
Converts the value of this Quadruple to a double value in a way similar to standard narrowing conversions (e.g., from double to float).
- + boolean equals(Object obj)
Indicates whether the other Quadruple is equal to this one.
- + int exponent()
Returns the raw (biased) value of the binary exponent of the value i. e. 0x7FFF_FFFF for values falling within the interval of [1.0 .. 2.0), 0x8000_0000 for [2.0 .. 4.0) etc.
- + float floatValue()
Converts the value of this Quadruple to a float value in a way similar to standard narrowing conversions (e.g., from double to float).
- + String format(String format)
Returns a String representing the value of this instance in a form defined by the format parameter.
- + int hashCode()
Computes a hashcode for this Quadruple, based on the values of its fields.
- + int intValue()
Converts the value of this Quadruple to an int value in a way similar to standard narrowing conversions (e.g., from double to int).
- + boolean isInfinite()
Checks if the value is infinite (i.e NEGATIVE_INFINITY or POSITIVE_INFINITY).
- + boolean isNaN()
Checks if the value is not a number (i.e. has the value of NaN).
- + boolean isNegative()
Checks if the value is negative.
- + boolean isZero()
Checks if the value is zero, either positive or negative.
- + long longValue()
Converts the value of this Quadruple to a long value in a way similar to standard narrowing conversions (e.g., from double to long).
- + long mantHi()
Returns the most significant 64 bits of the fractional part of the mantissa.
- + long mantLo()
Returns the least significant 64 bits of the fractional part of the mantissa
- + static Quadruple max(Quadruple q1, Quadruple q2) @@ -733,14 +739,14 @@

Method Summary

maximum of the values of the operands. - + static Quadruple maxValue()
Returns a new Quadruple instance with the value of MAX_VALUE
(2^2147483647 * (2 - 2^-128) = 1.76161305168396335320749314979184028566452310e+646456993)
- + static Quadruple min(Quadruple q1, Quadruple q2) @@ -748,39 +754,39 @@

Method Summary

minimum of the values of the operands. - + static Quadruple minNormal()
Returns a new Quadruple instance with the value of MIN_NORMAL
(2^-2147483646 = 2.27064621040149253752656726517958758124747730e-646456993)
- + static Quadruple minValue()
Returns a new Quadruple instance with the value of MIN_VALUE
(2^-2147483774 = 6.67282948260747430814835377499134611597699952e-646457032)
- + Quadruple multiply(double factor)
Multiplies the value of this Quadruple by the value of the given double factor.
- + Quadruple multiply(long factor)
Multiplies the value of this Quadruple by the value of the given long factor.
- + Quadruple multiply(Quadruple factor)
Multiplies the value of this Quadruple by the value of the given Quadruple factor.
- + static Quadruple multiply(Quadruple factor1, double factor2) @@ -788,7 +794,7 @@

Method Summary

creates and returns a new instance of Quadruple containing the product. - + static Quadruple multiply(Quadruple factor1, long factor2) @@ -796,7 +802,7 @@

Method Summary

creates and returns a new instance of Quadruple containing the product. - + static Quadruple multiply(Quadruple factor1, Quadruple factor2) @@ -804,96 +810,96 @@

Method Summary

creates and returns a new instance of Quadruple containing the product. - + static Quadruple nan()
Returns a new Quadruple instance with the value of NaN.
- + Quadruple negate()
Changes the sign of this Quadruple.
- + static Quadruple negativeInfinity()
Returns a new Quadruple instance with the value of -Infinity.
- + static Quadruple nextRandom()
Creates a new Quadruple instance with a pseudo-random value using a static randomly initialized java.util.Random instance.
- + static Quadruple nextRandom(Random rand)
Creates a new Quadruple instance with a pseudo-random value using the given java.util.Random instance.
- + static Quadruple one()
Returns a new Quadruple instance with the value of 1.0.
- + static Quadruple pi()
Returns a new Quadruple instance with the value of the number π (pi) (3.141592653589793238462643383279502884195)
- + static Quadruple positiveInfinity()
Returns a new Quadruple instance with the value of +Infinity.
- + int signum()
Returns 1 for positive values, -1 for negative values (including -0), and 0 for the positive zero value
- + Quadruple sqrt()
Computes a square root of the value of this Quadruple and replaces the old value of this instance with the newly-computed value.
- + static Quadruple sqrt(Quadruple square)
Computes a square root of the value of the given Quadruple, creates and returns a new instance of Quadruple containing the value of the square root.
- + Quadruple subtract(double subtrahend)
Subtracts the value of the given double subtrahend from the value of this Quadruple.
- + Quadruple subtract(long subtrahend)
Subtracts the value of the given long subtrahend from the value of this Quadruple.
- + Quadruple subtract(Quadruple subtrahend)
Subtracts the value of the given Quadruple subtrahend from the value of this Quadruple.
- + static Quadruple subtract(Quadruple minuend, double subtrahend) @@ -901,7 +907,7 @@

Method Summary

creates and returns a new instance of Quadruple that contains the difference. - + static Quadruple subtract(Quadruple minuend, long subtrahend) @@ -909,7 +915,7 @@

Method Summary

creates and returns a new instance of Quadruple that contains the difference. - + static Quadruple subtract(Quadruple minuend, Quadruple subtrahend) @@ -917,13 +923,13 @@

Method Summary

creates and returns a new instance of Quadruple that contains the difference. - + static Quadruple ten()
Returns a new Quadruple instance with the value of 10.0.
- + String toHexString()
Returns a String containing a hexadecimal representation @@ -931,7 +937,7 @@

Method Summary

exponent preceded by letter 'e', with '_' separating the tetrads of hexadecimal digits.
- + byte[] toIeee754Bytes()
Returns the 128 bits of an IEEE-754 quadruple precision number nearest to the value @@ -939,7 +945,7 @@

Method Summary

of the standard IEEE-754 quadruple-precision floating-point number.
- + long[] toIeee754Longs()
Returns the 128 bits of an IEEE-754 quadruple precision number nearest to the value @@ -947,27 +953,27 @@

Method Summary

of the standard IEEE-754 quadruple-precision floating-point number.
- + long[] toLongWords()
Returns the fields of the instance that make up it's value as an array of longs.
- + String toString()
Returns a decimal string representation of the value of this Quadruple in a scientific (exponential) notation, rounded to 43 digits after point.
- + static Quadruple two()
Returns a new Quadruple instance with the value of 2.0.
- + int unbiasedExponent()
Returns the unbiased value of binary exponent, @@ -2916,6 +2922,20 @@

negate

+ + + +
    +
  • +

    abs

    +
    public Quadruple abs()
    +
    Returns a new instance of Quadruple with the value of the absolute value of this instance
    +
    +
    Returns:
    +
    a new instance of Quadruple with the value of the absolute value of this instance
    +
    +
  • +
diff --git a/src/main/javadoc/index-all.html b/src/main/javadoc/index-all.html index a6bb761..04b6a36 100644 --- a/src/main/javadoc/index-all.html +++ b/src/main/javadoc/index-all.html @@ -2,9 +2,9 @@ - + Index (Quadruple class documentation) - + @@ -72,6 +72,14 @@

A

+
abs() - Method in class com.mvohm.quadruple.Quadruple
+
+
Returns a new instance of Quadruple with the value of the absolute value of this instance
+
+
abs() - Method in class com.mvohm.quadruple.Quadruple
+
+
Returns a new instance of Quadruple with the value of the absolute value of this instance
+
add(Quadruple) - Method in class com.mvohm.quadruple.Quadruple
Adds the value of the given Quadruple summand to the value of this Quadruple.