Package com.upokecenter.numbers
Class EDecimals
- java.lang.Object
-
- com.upokecenter.numbers.EDecimals
-
public final class EDecimals extends java.lang.ObjectA class that implements additional operations on arbitrary-precision decimal numbers. Many of them are listed as miscellaneous operations in the General Decimal Arithmetic Specification version 1.70.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EDecimalAnd(EDecimal ed1, EDecimal ed2, EContext ec)Performs a logical AND operation on two decimal numbers in the form of logical operands .static EDecimalBooleanToEDecimal(boolean b, EContext ec)Converts a boolean value (either true or false) to an arbitrary-precision decimal number.static EDecimalCanonical(EDecimal ed)Returns a canonical version of the given arbitrary-precision number object.static intCompareTotal(EDecimal ed, EDecimal other, EContext ec)Compares the values of one arbitrary-precision number object and another object, imposing a total ordering on all possible values.static intCompareTotalMagnitude(EDecimal ed, EDecimal other, EContext ec)Compares the absolute values of two arbitrary-precision number objects, imposing a total ordering on all possible values (ignoring their signs).static EDecimalCopy(EDecimal ed)Creates a copy of the given arbitrary-precision number object.static EDecimalCopyAbs(EDecimal ed)Returns an arbitrary-precision number object with the same value as the given number object but with a nonnegative sign (that is, the given number object's absolute value).static EDecimalCopyNegate(EDecimal ed)Returns an arbitrary-precision number object with the sign reversed from the given number object.static EDecimalCopySign(EDecimal ed, EDecimal other)Returns an arbitrary-precision number object with the same value as the first given number object but with a the same sign (positive or negative) as the second given number object.static EDecimalInt32ToEDecimal(int i32, EContext ec)Creates an arbitrary-precision decimal number from a 32-bit signed integer.static EDecimalInvert(EDecimal ed1, EContext ec)Performs a logical NOT operation on an arbitrary-precision decimal number in the form of a logical operand .static booleanIsCanonical(EDecimal ed)Returns whether the given arbitrary-precision number object is in a canonical form.static booleanIsFinite(EDecimal ed)Returns whether the given arbitrary-precision number object is neither null nor infinity nor not-a-number (NaN).static booleanIsInfinite(EDecimal ed)Returns whether the given arbitrary-precision number object is positive or negative infinity.static booleanIsNaN(EDecimal ed)Returns whether the given arbitrary-precision number object is a not-a-number (NaN).static booleanIsNormal(EDecimal ed, EContext ec)Returns whether the given number is a normal number.static booleanIsQuietNaN(EDecimal ed)Returns whether the given arbitrary-precision number object is a quiet not-a-number (NaN).static booleanIsSignalingNaN(EDecimal ed)Returns whether the given arbitrary-precision number object is a signaling not-a-number (NaN).static booleanIsSigned(EDecimal ed)Returns whether the given arbitrary-precision number object is negative (including negative infinity, negative not-a-number [NaN], or negative zero).static booleanIsSubnormal(EDecimal ed, EContext ec)Returns whether the given number is a subnormal number.static booleanIsZero(EDecimal ed)Returns whether the given arbitrary-precision number object is zero (positive zero or negative zero).static EDecimalLogB(EDecimal ed, EContext ec)Returns the base-10 exponent of an arbitrary-precision decimal number (when that number is expressed in scientific notation with one digit before the radix point).static intNumberClass(EDecimal ed, EContext ec)Finds the number class for an arbitrary-precision decimal number object.static java.lang.StringNumberClassString(int nc)Converts a number class identifier (ranging from 1 to 9) to a text string.static EDecimalOr(EDecimal ed1, EDecimal ed2, EContext ec)Performs a logical OR operation on two decimal numbers in the form of logical operands .static EDecimalRadix(EContext ec)Returns the number 10, the decimal radix.static EDecimalRescale(EDecimal ed, EDecimal scale, EContext ec)Returns an arbitrary-precision decimal number with the same value as this object but with the given exponent, expressed as an arbitrary-precision decimal number.static EDecimalRotate(EDecimal ed, EDecimal ed2, EContext ec)Rotates the digits of an arbitrary-precision decimal number's mantissa.static booleanSameQuantum(EDecimal ed1, EDecimal ed2)Returns whether two arbitrary-precision numbers have the same exponent, they both are not-a-number (NaN), or they both are infinity (positive and/or negative).static EDecimalScaleB(EDecimal ed, EDecimal ed2, EContext ec)Finds an arbitrary-precision decimal number whose decimal point is moved a given number of places.static EDecimalShift(EDecimal ed, EDecimal ed2, EContext ec)Shifts the digits of an arbitrary-precision decimal number's mantissa.static EDecimalTrim(EDecimal ed1, EContext ec)Returns an arbitrary-precision number with the same value as this one but with certain trailing zeros removed from its mantissa.static EDecimalXor(EDecimal ed1, EDecimal ed2, EContext ec)Performs a logical exclusive-OR (XOR) operation on two decimal numbers in the form of logical operands .
-
-
-
Method Detail
-
Radix
public static EDecimal Radix(EContext ec)
Returns the number 10, the decimal radix.- Parameters:
ec- Specifies an arithmetic context for rounding the number 10. Can be null.- Returns:
- The number 10, or the closest representable number to 10 in the arithmetic context.
-
Int32ToEDecimal
public static EDecimal Int32ToEDecimal(int i32, EContext ec)
Creates an arbitrary-precision decimal number from a 32-bit signed integer.- Parameters:
i32- The parameteri32is a 32-bit signed integer.ec- An arithmetic context to control the precision, rounding, and exponent range of the result. Can be null.- Returns:
- An arbitrary-precision decimal number with the closest representable value to the given integer.
-
BooleanToEDecimal
public static EDecimal BooleanToEDecimal(boolean b, EContext ec)
Converts a boolean value (either true or false) to an arbitrary-precision decimal number.- Parameters:
b- Either true or false.ec- A context used for rounding the result. Can be null.- Returns:
- Either 1 if
bis true, or 0 ifbis false.. The result will be rounded as specified by the given context, if any.
-
IsCanonical
public static boolean IsCanonical(EDecimal ed)
Returns whether the given arbitrary-precision number object is in a canonical form. For the current version of EDecimal, all EDecimal objects are in a canonical form.- Parameters:
ed- An arbitrary-precision number object.- Returns:
- Always
true.
-
IsFinite
public static boolean IsFinite(EDecimal ed)
Returns whether the given arbitrary-precision number object is neither null nor infinity nor not-a-number (NaN).- Parameters:
ed- An arbitrary-precision number object.- Returns:
- Either
trueif the given arbitrary-precision number object is neither null nor infinity nor not-a-number (NaN), orfalseotherwise.
-
IsInfinite
public static boolean IsInfinite(EDecimal ed)
Returns whether the given arbitrary-precision number object is positive or negative infinity.- Parameters:
ed- An arbitrary-precision number object.- Returns:
- Either
trueif the given arbitrary-precision number object is positive or negative infinity, orfalseotherwise.
-
IsNaN
public static boolean IsNaN(EDecimal ed)
Returns whether the given arbitrary-precision number object is a not-a-number (NaN).- Parameters:
ed- An arbitrary-precision number object.- Returns:
- Either
trueorfalse.
-
IsNormal
public static boolean IsNormal(EDecimal ed, EContext ec)
Returns whether the given number is a normal number. A subnormal number is a nonzero finite number whose Exponent property (or the number's exponent when that number is expressed in scientific notation with one digit before the radix point) is less than the minimum possible exponent for that number. A normal number is nonzero and finite, but not subnormal.- Parameters:
ed- An arbitrary-precision number object.ec- A context specifying the exponent range of arbitrary-precision numbers. Can be null. If AdjustExponent of the given context istrue, a nonzero number is normal if the number's exponent (when that number is expressed in scientific notation with one nonzero digit before the radix point) is at least the given context's EMax property (e.g., if EMax is -100, 2.3456 * 10 -99 is normal, but 2.3456 * 10 -102 is not). If AdjustExponent of the given context isfalse, a nonzero number is subnormal if the number's Exponent property is at least given context's EMax property (e.g., if EMax is -100, 23456 * 10 -99 is normal, but 23456 * 10 -102 is not).- Returns:
- Either
trueif the given number is subnormal, orfalseotherwise. Returnstrueif the given context is null or HasExponentRange of the given context isfalse.
-
IsQuietNaN
public static boolean IsQuietNaN(EDecimal ed)
Returns whether the given arbitrary-precision number object is a quiet not-a-number (NaN).- Parameters:
ed- An arbitrary-precision number object.- Returns:
- Either
trueorfalse.
-
IsSigned
public static boolean IsSigned(EDecimal ed)
Returns whether the given arbitrary-precision number object is negative (including negative infinity, negative not-a-number [NaN], or negative zero).- Parameters:
ed- An arbitrary-precision number object.- Returns:
- Either
trueorfalse.
-
IsSignalingNaN
public static boolean IsSignalingNaN(EDecimal ed)
Returns whether the given arbitrary-precision number object is a signaling not-a-number (NaN).- Parameters:
ed- An arbitrary-precision number object.- Returns:
- Either
trueorfalse.
-
NumberClassString
public static java.lang.String NumberClassString(int nc)
Converts a number class identifier (ranging from 1 to 9) to a text string. An arbitrary-precision number object can belong in one of ten number classes.- Parameters:
nc- An integer identifying a number class.- Returns:
- A text string identifying the given number class as follows: 0 = "+Normal"; 1 = "-Normal", 2 = "+Subnormal", 3 = "-Subnormal", 4 = "+Zero", 5 = "-Zero", 6 = "+Infinity", 7 = "-Infinity", 8 = "NaN", 9 = "sNaN".
- Throws:
java.lang.IllegalArgumentException- The parameterncis less than 0 or greater than 9 .
-
NumberClass
public static int NumberClass(EDecimal ed, EContext ec)
Finds the number class for an arbitrary-precision decimal number object.- Parameters:
ed- An arbitrary-precision decimal number object.ec- A context object that specifies the precision and exponent range of arbitrary-precision numbers. This is used only to distinguish between normal and subnormal numbers. Can be null.- Returns:
- A 32-bit signed integer identifying the given number object, number class as follows: 0 = positive normal; 1 = negative normal, 2 = positive subnormal, 3 = negative subnormal, 4 = positive zero, 5 = negative zero, 6 = positive infinity, 7 = negative infinity, 8 = quiet not-a-number (NaN), 9 = signaling NaN.
- Throws:
java.lang.NullPointerException- The parameteredis null.
-
IsSubnormal
public static boolean IsSubnormal(EDecimal ed, EContext ec)
Returns whether the given number is a subnormal number. A subnormal number is a nonzero finite number whose Exponent property (or the number's exponent when that number is expressed in scientific notation with one digit before the radix point) is less than the minimum possible exponent for that number.- Parameters:
ed- An arbitrary-precision number object.ec- A context specifying the exponent range of arbitrary-precision numbers. Can be null. If AdjustExponent of the given context istrue, a nonzero number is subnormal if the number's exponent (when that number is expressed in scientific notation with one nonzero digit before the radix point) is less than the given context's EMax property (e.g., if EMax is -100, 2.3456 * 10 -102 is subnormal, but 2.3456 * 10 -99 is not). If AdjustExponent of the given context isfalse, a nonzero number is subnormal if the number's Exponent property is less than the given context's EMax property (e.g., if EMax is -100, 23456 * 10 -102 is subnormal, but 23456 * 10 -99 is not).- Returns:
- Either
trueif the given number is subnormal, orfalseotherwise. Returnsfalseif the given context is null or HasExponentRange of the given context isfalse.
-
IsZero
public static boolean IsZero(EDecimal ed)
Returns whether the given arbitrary-precision number object is zero (positive zero or negative zero).- Parameters:
ed- An arbitrary-precision number object.- Returns:
trueif the given number has a value of zero (positive zero or negative zero); otherwise,false.
-
LogB
public static EDecimal LogB(EDecimal ed, EContext ec)
Returns the base-10 exponent of an arbitrary-precision decimal number (when that number is expressed in scientific notation with one digit before the radix point). For example, returns 3 for the numbers6.66E + 3and666E + 1.- Parameters:
ed- An arbitrary-precision decimal number.ec- An arithmetic context to control the precision, rounding, and exponent range of the result. Can be null.- Returns:
- The base-10 exponent of the given number (when that number is
expressed in scientific notation with one nonzero digit before the
radix point). Signals DivideByZero and returns negative infinity if
edis zero. Returns positive infinity ifedis positive infinity or negative infinity. - Throws:
java.lang.NullPointerException- The parameteredis null.
-
ScaleB
public static EDecimal ScaleB(EDecimal ed, EDecimal ed2, EContext ec)
Finds an arbitrary-precision decimal number whose decimal point is moved a given number of places.- Parameters:
ed- An arbitrary-precision decimal number.ed2- The number of decimal places to move the decimal point of "ed". This must be an integer with an exponent of 0.ec- An arithmetic context to control the precision, rounding, and exponent range of the result. Can be null.- Returns:
- The given arbitrary-precision decimal number whose decimal point is
moved the given number of places. Signals an invalid operation and
returns not-a-number (NaN) if
ed2is infinity or NaN, has an Exponent property other than 0. Signals an invalid operation and returns not-a-number (NaN) ifecdefines a limited precision and exponent range and ifed2's absolute value is greater than twice the sum of the context's EMax property and its Precision property. - Throws:
java.lang.NullPointerException- The parameteredored2is null.
-
Shift
public static EDecimal Shift(EDecimal ed, EDecimal ed2, EContext ec)
Shifts the digits of an arbitrary-precision decimal number's mantissa.- Parameters:
ed- An arbitrary-precision number containing the mantissa to shift.ed2- An arbitrary-precision number indicating the number of digits to shift the first operand's mantissa. Must be an integer with an exponent of 0. If this parameter is positive, the mantissa is shifted to the left by the given number of digits . If this parameter is negative, the mantissa is shifted to the right by the given number of digits.ec- An arithmetic context to control the precision of arbitrary-precision numbers. Can be null.- Returns:
- An arbitrary-precision decimal number whose mantissa is shifted the
given number of digits. Signals an invalid operation and returns NaN
(not-a-number) if
ed2is a signaling NaN or ifed2is not an integer, is negative, has an exponent other than 0, or has an absolute value that exceeds the maximum precision specified in the context. - Throws:
java.lang.NullPointerException- The parameteredored2is null.
-
Rotate
public static EDecimal Rotate(EDecimal ed, EDecimal ed2, EContext ec)
Rotates the digits of an arbitrary-precision decimal number's mantissa.- Parameters:
ed- An arbitrary-precision number containing the mantissa to rotate. If this mantissa contains more digits than the precision, the most-significant digits are chopped off the mantissa before the rotation begins.ed2- An arbitrary-precision number indicating the number of digits to rotate the first operand's mantissa. Must be an integer with an exponent of 0. If this parameter is positive, the mantissa is shifted to the left by the given number of digits and the most-significant digits shifted out of the mantissa become the least-significant digits instead. If this parameter is negative, the mantissa is shifted to the right by the given number of digits and the least-significant digits shifted out of the mantissa become the most-significant digits instead.ec- An arithmetic context to control the precision of arbitrary-precision numbers. If this parameter is null or specifies an unlimited precision, this method has the same behavior asShift.- Returns:
- An arbitrary-precision decimal number whose mantissa is rotated the
given number of digits. Signals an invalid operation and returns NaN
(not-a-number) if
ed2is a signaling NaN or ifed2is not an integer, is negative, has an exponent other than 0, or has an absolute value that exceeds the maximum precision specified in the context.
-
CompareTotal
public static int CompareTotal(EDecimal ed, EDecimal other, EContext ec)
Compares the values of one arbitrary-precision number object and another object, imposing a total ordering on all possible values. In this method:- For objects with the same value, the one with the higher exponent has a greater "absolute value".
- Negative zero is less than positive zero.
- Quiet NaN has a higher "absolute value" than signaling NaN. If both objects are quiet NaN or both are signaling NaN, the one with the higher diagnostic information has a greater "absolute value".
- NaN has a higher "absolute value" than infinity.
- Infinity has a higher "absolute value" than any finite number.
- Negative numbers are less than positive numbers.
- Parameters:
ed- The first arbitrary-precision number to compare.other- The second arbitrary-precision number to compare.ec- An arithmetic context. Flags will be set in this context only ifHasFlagsandIsSimplifiedof the context are true and only if an operand needed to be rounded before carrying out the operation. Can be null.- Returns:
- The number 0 if both objects have the same value, or -1 if the first object is less than the other value, or 1 if the first object is greater. Does not signal flags if either value is signaling NaN.
-
CompareTotalMagnitude
public static int CompareTotalMagnitude(EDecimal ed, EDecimal other, EContext ec)
Compares the absolute values of two arbitrary-precision number objects, imposing a total ordering on all possible values (ignoring their signs). In this method:- For objects with the same value, the one with the higher exponent has a greater "absolute value".
- Negative zero and positive zero are considered equal.
- Quiet NaN has a higher "absolute value" than signaling NaN. If both objects are quiet NaN or both are signaling NaN, the one with the higher diagnostic information has a greater "absolute value".
- NaN has a higher "absolute value" than infinity.
- Infinity has a higher "absolute value" than any finite number.
- Parameters:
ed- The first arbitrary-precision number to compare.other- The second arbitrary-precision number to compare.ec- An arithmetic context. Flags will be set in this context only ifHasFlagsandIsSimplifiedof the context are true and only if an operand needed to be rounded before carrying out the operation. Can be null.- Returns:
- The number 0 if both objects have the same value (ignoring their signs), or -1 if the first object is less than the other value (ignoring their signs), or 1 if the first object is greater (ignoring their signs). Does not signal flags if either value is signaling NaN.
-
Copy
public static EDecimal Copy(EDecimal ed)
Creates a copy of the given arbitrary-precision number object.- Parameters:
ed- An arbitrary-precision number object to copy.- Returns:
- A copy of the given arbitrary-precision number object.
-
Canonical
public static EDecimal Canonical(EDecimal ed)
Returns a canonical version of the given arbitrary-precision number object. In this method, this method behaves like the Copy method.- Parameters:
ed- An arbitrary-precision number object.- Returns:
- A copy of the parameter
ed.
-
CopyAbs
public static EDecimal CopyAbs(EDecimal ed)
Returns an arbitrary-precision number object with the same value as the given number object but with a nonnegative sign (that is, the given number object's absolute value).- Parameters:
ed- An arbitrary-precision number object.- Returns:
- An arbitrary-precision number object with the same value as the given number object but with a nonnegative sign.
-
CopyNegate
public static EDecimal CopyNegate(EDecimal ed)
Returns an arbitrary-precision number object with the sign reversed from the given number object.- Parameters:
ed- An arbitrary-precision number object.- Returns:
- An arbitrary-precision number object with the sign reversed from the given number object.
-
CopySign
public static EDecimal CopySign(EDecimal ed, EDecimal other)
Returns an arbitrary-precision number object with the same value as the first given number object but with a the same sign (positive or negative) as the second given number object.- Parameters:
ed- An arbitrary-precision number object with the value the result will have.other- The parameterotheris an EDecimal object.- Returns:
- An arbitrary-precision number object with the same value as the first given number object but with a the same sign (positive or negative) as the second given number object.
-
SameQuantum
public static boolean SameQuantum(EDecimal ed1, EDecimal ed2)
Returns whether two arbitrary-precision numbers have the same exponent, they both are not-a-number (NaN), or they both are infinity (positive and/or negative).- Parameters:
ed1- The first arbitrary-precision number.ed2- The second arbitrary-precision number.- Returns:
- Either
trueif the given arbitrary-precision numbers have the same exponent, they both are not-a-number (NaN), or they both are infinity (positive and/or negative); otherwise,false.
-
Trim
public static EDecimal Trim(EDecimal ed1, EContext ec)
Returns an arbitrary-precision number with the same value as this one but with certain trailing zeros removed from its mantissa. If the number's exponent is 0, it is returned unchanged (but may be rounded depending on the arithmetic context); if that exponent is greater 0, its trailing zeros are removed from the mantissa (then rounded if necessary); if that exponent is less than 0, its trailing zeros are removed from the mantissa until the exponent reaches 0 (then the number is rounded if necessary).- Parameters:
ed1- An arbitrary-precision number.ec- An arithmetic context to control the precision, rounding, and exponent range of the result. Can be null.- Returns:
- An arbitrary-precision number with the same value as this one but
with certain trailing zeros removed from its mantissa. If
ed1is not-a-number (NaN) or infinity, it is generally returned unchanged.
-
Rescale
public static EDecimal Rescale(EDecimal ed, EDecimal scale, EContext ec)
Returns an arbitrary-precision decimal number with the same value as this object but with the given exponent, expressed as an arbitrary-precision decimal number.Note that this is not always the same as rounding to a given number of decimal places, since it can fail if the difference between this value's exponent and the desired exponent is too big, depending on the maximum precision. If rounding to a number of decimal places is desired, it's better to use the RoundToExponent and RoundToIntegral methods instead.
Remark: This method can be used to implement fixed-point decimal arithmetic, in which a fixed number of digits come after the decimal point. A fixed-point decimal arithmetic in which no digits come after the decimal point (a desired exponent of 0) is considered an "integer arithmetic" .
- Parameters:
ed- An arbitrary-precision decimal number whose exponent is to be changed.scale- The desired exponent of the result, expressed as an arbitrary-precision decimal number. The exponent is the number of fractional digits in the result, expressed as a negative number. Can also be positive, which eliminates lower-order places from the number. For example, -3 means round to the thousandth (10^-3, 0.0001), and 3 means round to the thousands-place (10^3, 1000). A value of 0 rounds the number to an integer.ec- The parameterecis an EContext object.- Returns:
- An arbitrary-precision decimal number with the same value as this object but with the exponent changed. Signals FlagInvalid and returns not-a-number (NaN) if the result can't fit the given precision without rounding, or if the arithmetic context defines an exponent range and the given exponent is outside that range.
-
And
public static EDecimal And(EDecimal ed1, EDecimal ed2, EContext ec)
Performs a logical AND operation on two decimal numbers in the form of logical operands . Alogical operandis a non-negative base-10 number with an Exponent property of 0 and no other base-10 digits than 0 or 1 (examples include01001and111001, but not02001or99999). The logical AND operation sets each digit of the result to 1 if the corresponding digits of each logical operand are both 1, and to 0 otherwise. For example,01001 AND 111010 = 01000.- Parameters:
ed1- The first logical operand to the logical AND operation.ed2- The second logical operand to the logical AND operation.ec- An arithmetic context to control the maximum precision of arbitrary-precision numbers. If a logical operand passed to this method has more digits than the maximum precision specified in this context, the operand's most significant digits that exceed that precision are discarded. This parameter can be null.- Returns:
- The result of the logical AND operation as a logical operand.
Signals an invalid operation and returns not-a-number (NaN) if
ed1,ed2, or both are not logical operands.
-
Invert
public static EDecimal Invert(EDecimal ed1, EContext ec)
Performs a logical NOT operation on an arbitrary-precision decimal number in the form of a logical operand . Alogical operandis a non-negative base-10 number with an Exponent property of 0 and no other base-10 digits than 0 or 1 (examples include01001and111001, but not02001or99999). The logical NOT operation sets each digit of the result to 1 if the corresponding digit is 0, and to 0 otherwise; it can set no more digits than the maximum precision, however. For example, if the maximum precision is 8 digits, thenNOT 111010 = 11000101.- Parameters:
ed1- The logical operand to the logical NOT operation.ec- An arithmetic context to control the maximum precision of arbitrary-precision numbers. If a logical operand passed to this method has more digits than the maximum precision specified in this context, the operand's most significant digits that exceed that precision are discarded. This parameter cannot be null and must specify a maximum precision (unlimited precision contexts are not allowed).- Returns:
- The result of the logical NOT operation as a logical operand.
Signals an invalid operation and returns not-a-number (NaN) if
ed1is not a logical operand.
-
Xor
public static EDecimal Xor(EDecimal ed1, EDecimal ed2, EContext ec)
Performs a logical exclusive-OR (XOR) operation on two decimal numbers in the form of logical operands . Alogical operandis a non-negative base-10 number with an exponent of 0 and no other base-10 digits than 0 or 1 (examples include01001and111001, but not02001or99999). The logical exclusive-OR operation sets each digit of the result to 1 if either corresponding digit of the logical operands, but not both, is 1, and to 0 otherwise. For example,01001 XOR 111010 = 101010.- Parameters:
ed1- The first logical operand to the logical exclusive-OR operation.ed2- The second logical operand to the logical exclusive-OR operation.ec- An arithmetic context to control the maximum precision of arbitrary-precision numbers. If a logical operand passed to this method has more digits than the maximum precision specified in this context, the operand's most significant digits that exceed that precision are discarded. This parameter can be null.- Returns:
- An EDecimal object.
-
Or
public static EDecimal Or(EDecimal ed1, EDecimal ed2, EContext ec)
Performs a logical OR operation on two decimal numbers in the form of logical operands . Alogical operandis a non-negative base-10 number with an Exponent property of 0 and no other base-10 digits than 0 or 1 (examples include01001and111001, but not02001or99999). The logical OR operation sets each digit of the result to 1 if either or both of the corresponding digits of the logical operands are 1, and to 0 otherwise. For example,01001 OR 111010 = 111011.- Parameters:
ed1- The first logical operand to the logical OR operation.ed2- The second logical operand to the logical OR operation.ec- An arithmetic context to control the maximum precision of arbitrary-precision numbers. If a logical operand passed to this method has more digits than the maximum precision specified in this context, the operand's most significant digits that exceed that precision are discarded. This parameter can be null.- Returns:
- The result of the logical OR operation as a logical operand. Signals
an invalid operation and returns not-a-number (NaN) if
ed1,ed2, or both are not logical operands.
-
-