PeterO.Numbers.EFloat
## PeterO.Numbers.EFloat
public sealed class EFloat : System.IComparable, System.IEquatable
Represents an arbitrary-precision binary floating-point number. (The “E” stands for “extended”, meaning that instances of this class can be values other than numbers proper, such as infinity and not-a-number.) Each number consists of an integer significand and an integer exponent, both arbitrary-precision. The value of the number equals significand * 2^exponent. This class also supports values for negative zero, not-a-number (NaN) values, and infinity. Passing a signaling NaN to any arithmetic operation shown here will signal the flag FlagInvalid and return a quiet NaN, even if another operand to that operation is a quiet NaN, unless the operation’s documentation expressly states that another result happens when a signaling NaN is passed to that operation.
Passing a quiet NaN to any arithmetic operation shown here will return a quiet NaN, unless the operation’s documentation expressly states that another result happens when a quiet NaN is passed to that operation.
Unless noted otherwise, passing a null arbitrary-precision binary floating-point number argument to any method here will throw an exception.
When an arithmetic operation signals the flag FlagInvalid, FlagOverflow, or FlagDivideByZero, it will not throw an exception too, unless the operation’s trap is enabled in the arithmetic context (see EContext’s Traps property).
An arbitrary-precision binary floating-point number value can be serialized in one of the following ways:
-
By calling the toString() method. However, not all strings can be converted back to an arbitrary-precision binary floating-point number without loss, especially if the string has a fractional part.
-
By calling the UnsignedMantissa, Exponent, and IsNegative properties, and calling the IsInfinity, IsQuietNaN, and IsSignalingNaN methods. The return values combined will uniquely identify a particular arbitrary-precision binary floating-point number value.
If an operation requires creating an intermediate value that might be too big to fit in memory (or might require more than 2 gigabytes of memory to store – due to the current use of a 32-bit integer internally as a length), the operation may signal an invalid-operation flag and return not-a-number (NaN). In certain rare cases, the CompareTo method may throw OutOfMemoryException (called OutOfMemoryError in Java) in the same circumstances.
Thread safety
Instances of this class are immutable, so they are inherently safe for use by multiple threads. Multiple instances of this object with the same properties are interchangeable, so they should not be compared using the “==” operator (which might only check if each side of the operator is the same instance).
Comparison considerations
This class’s natural ordering (under the CompareTo method) is not consistent with the Equals method. This means that two values that compare as equal under the CompareTo method might not be equal under the Equals method. The CompareTo method compares the mathematical values of the two instances passed to it (and considers two different NaN values as equal), while two instances with the same mathematical value, but different exponents, will be considered unequal under the Equals method.
Security note
It is not recommended to implement security-sensitive algorithms using the methods in this class, for several reasons:
-
EFloat
objects are immutable, so they can’t be modified, and the memory they occupy is not guaranteed to be cleared in a timely fashion due to garbage collection. This is relevant for applications that use many-bit-long numbers as secret parameters. -
The methods in this class (especially those that involve arithmetic) are not guaranteed to be “constant-time” (nondata-dependent) for all relevant inputs. Certain attacks that involve encrypted communications have exploited the timing and other aspects of such communications to derive keying material or cleartext indirectly.
Applications should instead use dedicated security libraries to handle big numbers in security-sensitive algorithms.
Reproducibility note
See the reproducibility note in the EDecimal class’s documentation.
Member Summary
[Abs()](#Abs)
- Finds the absolute value of this object (if it’s negative, it becomes positive).[Abs(PeterO.Numbers.EContext)](#Abs_PeterO_Numbers_EContext)
- Finds the absolute value of this object (if it’s negative, it becomes positive).[Add(int)](#Add_int)
- Adds this arbitrary-precision binary floating-point number and a 32-bit signed integer and returns the result.[Add(long)](#Add_long)
- Adds this arbitrary-precision binary floating-point number and a 64-bit signed integer and returns the result.[Add(PeterO.Numbers.EFloat)](#Add_PeterO_Numbers_EFloat)
- Adds this arbitrary-precision binary floating-point number and another arbitrary-precision binary floating-point number and returns the result.[Add(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Add_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Adds this arbitrary-precision binary floating-point number and another arbitrary-precision binary floating-point number and returns the result.[CompareTo(int)](#CompareTo_int)
- Compares the mathematical values of this object and another object, accepting NaN values.[CompareTo(long)](#CompareTo_long)
- Compares the mathematical values of this object and another object, accepting NaN values.[CompareTo(PeterO.Numbers.EFloat)](#CompareTo_PeterO_Numbers_EFloat)
- Compares the mathematical values of this object and another object, accepting NaN values.[CompareToSignal(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#CompareToSignal_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Compares the mathematical values of this object and another object, treating quiet NaN as signaling.[CompareToTotal(PeterO.Numbers.EFloat)](#CompareToTotal_PeterO_Numbers_EFloat)
- Compares the values of this object and another object, imposing a total ordering on all possible values.[CompareToTotal(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#CompareToTotal_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Compares the values of this object and another object, imposing a total ordering on all possible values.[CompareToTotalMagnitude(PeterO.Numbers.EFloat)](#CompareToTotalMagnitude_PeterO_Numbers_EFloat)
- Compares the absolute values of this object and another object, imposing a total ordering on all possible values (ignoring their signs).[CompareToTotalMagnitude(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#CompareToTotalMagnitude_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Compares the values of this object and another object, imposing a total ordering on all possible values (ignoring their signs).[CompareToValue(int)](#CompareToValue_int)
- Compares the mathematical values of this object and another object, accepting NaN values.[CompareToValue(long)](#CompareToValue_long)
- Compares the mathematical values of this object and another object, accepting NaN values.[CompareToValue(PeterO.Numbers.EFloat)](#CompareToValue_PeterO_Numbers_EFloat)
- Compares the mathematical values of this object and another object, accepting NaN values.[CompareToWithContext(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#CompareToWithContext_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Compares the mathematical values of this object and another object.[Copy()](#Copy)
- Creates a copy of this arbitrary-precision binary number.[CopySign(PeterO.Numbers.EFloat)](#CopySign_PeterO_Numbers_EFloat)
- Returns a number with the same value as this one, but copying the sign (positive or negative) of another number.[Create(int, int)](#Create_int_int)
- Returns an arbitrary-precision number with the value exponent*2^significand.[Create(long, int)](#Create_long_int)
- Returns an arbitrary-precision number with the value exponent*2^significand.[Create(long, long)](#Create_long_long)
- Returns an arbitrary-precision number with the value exponent*2^significand.[Create(PeterO.Numbers.EInteger, int)](#Create_PeterO_Numbers_EInteger_int)
- Returns an arbitrary-precision number with the value exponent*2^significand.[Create(PeterO.Numbers.EInteger, long)](#Create_PeterO_Numbers_EInteger_long)
- Returns an arbitrary-precision number with the value exponent*2^significand.[Create(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#Create_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Returns an arbitrary-precision number with the value exponent*2^significand.[CreateNaN(PeterO.Numbers.EInteger)](#CreateNaN_PeterO_Numbers_EInteger)
- Creates a not-a-number arbitrary-precision binary number.[CreateNaN(PeterO.Numbers.EInteger, bool, bool, PeterO.Numbers.EContext)](#CreateNaN_PeterO_Numbers_EInteger_bool_bool_PeterO_Numbers_EContext)
- Creates a not-a-number arbitrary-precision binary number.[Decrement()](#Decrement)
- Returns one subtracted from this arbitrary-precision binary floating-point number.[Divide(int)](#Divide_int)
- Divides this arbitrary-precision binary floating-point number by a 32-bit signed integer and returns the result; returns NaN instead if the result would have a nonterminating binary expansion (including 1/3, 1/12, 1/7, 2/3, and so on); if this is not desired, use DivideToExponent, or use the Divide overload that takes an EContext.[Divide(long)](#Divide_long)
- Divides this arbitrary-precision binary floating-point number by a 64-bit signed integer and returns the result; returns NaN instead if the result would have a nonterminating binary expansion (including 1/3, 1/12, 1/7, 2/3, and so on); if this is not desired, use DivideToExponent, or use the Divide overload that takes an EContext.[Divide(PeterO.Numbers.EFloat)](#Divide_PeterO_Numbers_EFloat)
- Divides this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result; returns NaN instead if the result would have a nonterminating binary expansion (including 1/3, 1/12, 1/7, 2/3, and so on); if this is not desired, use DivideToExponent, or use the Divide overload that takes an EContext.[Divide(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Divide_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Divides this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result.[DivideAndRemainderNaturalScale(PeterO.Numbers.EFloat)](#DivideAndRemainderNaturalScale_PeterO_Numbers_EFloat)
- Obsolete: Renamed to DivRemNaturalScale.[DivideAndRemainderNaturalScale(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#DivideAndRemainderNaturalScale_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Obsolete: Renamed to DivRemNaturalScale.[DivideToExponent(PeterO.Numbers.EFloat, long, PeterO.Numbers.EContext)](#DivideToExponent_PeterO_Numbers_EFloat_long_PeterO_Numbers_EContext)
- Divides two arbitrary-precision binary floating-point numbers, and gives a particular exponent to the result.[DivideToExponent(PeterO.Numbers.EFloat, long, PeterO.Numbers.ERounding)](#DivideToExponent_PeterO_Numbers_EFloat_long_PeterO_Numbers_ERounding)
- Divides two arbitrary-precision binary floating-point numbers, and gives a particular exponent to the result.[DivideToExponent(PeterO.Numbers.EFloat, PeterO.Numbers.EInteger, PeterO.Numbers.EContext)](#DivideToExponent_PeterO_Numbers_EFloat_PeterO_Numbers_EInteger_PeterO_Numbers_EContext)
- Divides two arbitrary-precision binary floating-point numbers, and gives a particular exponent to the result.[DivideToExponent(PeterO.Numbers.EFloat, PeterO.Numbers.EInteger, PeterO.Numbers.ERounding)](#DivideToExponent_PeterO_Numbers_EFloat_PeterO_Numbers_EInteger_PeterO_Numbers_ERounding)
- Divides two arbitrary-precision binary floating-point numbers, and gives a particular exponent to the result.[DivideToIntegerNaturalScale(PeterO.Numbers.EFloat)](#DivideToIntegerNaturalScale_PeterO_Numbers_EFloat)
- Divides two arbitrary-precision binary floating-point numbers, and returns the integer part of the result, rounded down, with the preferred exponent set to this value’s exponent minus the divisor’s exponent.[DivideToIntegerNaturalScale(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#DivideToIntegerNaturalScale_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Divides this object by another object, and returns the integer part of the result (which is initially rounded down), with the preferred exponent set to this value’s exponent minus the divisor’s exponent.[DivideToIntegerZeroScale(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#DivideToIntegerZeroScale_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Divides this object by another object, and returns the integer part of the result, with the exponent set to 0.[DivideToSameExponent(PeterO.Numbers.EFloat, PeterO.Numbers.ERounding)](#DivideToSameExponent_PeterO_Numbers_EFloat_PeterO_Numbers_ERounding)
- Divides this object by another binary floating-point number and returns a result with the same exponent as this object (the dividend).[DivRemNaturalScale(PeterO.Numbers.EFloat)](#DivRemNaturalScale_PeterO_Numbers_EFloat)
- Divides this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns a two-item array containing the result of the division and the remainder, in that order.[DivRemNaturalScale(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#DivRemNaturalScale_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Divides this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns a two-item array containing the result of the division and the remainder, in that order.[Equals(object)](#Equals_object)
- Determines whether this object’s significand, exponent, and properties are equal to those of another object and that other object is an arbitrary-precision binary floating-point number.[Equals(PeterO.Numbers.EFloat)](#Equals_PeterO_Numbers_EFloat)
- Determines whether this object’s significand, exponent, and properties are equal to those of another object.[EqualsInternal(PeterO.Numbers.EFloat)](#EqualsInternal_PeterO_Numbers_EFloat)
- Determines whether this object’s significand and exponent are equal to those of another object.[Exp(PeterO.Numbers.EContext)](#Exp_PeterO_Numbers_EContext)
- Finds e (the base of natural logarithms) raised to the power of this object’s value.[explicit operator byte(PeterO.Numbers.EFloat)](#explicit_operator_byte_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255) after converting it to an integer by discarding its fractional part.[explicit operator double(PeterO.Numbers.EFloat)](#explicit_operator_double_PeterO_Numbers_EFloat)
- Converts this value to its closest equivalent as a 64-bit floating-point number.[explicit operator float(PeterO.Numbers.EFloat)](#explicit_operator_float_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to its closest equivalent as a 32-bit floating-point number.[explicit operator int(PeterO.Numbers.EFloat)](#explicit_operator_int_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to a 32-bit signed integer if it can fit in a 32-bit signed integer after converting it to an integer by discarding its fractional part.[explicit operator long(PeterO.Numbers.EFloat)](#explicit_operator_long_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to a 64-bit signed integer if it can fit in a 64-bit signed integer after converting it to an integer by discarding its fractional part.[explicit operator PeterO.Numbers.EFloat(bool)](#explicit_operator_PeterO_Numbers_EFloat_bool)
- Converts a Boolean value (true or false) to an arbitrary-precision binary floating-point number.[explicit operator PeterO.Numbers.EInteger(PeterO.Numbers.EFloat)](#explicit_operator_PeterO_Numbers_EInteger_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to a value to an arbitrary-precision integer.[explicit operator sbyte(PeterO.Numbers.EFloat)](#explicit_operator_sbyte_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to an 8-bit signed integer if it can fit in an 8-bit signed integer after converting it to an integer by discarding its fractional part.[explicit operator short(PeterO.Numbers.EFloat)](#explicit_operator_short_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to a 16-bit signed integer if it can fit in a 16-bit signed integer after converting it to an integer by discarding its fractional part.[explicit operator uint(PeterO.Numbers.EFloat)](#explicit_operator_uint_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to a 32-bit signed integer if it can fit in a 32-bit signed integer after converting it to an integer by discarding its fractional part.[explicit operator ulong(PeterO.Numbers.EFloat)](#explicit_operator_ulong_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to a 64-bit unsigned integer if it can fit in a 64-bit unsigned integer after converting it to an integer by discarding its fractional part.[explicit operator ushort(PeterO.Numbers.EFloat)](#explicit_operator_ushort_PeterO_Numbers_EFloat)
- Converts an arbitrary-precision binary floating-point number to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer after converting it to an integer by discarding its fractional part.[ExpM1(PeterO.Numbers.EContext)](#ExpM1_PeterO_Numbers_EContext)
- Finds e (the base of natural logarithms) raised to the power of this object’s value, and subtracts the result by 1 and returns the final result, in a way that avoids loss of precision if the true result is very close to 0.[Exponent](#Exponent)
- Gets this object’s exponent.[FromBoolean(bool)](#FromBoolean_bool)
- Converts a Boolean value (either true or false) to an arbitrary-precision binary floating-point number.[FromByte(byte)](#FromByte_byte)
- Converts a byte (from 0 to 255) to an arbitrary-precision binary floating-point number.[FromDouble(double)](#FromDouble_double)
- Creates a binary floating-point number from a 64-bit floating-point number.[FromDoubleBits(long)](#FromDoubleBits_long)
- Creates a binary floating-point number from a 64-bit floating-point number encoded in the IEEE 754 binary64 format.[FromEInteger(PeterO.Numbers.EInteger)](#FromEInteger_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to the same value as a binary floating-point number.[FromHalfBits(short)](#FromHalfBits_short)
- Creates a binary floating-point number from a binary floating-point number encoded in the IEEE 754 binary16 format (also known as a “half-precision” floating-point number).[FromInt16(short)](#FromInt16_short)
- Converts a 16-bit signed integer to an arbitrary-precision binary floating-point number.[FromInt32(int)](#FromInt32_int)
- Converts a 32-bit signed integer to an arbitrary-precision binary floating-point number.[FromInt64(long)](#FromInt64_long)
- Converts a 64-bit signed integer to an arbitrary-precision binary floating-point number.[FromInt64AsUnsigned(long)](#FromInt64AsUnsigned_long)
- Converts an unsigned integer expressed as a 64-bit signed integer to an arbitrary-precision binary number.[FromSByte(sbyte)](#FromSByte_sbyte)
- Converts an 8-bit signed integer to an arbitrary-precision binary floating-point number.[FromSingle(float)](#FromSingle_float)
- Creates a binary floating-point number from a 32-bit floating-point number.[FromSingleBits(int)](#FromSingleBits_int)
- Creates a binary floating-point number from a 32-bit floating-point number encoded in the IEEE 754 binary32 format.[FromString(byte[])](#FromString_byte)
- Creates a binary floating-point number from a sequence of bytes that represents a number, using an unlimited precision context.[FromString(byte[], int, int)](#FromString_byte_int_int)
- Creates a binary floating-point number from a sequence of bytes that represents a number.[FromString(byte[], int, int, PeterO.Numbers.EContext)](#FromString_byte_int_int_PeterO_Numbers_EContext)
- Creates a binary floating-point number from a sequence of bytes that represents a number.[FromString(byte[], PeterO.Numbers.EContext)](#FromString_byte_PeterO_Numbers_EContext)
- Creates a binary floating-point number from a sequence of bytes that represents a number.[FromString(char[])](#FromString_char)
- Creates a binary floating-point number from a sequence of char s that represents a number, using an unlimited precision context.[FromString(char[], int, int)](#FromString_char_int_int)
- Creates a binary floating-point number from a sequence of char s that represents a number.[FromString(char[], int, int, PeterO.Numbers.EContext)](#FromString_char_int_int_PeterO_Numbers_EContext)
- Creates a binary floating-point number from a sequence of char s that represents a number.[FromString(char[], PeterO.Numbers.EContext)](#FromString_char_PeterO_Numbers_EContext)
- Creates a binary floating-point number from a sequence of char s that represents a number.[FromString(string)](#FromString_string)
- Creates a binary floating-point number from a text string that represents a number, using an unlimited precision context.[FromString(string, int, int)](#FromString_string_int_int)
- Creates a binary floating-point number from a text string that represents a number.[FromString(string, int, int, PeterO.Numbers.EContext)](#FromString_string_int_int_PeterO_Numbers_EContext)
- Creates a binary floating-point number from a text string that represents a number.[FromString(string, PeterO.Numbers.EContext)](#FromString_string_PeterO_Numbers_EContext)
- Creates a binary floating-point number from a text string that represents a number.[FromUInt16(ushort)](#FromUInt16_ushort)
- Converts a 16-bit unsigned integer to an arbitrary-precision binary floating-point number.[FromUInt32(uint)](#FromUInt32_uint)
- Converts a 32-bit signed integer to an arbitrary-precision binary floating-point number.[FromUInt64(ulong)](#FromUInt64_ulong)
- Converts a 64-bit unsigned integer to an arbitrary-precision binary floating-point number.[GetHashCode()](#GetHashCode)
- Calculates this object’s hash code.[implicit operator PeterO.Numbers.EFloat(byte)](#implicit_operator_PeterO_Numbers_EFloat_byte)
- Converts a byte (from 0 to 255) to an arbitrary-precision binary floating-point number.[implicit operator PeterO.Numbers.EFloat(double)](#implicit_operator_PeterO_Numbers_EFloat_double)
- Creates a binary floating-point number from a 64-bit floating-point number.[implicit operator PeterO.Numbers.EFloat(float)](#implicit_operator_PeterO_Numbers_EFloat_float)
- Creates a binary floating-point number from a 32-bit floating-point number.[implicit operator PeterO.Numbers.EFloat(int)](#implicit_operator_PeterO_Numbers_EFloat_int)
- Converts a 32-bit signed integer to an arbitrary-precision binary floating-point number.[implicit operator PeterO.Numbers.EFloat(long)](#implicit_operator_PeterO_Numbers_EFloat_long)
- Converts a 64-bit signed integer to an arbitrary-precision binary floating-point number.[implicit operator PeterO.Numbers.EFloat(PeterO.Numbers.EInteger)](#implicit_operator_PeterO_Numbers_EFloat_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to an arbitrary precision binary.[implicit operator PeterO.Numbers.EFloat(sbyte)](#implicit_operator_PeterO_Numbers_EFloat_sbyte)
- Converts an 8-bit signed integer to an arbitrary-precision binary floating-point number.[implicit operator PeterO.Numbers.EFloat(short)](#implicit_operator_PeterO_Numbers_EFloat_short)
- Converts a 16-bit signed integer to an arbitrary-precision binary floating-point number.[implicit operator PeterO.Numbers.EFloat(uint)](#implicit_operator_PeterO_Numbers_EFloat_uint)
- Converts a 32-bit signed integer to an arbitrary-precision binary floating-point number.[implicit operator PeterO.Numbers.EFloat(ulong)](#implicit_operator_PeterO_Numbers_EFloat_ulong)
- Converts a 64-bit unsigned integer to an arbitrary-precision binary floating-point number.[implicit operator PeterO.Numbers.EFloat(ushort)](#implicit_operator_PeterO_Numbers_EFloat_ushort)
- Converts a 16-bit unsigned integer to an arbitrary-precision binary floating-point number.[Increment()](#Increment)
- Returns one added to this arbitrary-precision binary floating-point number.[IsFinite](#IsFinite)
- Gets a value indicating whether this object is finite (not infinity or not-a-number, NaN).[IsInfinity()](#IsInfinity)
- Gets a value indicating whether this object is positive or negative infinity.[IsInteger()](#IsInteger)
- Returns whether this object’s value is an integer.[IsNaN()](#IsNaN)
- Gets a value indicating whether this object is not a number (NaN).[IsNegative](#IsNegative)
- Gets a value indicating whether this object is negative, including negative zero.[IsNegativeInfinity()](#IsNegativeInfinity)
- Returns whether this object is negative infinity.[IsPositiveInfinity()](#IsPositiveInfinity)
- Returns whether this object is positive infinity.[IsQuietNaN()](#IsQuietNaN)
- Gets a value indicating whether this object is a quiet not-a-number value.[IsSignalingNaN()](#IsSignalingNaN)
- Gets a value indicating whether this object is a signaling not-a-number value.[IsZero](#IsZero)
- Gets a value indicating whether this object’s value equals 0.[Log(PeterO.Numbers.EContext)](#Log_PeterO_Numbers_EContext)
- Finds the natural logarithm of this object, that is, the power (exponent) that e (the base of natural logarithms) must be raised to in order to equal this object’s value.[Log10(PeterO.Numbers.EContext)](#Log10_PeterO_Numbers_EContext)
- Finds the base-10 logarithm of this object, that is, the power (exponent) that the number 10 must be raised to in order to equal this object’s value.[Log1P(PeterO.Numbers.EContext)](#Log1P_PeterO_Numbers_EContext)
- Adds 1 to this object’s value and finds the natural logarithm of the result, in a way that avoids loss of precision when this object’s value is between 0 and 1.[LogN(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#LogN_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Finds the base-N logarithm of this object, that is, the power (exponent) that the number N must be raised to in order to equal this object’s value.[Mantissa](#Mantissa)
- Gets this object’s unscaled value, or significand, and makes it negative if this object is negative.[Max(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#Max_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat)
- Gets the greater value between two binary floating-point numbers.[Max(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Max_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Gets the greater value between two binary floating-point numbers.[MaxMagnitude(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#MaxMagnitude_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat)
- Gets the greater value between two values, ignoring their signs.[MaxMagnitude(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#MaxMagnitude_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Gets the greater value between two values, ignoring their signs.[Min(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#Min_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat)
- Gets the lesser value between two binary floating-point numbers.[Min(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Min_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Gets the lesser value between two binary floating-point numbers.[MinMagnitude(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#MinMagnitude_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat)
- Gets the lesser value between two values, ignoring their signs.[MinMagnitude(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#MinMagnitude_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Gets the lesser value between two values, ignoring their signs.[MovePointLeft(int)](#MovePointLeft_int)
- Returns a number similar to this number but with the radix point moved to the left.[MovePointLeft(int, PeterO.Numbers.EContext)](#MovePointLeft_int_PeterO_Numbers_EContext)
- Returns a number similar to this number but with the radix point moved to the left.[MovePointLeft(PeterO.Numbers.EInteger)](#MovePointLeft_PeterO_Numbers_EInteger)
- Returns a number similar to this number but with the radix point moved to the left.[MovePointLeft(PeterO.Numbers.EInteger, PeterO.Numbers.EContext)](#MovePointLeft_PeterO_Numbers_EInteger_PeterO_Numbers_EContext)
- Returns a number similar to this number but with the radix point moved to the left.[MovePointRight(int)](#MovePointRight_int)
- Returns a number similar to this number but with the radix point moved to the right.[MovePointRight(int, PeterO.Numbers.EContext)](#MovePointRight_int_PeterO_Numbers_EContext)
- Returns a number similar to this number but with the radix point moved to the right.[MovePointRight(PeterO.Numbers.EInteger)](#MovePointRight_PeterO_Numbers_EInteger)
- Returns a number similar to this number but with the radix point moved to the right.[MovePointRight(PeterO.Numbers.EInteger, PeterO.Numbers.EContext)](#MovePointRight_PeterO_Numbers_EInteger_PeterO_Numbers_EContext)
- Returns a number similar to this number but with the radix point moved to the right.[Multiply(int)](#Multiply_int)
- Multiplies this arbitrary-precision binary floating-point number by a 32-bit signed integer and returns the result.[Multiply(long)](#Multiply_long)
- Multiplies this arbitrary-precision binary floating-point number by a 64-bit signed integer and returns the result.[Multiply(PeterO.Numbers.EFloat)](#Multiply_PeterO_Numbers_EFloat)
- Multiplies this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result.[Multiply(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Multiply_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Multiplies this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result.[MultiplyAndAdd(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#MultiplyAndAdd_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat)
- Multiplies by one binary floating-point number, and then adds another binary floating-point number.[MultiplyAndAdd(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#MultiplyAndAdd_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Multiplies by one value, and then adds another value.[MultiplyAndSubtract(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#MultiplyAndSubtract_PeterO_Numbers_EFloat_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Multiplies by one value, and then subtracts another value.[public static readonly PeterO.Numbers.EFloat NaN;](#NaN)
- A not-a-number value.[Negate()](#Negate)
- Gets an object with the same value as this one, but with the sign reversed.[Negate(PeterO.Numbers.EContext)](#Negate_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value as this object but with the sign reversed.[public static readonly PeterO.Numbers.EFloat NegativeInfinity;](#NegativeInfinity)
- Negative infinity, less than any other number.[public static readonly PeterO.Numbers.EFloat NegativeZero;](#NegativeZero)
- Represents the number negative zero.[NextMinus(PeterO.Numbers.EContext)](#NextMinus_PeterO_Numbers_EContext)
- Finds the largest value that’s smaller than the specified value.[NextPlus(PeterO.Numbers.EContext)](#NextPlus_PeterO_Numbers_EContext)
- Finds the smallest value that’s greater than the specified value.[NextToward(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#NextToward_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Finds the next value that is closer to the other object’s value than this object’s value.[public static readonly PeterO.Numbers.EFloat One;](#One)
- Represents the number 1.[PeterO.Numbers.EFloat operator +(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#op_Addition)
- Adds an arbitrary-precision binary floating-point number and another arbitrary-precision binary floating-point number and returns the result.[PeterO.Numbers.EFloat operator --(PeterO.Numbers.EFloat)](#op_Decrement)
- Subtracts one from an arbitrary-precision binary floating-point number.[PeterO.Numbers.EFloat operator /(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#op_Division)
- Divides one binary floating-point number by another and returns the result.[PeterO.Numbers.EFloat operator ++(PeterO.Numbers.EFloat)](#op_Increment)
- Adds one to an arbitrary-precision binary floating-point number.[PeterO.Numbers.EFloat operator %(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#op_Modulus)
- Returns the remainder that would result when an arbitrary-precision binary floating-point number is divided by another arbitrary-precision binary floating-point number.[PeterO.Numbers.EFloat operator *(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#op_Multiply)
- Multiplies an arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result.[PeterO.Numbers.EFloat operator -(PeterO.Numbers.EFloat, PeterO.Numbers.EFloat)](#op_Subtraction)
- Subtracts one arbitrary-precision binary floating-point number from another.[PeterO.Numbers.EFloat operator -(PeterO.Numbers.EFloat)](#op_UnaryNegation)
- Gets an object with the same value as this one, but with the sign reversed.[PI(PeterO.Numbers.EContext)](#PI_PeterO_Numbers_EContext)
- Finds the constant π, the circumference of a circle divided by its diameter.[Plus(PeterO.Numbers.EContext)](#Plus_PeterO_Numbers_EContext)
- Rounds this object’s value to the specified precision, using the specified rounding mode and range of exponent, and also converts negative zero to positive zero.[public static readonly PeterO.Numbers.EFloat PositiveInfinity;](#PositiveInfinity)
- Positive infinity, greater than any other number.[Pow(int)](#Pow_int)
- Raises this object’s value to the specified exponent.[Pow(int, PeterO.Numbers.EContext)](#Pow_int_PeterO_Numbers_EContext)
- Raises this object’s value to the specified exponent.[Pow(PeterO.Numbers.EFloat)](#Pow_PeterO_Numbers_EFloat)
- Raises this object’s value to the specified exponent, using unlimited precision.[Pow(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Pow_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Raises this object’s value to the specified exponent.[Precision()](#Precision)
- Finds the number of digits in this number’s significand.[PreRound(PeterO.Numbers.EContext)](#PreRound_PeterO_Numbers_EContext)
- Returns a number in which the value of this object is rounded to fit the maximum precision allowed if it has more significant digits than the maximum precision.[Quantize(int, PeterO.Numbers.EContext)](#Quantize_int_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value but a new exponent.[Quantize(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Quantize_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value as this object but with the same exponent as another binary floating-point number.[Quantize(PeterO.Numbers.EInteger, PeterO.Numbers.EContext)](#Quantize_PeterO_Numbers_EInteger_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value but a new exponent.[Reduce(PeterO.Numbers.EContext)](#Reduce_PeterO_Numbers_EContext)
- Returns an object with the same numerical value as this one but with trailing zeros removed from its significand.[Remainder(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Remainder_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Returns the remainder that would result when this arbitrary-precision binary floating-point number is divided by another arbitrary-precision binary floating-point number.[RemainderNaturalScale(PeterO.Numbers.EFloat)](#RemainderNaturalScale_PeterO_Numbers_EFloat)
- Calculates the remainder of a number by the formula “this” - ((“this” / “divisor”) * “divisor”).[RemainderNaturalScale(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#RemainderNaturalScale_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Calculates the remainder of a number by the formula “this” - ((“this” / “divisor”) * “divisor”).[RemainderNear(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#RemainderNear_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Finds the distance to the closest multiple of the specified divisor, based on the result of dividing this object’s value by another object’s value.[RemainderNoRoundAfterDivide(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#RemainderNoRoundAfterDivide_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Finds the remainder that results when dividing two arbitrary-precision binary floating-point numbers.[RoundToExponent(int, PeterO.Numbers.EContext)](#RoundToExponent_int_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value as this object but rounded to a new exponent if necessary.[RoundToExponent(PeterO.Numbers.EInteger, PeterO.Numbers.EContext)](#RoundToExponent_PeterO_Numbers_EInteger_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value as this object but rounded to a new exponent if necessary.[RoundToExponentExact(int, PeterO.Numbers.EContext)](#RoundToExponentExact_int_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value as this object but rounded to the specified exponent represented as a 32-bit signed integer, and signals an inexact flag if the result would be inexact.[RoundToExponentExact(PeterO.Numbers.EInteger, PeterO.Numbers.EContext)](#RoundToExponentExact_PeterO_Numbers_EInteger_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value as this object but rounded to the specified exponent, and signals an inexact flag if the result would be inexact.[RoundToExponentExact(PeterO.Numbers.EInteger, PeterO.Numbers.ERounding)](#RoundToExponentExact_PeterO_Numbers_EInteger_PeterO_Numbers_ERounding)
- Returns a binary number with the same value as this object but rounded to the specified exponent.[RoundToIntegerExact(PeterO.Numbers.EContext)](#RoundToIntegerExact_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value as this object but rounded to an integer, and signals an inexact flag if the result would be inexact.[RoundToIntegerNoRoundedFlag(PeterO.Numbers.EContext)](#RoundToIntegerNoRoundedFlag_PeterO_Numbers_EContext)
- Returns a binary floating-point number with the same value as this object but rounded to an integer, without adding the FlagInexact or FlagRounded flags.[RoundToIntegralExact(PeterO.Numbers.EContext)](#RoundToIntegralExact_PeterO_Numbers_EContext)
- Obsolete: Renamed to RoundToIntegerExact.[RoundToIntegralNoRoundedFlag(PeterO.Numbers.EContext)](#RoundToIntegralNoRoundedFlag_PeterO_Numbers_EContext)
- Obsolete: Renamed to RoundToIntegerNoRoundedFlag.[RoundToPrecision(PeterO.Numbers.EContext)](#RoundToPrecision_PeterO_Numbers_EContext)
- Rounds this object’s value to the specified precision, using the specified rounding mode and range of exponent.[ScaleByPowerOfTwo(int)](#ScaleByPowerOfTwo_int)
- Returns a number similar to this number but with the scale adjusted.[ScaleByPowerOfTwo(int, PeterO.Numbers.EContext)](#ScaleByPowerOfTwo_int_PeterO_Numbers_EContext)
- Returns a number similar to this number but with the scale adjusted.[ScaleByPowerOfTwo(PeterO.Numbers.EInteger)](#ScaleByPowerOfTwo_PeterO_Numbers_EInteger)
- Returns a number similar to this number but with the scale adjusted.[ScaleByPowerOfTwo(PeterO.Numbers.EInteger, PeterO.Numbers.EContext)](#ScaleByPowerOfTwo_PeterO_Numbers_EInteger_PeterO_Numbers_EContext)
- Returns a number similar to this number but with its scale adjusted.[Sign](#Sign)
- Gets this value’s sign: -1 if negative; 1 if positive; 0 if zero.[public static readonly PeterO.Numbers.EFloat SignalingNaN;](#SignalingNaN)
- A not-a-number value that signals an invalid operation flag when it’s passed as an argument to any arithmetic operation in arbitrary-precision binary floating-point number.[Sqrt(PeterO.Numbers.EContext)](#Sqrt_PeterO_Numbers_EContext)
- Finds the square root of this object’s value.[SquareRoot(PeterO.Numbers.EContext)](#SquareRoot_PeterO_Numbers_EContext)
- Obsolete: Renamed to Sqrt.[Subtract(int)](#Subtract_int)
- Subtracts a 32-bit signed integer from this arbitrary-precision binary floating-point number and returns the result.[Subtract(long)](#Subtract_long)
- Subtracts a 64-bit signed integer from this arbitrary-precision binary floating-point number and returns the result.[Subtract(PeterO.Numbers.EFloat)](#Subtract_PeterO_Numbers_EFloat)
- Subtracts an arbitrary-precision binary floating-point number from this arbitrary-precision binary floating-point number and returns the result.[Subtract(PeterO.Numbers.EFloat, PeterO.Numbers.EContext)](#Subtract_PeterO_Numbers_EFloat_PeterO_Numbers_EContext)
- Subtracts an arbitrary-precision binary floating-point number from this arbitrary-precision binary floating-point number and returns the result.[public static readonly PeterO.Numbers.EFloat Ten;](#Ten)
- Represents the number 10.[ToByteChecked()](#ToByteChecked)
- Converts this number’s value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255) after converting it to an integer by discarding its fractional part.[ToByteIfExact()](#ToByteIfExact)
- Converts this number’s value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255) without rounding to a different numerical value.[ToByteUnchecked()](#ToByteUnchecked)
- Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a byte (from 0 to 255).[ToDouble()](#ToDouble)
- Converts this value to a 64-bit floating-point number encoded in the IEEE 754 binary64 format.[ToDoubleBits()](#ToDoubleBits)
- Converts this value to its closest equivalent as a 64-bit floating-point number, expressed as an integer in the IEEE 754 binary64 format.[ToEDecimal()](#ToEDecimal)
- Converts this value to an arbitrary-precision decimal number.[ToEInteger()](#ToEInteger)
- Converts this value to an arbitrary-precision integer.[ToEIntegerExact()](#ToEIntegerExact)
- Obsolete: Renamed to ToEIntegerIfExact.[ToEIntegerIfExact()](#ToEIntegerIfExact)
- Converts this value to an arbitrary-precision integer, checking whether the value contains a fractional part.[ToEngineeringString()](#ToEngineeringString)
- Converts this value to an arbitrary-precision decimal number, then returns the value of that decimal’s ToEngineeringString method.[ToExtendedDecimal()](#ToExtendedDecimal)
- Obsolete: Renamed to ToEDecimal.[ToHalfBits()](#ToHalfBits)
- Converts this value to its closest equivalent as a binary floating-point number, expressed as an integer in the IEEE 754 binary16 format (also known as a “half-precision” floating-point number).[ToInt16Checked()](#ToInt16Checked)
- Converts this number’s value to a 16-bit signed integer if it can fit in a 16-bit signed integer after converting it to an integer by discarding its fractional part.[ToInt16IfExact()](#ToInt16IfExact)
- Converts this number’s value to a 16-bit signed integer if it can fit in a 16-bit signed integer without rounding to a different numerical value.[ToInt16Unchecked()](#ToInt16Unchecked)
- Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 16-bit signed integer.[ToInt32Checked()](#ToInt32Checked)
- Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer after converting it to an integer by discarding its fractional part.[ToInt32IfExact()](#ToInt32IfExact)
- Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer without rounding to a different numerical value.[ToInt32Unchecked()](#ToInt32Unchecked)
- Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 32-bit signed integer.[ToInt64Checked()](#ToInt64Checked)
- Converts this number’s value to a 64-bit signed integer if it can fit in a 64-bit signed integer after converting it to an integer by discarding its fractional part.[ToInt64IfExact()](#ToInt64IfExact)
- Converts this number’s value to a 64-bit signed integer if it can fit in a 64-bit signed integer without rounding to a different numerical value.[ToInt64Unchecked()](#ToInt64Unchecked)
- Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 64-bit signed integer.[ToPlainString()](#ToPlainString)
- Converts this value to a string, but without exponential notation.[ToSByteChecked()](#ToSByteChecked)
- Converts this number’s value to an 8-bit signed integer if it can fit in an 8-bit signed integer after converting it to an integer by discarding its fractional part.[ToSByteIfExact()](#ToSByteIfExact)
- Converts this number’s value to an 8-bit signed integer if it can fit in an 8-bit signed integer without rounding to a different numerical value.[ToSByteUnchecked()](#ToSByteUnchecked)
- Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as an 8-bit signed integer.[ToShortestString(PeterO.Numbers.EContext)](#ToShortestString_PeterO_Numbers_EContext)
- Returns a string representation of this number’s value after rounding that value to the specified precision (using the specified arithmetic context, such as EContext.[ToSingle()](#ToSingle)
- Converts this value to its closest equivalent as a 32-bit floating-point number.[ToSingleBits()](#ToSingleBits)
- Converts this value to its closest equivalent as 32-bit floating-point number, expressed as an integer in the IEEE 754 binary32 format.[ToSizedEInteger(int)](#ToSizedEInteger_int)
- Converts this value to an arbitrary-precision integer by discarding its fractional part and checking whether the resulting integer overflows the specified signed bit count.[ToSizedEIntegerIfExact(int)](#ToSizedEIntegerIfExact_int)
- Converts this value to an arbitrary-precision integer, only if this number’s value is an exact integer and that integer does not overflow the specified signed bit count.[ToString()](#ToString)
- Converts this number’s value to a text string.[ToUInt16Checked()](#ToUInt16Checked)
- Converts this number’s value to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer after converting it to an integer by discarding its fractional part.[ToUInt16IfExact()](#ToUInt16IfExact)
- Converts this number’s value to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer without rounding to a different numerical value.[ToUInt16Unchecked()](#ToUInt16Unchecked)
- Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 16-bit unsigned integer.[ToUInt32Checked()](#ToUInt32Checked)
- Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer after converting it to an integer by discarding its fractional part.[ToUInt32IfExact()](#ToUInt32IfExact)
- Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer without rounding to a different numerical value.[ToUInt32Unchecked()](#ToUInt32Unchecked)
- Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 32-bit signed integer.[ToUInt64Checked()](#ToUInt64Checked)
- Converts this number’s value to a 64-bit unsigned integer if it can fit in a 64-bit unsigned integer after converting it to an integer by discarding its fractional part.[ToUInt64IfExact()](#ToUInt64IfExact)
- Converts this number’s value to a 64-bit unsigned integer if it can fit in a 64-bit unsigned integer without rounding to a different numerical value.[ToUInt64Unchecked()](#ToUInt64Unchecked)
- Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 64-bit unsigned integer.[Ulp()](#Ulp)
- Returns the unit in the last place.[UnsignedMantissa](#UnsignedMantissa)
- Gets the absolute value of this object’s unscaled value, or significand.[public static readonly PeterO.Numbers.EFloat Zero;](#Zero)
- Represents the number 0.
public static readonly PeterO.Numbers.EFloat NaN;
A not-a-number value.
public static readonly PeterO.Numbers.EFloat NegativeInfinity;
Negative infinity, less than any other number.
public static readonly PeterO.Numbers.EFloat NegativeZero;
Represents the number negative zero.
public static readonly PeterO.Numbers.EFloat One;
Represents the number 1.
public static readonly PeterO.Numbers.EFloat PositiveInfinity;
Positive infinity, greater than any other number.
public static readonly PeterO.Numbers.EFloat SignalingNaN;
A not-a-number value that signals an invalid operation flag when it’s passed as an argument to any arithmetic operation in arbitrary-precision binary floating-point number.
public static readonly PeterO.Numbers.EFloat Ten;
Represents the number 10.
public static readonly PeterO.Numbers.EFloat Zero;
Represents the number 0.
public PeterO.Numbers.EInteger Exponent { get; }
Gets this object’s exponent. This object’s value will be an integer if the exponent is positive or zero.
Returns:
This object’s exponent. This object’s value will be an integer if the exponent is positive or zero.
public bool IsFinite { get; }
Gets a value indicating whether this object is finite (not infinity or not-a-number, NaN).
Returns:
true
if this object is finite (not infinity or not-a-number, NaN); otherwise, false
.
public bool IsNegative { get; }
Gets a value indicating whether this object is negative, including negative zero.
Returns:
true
if this object is negative, including negative zero; otherwise, false
.
public bool IsZero { get; }
Gets a value indicating whether this object’s value equals 0.
Returns:
true
if this object’s value equals 0; otherwise, false
. true
if this object’s value equals 0; otherwise, false
.
public PeterO.Numbers.EInteger Mantissa { get; }
Gets this object’s unscaled value, or significand, and makes it negative if this object is negative. If this value is not-a-number (NaN), that value’s absolute value is the NaN’s “payload” (diagnostic information).
Returns:
This object’s unscaled value. Will be negative if this object’s value is negative (including a negative NaN).
public int Sign { get; }
Gets this value’s sign: -1 if negative; 1 if positive; 0 if zero.
Returns:
This value’s sign: -1 if negative; 1 if positive; 0 if zero.
public PeterO.Numbers.EInteger UnsignedMantissa { get; }
Gets the absolute value of this object’s unscaled value, or significand. If this value is not-a-number (NaN), that value is the NaN’s “payload” (diagnostic information).
Returns:
The absolute value of this object’s unscaled value.
public PeterO.Numbers.EFloat Abs( PeterO.Numbers.EContext context);
Finds the absolute value of this object (if it’s negative, it becomes positive).
Parameters:
- context: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and no rounding is needed.
Return Value:
The absolute value of this object. Signals FlagInvalid and returns quiet NaN if this value is signaling NaN.
public PeterO.Numbers.EFloat Abs();
Finds the absolute value of this object (if it’s negative, it becomes positive).
Return Value:
An arbitrary-precision binary floating-point number. Returns signaling NaN if this value is signaling NaN. (In this sense, this method is similar to the “copy-abs” operation in the General Decimal Arithmetic Specification, except this method does not necessarily return a copy of this object.).
public PeterO.Numbers.EFloat Add( int intValue);
Adds this arbitrary-precision binary floating-point number and a 32-bit signed integer and returns the result. The exponent for the result is the lower of this arbitrary-precision binary floating-point number’s exponent and the other 32-bit signed integer’s exponent.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
The sum of the two numbers, that is, this arbitrary-precision binary floating-point number plus a 32-bit signed integer. If this arbitrary-precision binary floating-point number is not-a-number (NaN), returns NaN.
public PeterO.Numbers.EFloat Add( long longValue);
Adds this arbitrary-precision binary floating-point number and a 64-bit signed integer and returns the result. The exponent for the result is the lower of this arbitrary-precision binary floating-point number’s exponent and the other 64-bit signed integer’s exponent.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The sum of the two numbers, that is, this arbitrary-precision binary floating-point number plus a 64-bit signed integer. If this arbitrary-precision binary floating-point number is not-a-number (NaN), returns NaN.
public PeterO.Numbers.EFloat Add( PeterO.Numbers.EFloat otherValue, PeterO.Numbers.EContext ctx);
Adds this arbitrary-precision binary floating-point number and another arbitrary-precision binary floating-point number and returns the result.
Parameters:
-
otherValue: The number to add to.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and no rounding is needed.
Return Value:
The sum of the two numbers, that is, this arbitrary-precision binary floating-point number plus another arbitrary-precision binary floating-point number. If this arbitrary-precision binary floating-point number is not-a-number (NaN), returns NaN.
public PeterO.Numbers.EFloat Add( PeterO.Numbers.EFloat otherValue);
Adds this arbitrary-precision binary floating-point number and another arbitrary-precision binary floating-point number and returns the result. The exponent for the result is the lower of this arbitrary-precision binary floating-point number’s exponent and the other arbitrary-precision binary floating-point number’s exponent.
Parameters:
- otherValue: An arbitrary-precision binary floating-point number.
Return Value:
The sum of the two numbers, that is, this arbitrary-precision binary floating-point number plus another arbitrary-precision binary floating-point number. If this arbitrary-precision binary floating-point number is not-a-number (NaN), returns NaN.
public int CompareTo( int intOther);
Compares the mathematical values of this object and another object, accepting NaN values. This method currently uses the rules given in the CompareToValue method, so that it it is not consistent with the Equals method, but it may change in a future version to use the rules for the CompareToTotal method instead.
Parameters:
- intOther: The parameter intOther is a 32-bit signed integer.
Return Value:
Less than 0 if this object’s value is less than the other value, or greater than 0 if this object’s value is greater than the other value, or 0 if both values are equal.
public int CompareTo( long intOther);
Compares the mathematical values of this object and another object, accepting NaN values. This method currently uses the rules given in the CompareToValue method, so that it it is not consistent with the Equals method, but it may change in a future version to use the rules for the CompareToTotal method instead.
Parameters:
- intOther: The parameter intOther is a 64-bit signed integer.
Return Value:
Less than 0 if this object’s value is less than the other value, or greater than 0 if this object’s value is greater than the other value, or 0 if both values are equal.
public sealed int CompareTo( PeterO.Numbers.EFloat other);
Compares the mathematical values of this object and another object, accepting NaN values. This method currently uses the rules given in the CompareToValue method, so that it it is not consistent with the Equals method, but it may change in a future version to use the rules for the CompareToTotal method instead.
Parameters:
- other: An arbitrary-precision binary floating-point number.
Return Value:
Less than 0 if this object’s value is less than the other value, or greater than 0 if this object’s value is greater than the other value or if other is null, or 0 if both values are equal.
public PeterO.Numbers.EFloat CompareToSignal( PeterO.Numbers.EFloat other, PeterO.Numbers.EContext ctx);
Compares the mathematical values of this object and another object, treating quiet NaN as signaling. In this method, negative zero and positive zero are considered equal.
If this object or the other object is a quiet NaN or signaling NaN, this method will return a quiet NaN and will signal a FlagInvalid flag.
Parameters:
-
other: An arbitrary-precision binary floating-point number.
-
ctx: An arithmetic context. The precision, rounding, and exponent range are ignored. If
HasFlags
of the context is true, will store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
Return Value:
Quiet NaN if this object or the other object is NaN, or 0 if both objects have the same value, or -1 if this object is less than the other value, or 1 if this object is greater. This implementation returns a positive number if other
is null, to conform to the.NET definition of CompareTo. This is the case even in the Java version of this library, for consistency’s sake, even though implementations of Comparable.compareTo()
in Java ought to throw an exception if they receive a null argument rather than treating null as less or greater than any object.
.
public int CompareToTotal( PeterO.Numbers.EFloat other, PeterO.Numbers.EContext ctx);
Compares the values of this 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:
-
other: An arbitrary-precision binary floating-point number to compare with this one.
-
ctx: An arithmetic context. Flags will be set in this context only if
HasFlags
andIsSimplified
of the context are true and only if an operand needed to be rounded before carrying out the operation. Can be null.
Return Value:
The number 0 if both objects have the same value, or -1 if this object is less than the other value, or 1 if this object is greater. Does not signal flags if either value is signaling NaN. This implementation returns a positive number if other
is null, to conform to the.NET definition of CompareTo. This is the case even in the Java version of this library, for consistency’s sake, even though implementations of Comparable.compareTo()
in Java ought to throw an exception if they receive a null argument rather than treating null as less or greater than any object.
.
public int CompareToTotal( PeterO.Numbers.EFloat other);
Compares the values of this 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:
- other: An arbitrary-precision binary floating-point number to compare with this one.
Return Value:
The number 0 if both objects have the same value, or -1 if this object is less than the other value, or 1 if this object is greater. This implementation returns a positive number if other
is null, to conform to the.NET definition of CompareTo. This is the case even in the Java version of this library, for consistency’s sake, even though implementations of Comparable.compareTo()
in Java ought to throw an exception if they receive a null argument rather than treating null as less or greater than any object.
.
public int CompareToTotalMagnitude( PeterO.Numbers.EFloat other, PeterO.Numbers.EContext ctx);
Compares the values of this object and another object, 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 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:
-
other: An arbitrary-precision binary floating-point number to compare with this one.
-
ctx: An arithmetic context. Flags will be set in this context only if
HasFlags
andIsSimplified
of the context are true and only if an operand needed to be rounded before carrying out the operation. Can be null.
Return Value:
The number 0 if both objects have the same value (ignoring their signs), or -1 if this object is less than the other value (ignoring their signs), or 1 if this object is greater (ignoring their signs). Does not signal flags if either value is signaling NaN. This implementation returns a positive number if other
is null, to conform to the.NET definition of CompareTo. This is the case even in the Java version of this library, for consistency’s sake, even though implementations of Comparable.compareTo()
in Java ought to throw an exception if they receive a null argument rather than treating null as less or greater than any object.
.
public int CompareToTotalMagnitude( PeterO.Numbers.EFloat other);
Compares the absolute values of this object and another object, 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:
- other: An arbitrary-precision binary floating-point number to compare with this one.
Return Value:
The number 0 if both objects have the same value, or -1 if this object is less than the other value, or 1 if this object is greater. This implementation returns a positive number if other
is null, to conform to the.NET definition of CompareTo. This is the case even in the Java version of this library, for consistency’s sake, even though implementations of Comparable.compareTo()
in Java ought to throw an exception if they receive a null argument rather than treating null as less or greater than any object.
.
public int CompareToValue( int intOther);
Compares the mathematical values of this object and another object, accepting NaN values. This method is not consistent with the Equals method because two different numbers with the same mathematical value, but different exponents, will compare as equal.
In this method, negative zero and positive zero are considered equal.
If this object is a quiet NaN or signaling NaN, this method will not trigger an error. Instead, NaN will compare greater than any other number.
Parameters:
- intOther: The parameter intOther is a 32-bit signed integer.
Return Value:
Less than 0 if this object’s value is less than the other value, or greater than 0 if this object’s value is greater than the other value, or 0 if both values are equal.
public int CompareToValue( long intOther);
Compares the mathematical values of this object and another object, accepting NaN values. This method is not consistent with the Equals method because two different numbers with the same mathematical value, but different exponents, will compare as equal.
In this method, negative zero and positive zero are considered equal.
If this object is a quiet NaN or signaling NaN, this method will not trigger an error. Instead, NaN will compare greater than any other number, including infinity.
Parameters:
- intOther: The parameter intOther is a 64-bit signed integer.
Return Value:
Less than 0 if this object’s value is less than the other value, or greater than 0 if this object’s value is greater than the other value, or 0 if both values are equal.
public int CompareToValue( PeterO.Numbers.EFloat other);
Compares the mathematical values of this object and another object, accepting NaN values. This method is not consistent with the Equals method because two different numbers with the same mathematical value, but different exponents, will compare as equal.
In this method, negative zero and positive zero are considered equal.
If this object or the other object is a quiet NaN or signaling NaN, this method will not trigger an error. Instead, NaN will compare greater than any other number, including infinity. Two different NaN values will be considered equal.
Parameters:
- other: An arbitrary-precision binary floating-point number.
Return Value:
Less than 0 if this object’s value is less than the other value, or greater than 0 if this object’s value is greater than the other value or if other is null, or 0 if both values are equal.
public PeterO.Numbers.EFloat CompareToWithContext( PeterO.Numbers.EFloat other, PeterO.Numbers.EContext ctx);
Compares the mathematical values of this object and another object. In this method, negative zero and positive zero are considered equal.
If this object or the other object is a quiet NaN or signaling NaN, this method returns a quiet NaN, and will signal a FlagInvalid flag if either is a signaling NaN.
Parameters:
-
other: An arbitrary-precision binary floating-point number.
-
ctx: An arithmetic context. The precision, rounding, and exponent range are ignored. If
HasFlags
of the context is true, will store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
Return Value:
Quiet NaN if this object or the other object is NaN, or 0 if both objects have the same value, or -1 if this object is less than the other value, or 1 if this object is greater. This implementation returns a positive number if other
is null, to conform to the.NET definition of CompareTo. This is the case even in the Java version of this library, for consistency’s sake, even though implementations of Comparable.compareTo()
in Java ought to throw an exception if they receive a null argument rather than treating null as less or greater than any object.
.
public PeterO.Numbers.EFloat Copy();
Creates a copy of this arbitrary-precision binary number.
Return Value:
An arbitrary-precision binary floating-point number.
public PeterO.Numbers.EFloat CopySign( PeterO.Numbers.EFloat other);
Returns a number with the same value as this one, but copying the sign (positive or negative) of another number. (This method is similar to the “copy-sign” operation in the General Decimal Arithmetic Specification, except this method does not necessarily return a copy of this object.).
Parameters:
- other: A number whose sign will be copied.
Return Value:
An arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter other is null.
public static PeterO.Numbers.EFloat Create( int mantissaSmall, int exponentSmall);
Returns an arbitrary-precision number with the value exponent*2^significand
.
Parameters:
-
mantissaSmall: Desired value for the significand.
-
exponentSmall: Desired value for the exponent.
Return Value:
An arbitrary-precision binary number.
public static PeterO.Numbers.EFloat Create( long mantissaLong, int exponentSmall);
Returns an arbitrary-precision number with the value exponent*2^significand
.
Parameters:
-
mantissaLong: Desired value for the significand.
-
exponentSmall: Desired value for the exponent.
Return Value:
An arbitrary-precision binary number.
public static PeterO.Numbers.EFloat Create( long mantissaLong, long exponentLong);
Returns an arbitrary-precision number with the value exponent*2^significand
.
Parameters:
-
mantissaLong: Desired value for the significand.
-
exponentLong: Desired value for the exponent.
Return Value:
An arbitrary-precision binary number.
public static PeterO.Numbers.EFloat Create( PeterO.Numbers.EInteger mantissa, int exponentSmall);
Returns an arbitrary-precision number with the value exponent*2^significand
.
Parameters:
-
mantissa: Desired value for the significand.
-
exponentSmall: Desired value for the exponent.
Return Value:
An arbitrary-precision binary number.
Exceptions:
- System.ArgumentNullException: The parameter mantissa is null.
public static PeterO.Numbers.EFloat Create( PeterO.Numbers.EInteger mantissa, long exponentLong);
Returns an arbitrary-precision number with the value exponent*2^significand
.
Parameters:
-
mantissa: Desired value for the significand.
-
exponentLong: Desired value for the exponent.
Return Value:
An arbitrary-precision binary number.
Exceptions:
- System.ArgumentNullException: The parameter mantissa is null.
public static PeterO.Numbers.EFloat Create( PeterO.Numbers.EInteger mantissa, PeterO.Numbers.EInteger exponent);
Returns an arbitrary-precision number with the value exponent*2^significand
.
Parameters:
-
mantissa: Desired value for the significand.
-
exponent: Desired value for the exponent.
Return Value:
An arbitrary-precision binary number.
Exceptions:
- System.ArgumentNullException: The parameter mantissa or exponent is null.
public static PeterO.Numbers.EFloat CreateNaN( PeterO.Numbers.EInteger diag, bool signaling, bool negative, PeterO.Numbers.EContext ctx);
Creates a not-a-number arbitrary-precision binary number.
Parameters:
-
diag: An integer, 0 or greater, to use as diagnostic information associated with this object. If none is needed, should be zero. To get the diagnostic information from another arbitrary-precision binary floating-point number, use that object’s
UnsignedMantissa
property. -
signaling: Whether the return value will be signaling (true) or quiet (false).
-
negative: Whether the return value is negative.
-
ctx: An arithmetic context to control the precision (in binary digits) of the diagnostic information. The rounding and exponent range of this context will be ignored. Can be null. The only flag that can be signaled in this context is FlagInvalid, which happens if diagnostic information needs to be truncated and too much memory is required to do so.
Return Value:
An arbitrary-precision binary number.
Exceptions:
- System.ArgumentNullException: The parameter diag is null or is less than 0.
public static PeterO.Numbers.EFloat CreateNaN( PeterO.Numbers.EInteger diag);
Creates a not-a-number arbitrary-precision binary number.
Parameters:
- diag: An integer, 0 or greater, to use as diagnostic information associated with this object. If none is needed, should be zero. To get the diagnostic information from another arbitrary-precision binary floating-point number, use that object’s
UnsignedMantissa
property.
Return Value:
A quiet not-a-number.
public PeterO.Numbers.EFloat Decrement();
Returns one subtracted from this arbitrary-precision binary floating-point number.
Return Value:
The given arbitrary-precision binary floating-point number minus one.
public PeterO.Numbers.EFloat Divide( int intValue);
Divides this arbitrary-precision binary floating-point number by a 32-bit signed integer and returns the result; returns NaN instead if the result would have a nonterminating binary expansion (including 1/3, 1/12, 1/7, 2/3, and so on); if this is not desired, use DivideToExponent, or use the Divide overload that takes an EContext.
Parameters:
- intValue: The divisor.
Return Value:
The result of dividing this arbitrary-precision binary floating-point number by a 32-bit signed integer. Returns infinity if the divisor (this arbitrary-precision binary floating-point number) is 0 and the dividend (the other 32-bit signed integer) is nonzero. Returns not-a-number (NaN) if the divisor and the dividend are 0. Returns NaN if the result can’t be exact because it would have a nonterminating binary expansion (examples include 1 divided by any multiple of 3, such as 1/3 or 1/12). If this is not desired, use DivideToExponent instead, or use the Divide overload that takes an EContext
(such as EContext.Binary64
) instead.
Exceptions:
- System.DivideByZeroException: Attempted to divide by zero.
public PeterO.Numbers.EFloat Divide( long longValue);
Divides this arbitrary-precision binary floating-point number by a 64-bit signed integer and returns the result; returns NaN instead if the result would have a nonterminating binary expansion (including 1/3, 1/12, 1/7, 2/3, and so on); if this is not desired, use DivideToExponent, or use the Divide overload that takes an EContext.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The result of dividing this arbitrary-precision binary floating-point number by a 64-bit signed integer. Returns infinity if the divisor (this arbitrary-precision binary floating-point number) is 0 and the dividend (the other 64-bit signed integer) is nonzero. Returns not-a-number (NaN) if the divisor and the dividend are 0. Returns NaN if the result can’t be exact because it would have a nonterminating binary expansion (examples include 1 divided by any multiple of 3, such as 1/3 or 1/12). If this is not desired, use DivideToExponent instead, or use the Divide overload that takes an EContext
(such as EContext.Binary64
) instead.
Exceptions:
- System.DivideByZeroException: Attempted to divide by zero.
public PeterO.Numbers.EFloat Divide( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Divides this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result.
Parameters:
-
divisor: The number to divide by.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and no rounding is needed.
Return Value:
The result of dividing this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number. Signals FlagDivideByZero and returns infinity if the divisor (this arbitrary-precision binary floating-point number) is 0 and the dividend (the other arbitrary-precision binary floating-point number) is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0; or, either ctx is null or ctx ‘s precision is 0, and the result would have a nonterminating binary expansion (examples include 1 divided by any multiple of 3, such as 1/3 or 1/12); or, the rounding mode is ERounding.None and the result is not exact.
public PeterO.Numbers.EFloat Divide( PeterO.Numbers.EFloat divisor);
Divides this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result; returns NaN instead if the result would have a nonterminating binary expansion (including 1/3, 1/12, 1/7, 2/3, and so on); if this is not desired, use DivideToExponent, or use the Divide overload that takes an EContext.
Parameters:
- divisor: The number to divide by.
Return Value:
The result of dividing this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number. Returns infinity if the divisor (this arbitrary-precision binary floating-point number) is 0 and the dividend (the other arbitrary-precision binary floating-point number) is nonzero. Returns not-a-number (NaN) if the divisor and the dividend are 0. Returns NaN if the result can’t be exact because it would have a nonterminating binary expansion (examples include 1 divided by any multiple of 3, such as 1/3 or 1/12). If this is not desired, use DivideToExponent instead, or use the Divide overload that takes an EContext
(such as EContext.Binary64
) instead.
### DivideAndRemainderNaturalScale
public PeterO.Numbers.EFloat[] DivideAndRemainderNaturalScale( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Obsolete. Renamed to DivRemNaturalScale.
Calculates the quotient and remainder using the DivideToIntegerNaturalScale and the formula in RemainderNaturalScale.
Parameters:
-
divisor: The number to divide by.
-
ctx: An arithmetic context object to control the precision, rounding, and exponent range of the result. This context will be used only in the division portion of the remainder calculation; as a result, it’s possible for the remainder to have a higher precision than given in this context. Flags will be set on the specified context only if the context’s
HasFlags
is true and the integer part of the division result doesn’t fit the precision and exponent range without rounding. Can be null, in which the precision is unlimited and no additional rounding, other than the rounding down to an integer after division, is needed.
Return Value:
A 2 element array consisting of the quotient and remainder in that order.
### DivideAndRemainderNaturalScale
public PeterO.Numbers.EFloat[] DivideAndRemainderNaturalScale( PeterO.Numbers.EFloat divisor);
Obsolete. Renamed to DivRemNaturalScale.
Calculates the quotient and remainder using the DivideToIntegerNaturalScale and the formula in RemainderNaturalScale.
Parameters:
- divisor: The number to divide by.
Return Value:
A 2 element array consisting of the quotient and remainder in that order.
public PeterO.Numbers.EFloat DivideToExponent( PeterO.Numbers.EFloat divisor, long desiredExponentSmall, PeterO.Numbers.EContext ctx);
Divides two arbitrary-precision binary floating-point numbers, and gives a particular exponent to the result.
Parameters:
-
divisor: The number to divide by.
-
desiredExponentSmall: The desired exponent. A negative number places the cutoff point to the right of the usual radix point (so a negative number means the number of binary digit places to round to). A positive number places the cutoff point to the left of the usual radix point.
-
ctx: An arithmetic context object to control the rounding mode to use if the result must be scaled down to have the same exponent as this value. If the precision given in the context is other than 0, calls the Quantize method with both arguments equal to the result of the operation (and can signal FlagInvalid and return NaN if the result doesn’t fit the specified precision). If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
The quotient of the two objects. Signals FlagDivideByZero and returns infinity if the divisor is 0 and the dividend is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0. Signals FlagInvalid and returns not-a-number (NaN) if the context defines an exponent range and the desired exponent is outside that range. Signals FlagInvalid and returns not-a-number (NaN) if the rounding mode is ERounding.None and the result is not exact.
public PeterO.Numbers.EFloat DivideToExponent( PeterO.Numbers.EFloat divisor, long desiredExponentSmall, PeterO.Numbers.ERounding rounding);
Divides two arbitrary-precision binary floating-point numbers, and gives a particular exponent to the result.
Parameters:
-
divisor: The number to divide by.
-
desiredExponentSmall: The desired exponent. A negative number places the cutoff point to the right of the usual radix point (so a negative number means the number of binary digit places to round to). A positive number places the cutoff point to the left of the usual radix point.
-
rounding: The rounding mode to use if the result must be scaled down to have the same exponent as this value.
Return Value:
The quotient of the two objects. Signals FlagDivideByZero and returns infinity if the divisor is 0 and the dividend is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0. Signals FlagInvalid and returns not-a-number (NaN) if the rounding mode is ERounding.None and the result is not exact.
public PeterO.Numbers.EFloat DivideToExponent( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EInteger desiredExponent, PeterO.Numbers.ERounding rounding);
Divides two arbitrary-precision binary floating-point numbers, and gives a particular exponent to the result.
Parameters:
-
divisor: The number to divide by.
-
desiredExponent: The desired exponent. A negative number places the cutoff point to the right of the usual radix point (so a negative number means the number of binary digit places to round to). A positive number places the cutoff point to the left of the usual radix point.
-
rounding: The rounding mode to use if the result must be scaled down to have the same exponent as this value.
Return Value:
The quotient of the two objects. Signals FlagDivideByZero and returns infinity if the divisor is 0 and the dividend is nonzero. Returns not-a-number (NaN) if the divisor and the dividend are 0. Returns NaN if the rounding mode is ERounding.None and the result is not exact.
public PeterO.Numbers.EFloat DivideToExponent( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EInteger exponent, PeterO.Numbers.EContext ctx);
Divides two arbitrary-precision binary floating-point numbers, and gives a particular exponent to the result.
Parameters:
-
divisor: The number to divide by.
-
exponent: The desired exponent. A negative number places the cutoff point to the right of the usual radix point (so a negative number means the number of binary digit places to round to). A positive number places the cutoff point to the left of the usual radix point.
-
ctx: An arithmetic context object to control the rounding mode to use if the result must be scaled down to have the same exponent as this value. If the precision given in the context is other than 0, calls the Quantize method with both arguments equal to the result of the operation (and can signal FlagInvalid and return NaN if the result doesn’t fit the specified precision). If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
The quotient of the two objects. Signals FlagDivideByZero and returns infinity if the divisor is 0 and the dividend is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0. Signals FlagInvalid and returns not-a-number (NaN) if the context defines an exponent range and the desired exponent is outside that range. Signals FlagInvalid and returns not-a-number (NaN) if the rounding mode is ERounding.None and the result is not exact.
### DivideToIntegerNaturalScale
public PeterO.Numbers.EFloat DivideToIntegerNaturalScale( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Divides this object by another object, and returns the integer part of the result (which is initially rounded down), with the preferred exponent set to this value’s exponent minus the divisor’s exponent.
Parameters:
-
divisor: An arbitrary-precision binary floating-point number.
-
ctx: The parameter ctx is an EContext object.
Return Value:
The integer part of the quotient of the two objects. Signals FlagInvalid and returns not-a-number (NaN) if the return value would overflow the exponent range. Signals FlagDivideByZero and returns infinity if the divisor is 0 and the dividend is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0. Signals FlagInvalid and returns not-a-number (NaN) if the rounding mode is ERounding.None and the result is not exact.
### DivideToIntegerNaturalScale
public PeterO.Numbers.EFloat DivideToIntegerNaturalScale( PeterO.Numbers.EFloat divisor);
Divides two arbitrary-precision binary floating-point numbers, and returns the integer part of the result, rounded down, with the preferred exponent set to this value’s exponent minus the divisor’s exponent.
Parameters:
- divisor: The number to divide by.
Return Value:
The integer part of the quotient of the two objects. Signals FlagDivideByZero and returns infinity if the divisor is 0 and the dividend is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0.
public PeterO.Numbers.EFloat DivideToIntegerZeroScale( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Divides this object by another object, and returns the integer part of the result, with the exponent set to 0.
Parameters:
-
divisor: The number to divide by.
-
ctx: An arithmetic context object to control the precision. The rounding and exponent range settings of this context are ignored. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited.
Return Value:
The integer part of the quotient of the two objects. The exponent will be set to 0. Signals FlagDivideByZero and returns infinity if the divisor is 0 and the dividend is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0, or if the result doesn’t fit the specified precision.
public PeterO.Numbers.EFloat DivideToSameExponent( PeterO.Numbers.EFloat divisor, PeterO.Numbers.ERounding rounding);
Divides this object by another binary floating-point number and returns a result with the same exponent as this object (the dividend).
Parameters:
-
divisor: The number to divide by.
-
rounding: The rounding mode to use if the result must be scaled down to have the same exponent as this value.
Return Value:
The quotient of the two numbers. Signals FlagDivideByZero and returns infinity if the divisor is 0 and the dividend is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0. Signals FlagInvalid and returns not-a-number (NaN) if the rounding mode is ERounding.None and the result is not exact.
public PeterO.Numbers.EFloat[] DivRemNaturalScale( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Divides this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns a two-item array containing the result of the division and the remainder, in that order. The result of division is calculated as though by DivideToIntegerNaturalScale
, and the remainder is calculated as though by RemainderNaturalScale
.
Parameters:
-
divisor: The number to divide by.
-
ctx: An arithmetic context object to control the precision, rounding, and exponent range of the result. This context will be used only in the division portion of the remainder calculation; as a result, it’s possible for the remainder to have a higher precision than given in this context. Flags will be set on the specified context only if the context’s
HasFlags
is true and the integer part of the division result doesn’t fit the precision and exponent range without rounding. Can be null, in which the precision is unlimited and no additional rounding, other than the rounding down to an integer after division, is needed.
Return Value:
An array of two items: the first is the result of the division as an arbitrary-precision binary floating-point number, and the second is the remainder as an arbitrary-precision binary floating-point number. The result of division is the result of the method on the two operands, and the remainder is the result of the Remainder method on the two operands.
public PeterO.Numbers.EFloat[] DivRemNaturalScale( PeterO.Numbers.EFloat divisor);
Divides this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns a two-item array containing the result of the division and the remainder, in that order. The result of division is calculated as though by DivideToIntegerNaturalScale
, and the remainder is calculated as though by RemainderNaturalScale
.
Parameters:
- divisor: The number to divide by.
Return Value:
An array of two items: the first is the result of the division as an arbitrary-precision binary floating-point number, and the second is the remainder as an arbitrary-precision binary floating-point number. The result of division is the result of the method on the two operands, and the remainder is the result of the Remainder method on the two operands.
public override bool Equals( object obj);
Determines whether this object’s significand, exponent, and properties are equal to those of another object and that other object is an arbitrary-precision binary floating-point number. Not-a-number values are considered equal if the rest of their properties are equal.
Parameters:
- obj: The parameter obj is an arbitrary object.
Return Value:
true
if the objects are equal; otherwise, false
. In this method, two objects are not equal if they don’t have the same type or if one is null and the other isn’t.
public sealed bool Equals( PeterO.Numbers.EFloat other);
Determines whether this object’s significand, exponent, and properties are equal to those of another object. Not-a-number values are considered equal if the rest of their properties are equal.
Parameters:
- other: An arbitrary-precision binary floating-point number.
Return Value:
true
if this object’s significand and exponent are equal to those of another object; otherwise, false
.
public bool EqualsInternal( PeterO.Numbers.EFloat otherValue);
Determines whether this object’s significand and exponent are equal to those of another object.
Parameters:
- otherValue: An arbitrary-precision binary floating-point number.
Return Value:
true
if this object’s significand and exponent are equal to those of another object; otherwise, false
.
public PeterO.Numbers.EFloat Exp( PeterO.Numbers.EContext ctx);
Finds e (the base of natural logarithms) raised to the power of this object’s value.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). This parameter can’t be null, as the exponential function’s results are generally not exact. (Unlike in the General Binary Arithmetic Specification, any rounding mode is allowed.).
Return Value:
Exponential of this object. If this object’s value is 1, returns an approximation to “ e” within the specified precision. Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0).
public PeterO.Numbers.EFloat ExpM1( PeterO.Numbers.EContext ctx);
Finds e (the base of natural logarithms) raised to the power of this object’s value, and subtracts the result by 1 and returns the final result, in a way that avoids loss of precision if the true result is very close to 0.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). This parameter can’t be null, as the exponential function’s results are generally not exact. (Unlike in the General Binary Arithmetic Specification, any rounding mode is allowed.).
Return Value:
Exponential of this object, minus 1. Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0).
public static PeterO.Numbers.EFloat FromBoolean( bool boolValue);
Converts a Boolean value (either true or false) to an arbitrary-precision binary floating-point number.
Parameters:
- boolValue: Either true or false.
Return Value:
The number 1 if boolValue is true, otherwise, 0.
public static PeterO.Numbers.EFloat FromByte( byte inputByte);
Converts a byte (from 0 to 255) to an arbitrary-precision binary floating-point number.
Parameters:
- inputByte: The number to convert as a byte (from 0 to 255).
Return Value:
This number’s value as an arbitrary-precision binary floating-point number.
public static PeterO.Numbers.EFloat FromDouble( double dbl);
Creates a binary floating-point number from a 64-bit floating-point number. This method computes the exact value of the floating point number, not an approximation, as is often the case by converting the floating point number to a string first. The input value can be a not-a-number (NaN) value (such as Double.NaN
); however, NaN values have multiple forms that are equivalent for many applications’ purposes, and Double.NaN
is only one of these equivalent forms. In fact, EFloat.FromDouble(Double.NaN)
could produce an object that is represented differently between DotNet and Java, because Double.NaN
may have a different form in DotNet and Java (for example, the NaN value’s sign may be negative in DotNet, but positive in Java). Use IsNaN()
to determine whether an object from this class stores a NaN value of any form.
Parameters:
- dbl: The parameter dbl is a 64-bit floating-point number.
Return Value:
A binary floating-point number with the same value as dbl .
public static PeterO.Numbers.EFloat FromDoubleBits( long dblBits);
Creates a binary floating-point number from a 64-bit floating-point number encoded in the IEEE 754 binary64 format. This method computes the exact value of the floating point number, not an approximation, as is often the case by converting the floating point number to a string first.
Parameters:
- dblBits: The parameter dblBits is a 64-bit signed integer.
Return Value:
A binary floating-point number with the same value as the floating-point number encoded in dblBits .
public static PeterO.Numbers.EFloat FromEInteger( PeterO.Numbers.EInteger bigint);
Converts an arbitrary-precision integer to the same value as a binary floating-point number.
Parameters:
- bigint: An arbitrary-precision integer.
Return Value:
An arbitrary-precision binary floating-point number.
public static PeterO.Numbers.EFloat FromHalfBits( short value);
Creates a binary floating-point number from a binary floating-point number encoded in the IEEE 754 binary16 format (also known as a “half-precision” floating-point number). This method computes the exact value of the floating point number, not an approximation, as is often the case by converting the floating point number to a string first.
Parameters:
- value: A binary floating-point number encoded in the IEEE 754 binary16 format.
Return Value:
A binary floating-point number with the same floating-point value as value .
public static PeterO.Numbers.EFloat FromInt16( short inputInt16);
Converts a 16-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputInt16: The number to convert as a 16-bit signed integer.
Return Value:
This number’s value as an arbitrary-precision binary floating-point number.
public static PeterO.Numbers.EFloat FromInt32( int inputInt32);
Converts a 32-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputInt32: The number to convert as a 32-bit signed integer.
Return Value:
This number’s value as an arbitrary-precision binary floating-point number.
public static PeterO.Numbers.EFloat FromInt64( long inputInt64);
Converts a 64-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputInt64: The number to convert as a 64-bit signed integer.
Return Value:
This number’s value as an arbitrary-precision binary floating-point number with the exponent set to 0.
public static PeterO.Numbers.EFloat FromInt64AsUnsigned( long longerValue);
Converts an unsigned integer expressed as a 64-bit signed integer to an arbitrary-precision binary number.
Parameters:
- longerValue: A 64-bit signed integer. If this value is 0 or greater, the return value will represent it. If this value is less than 0, the return value will store 2^64 plus this value instead.
Return Value:
An arbitrary-precision binary number with the exponent set to 0. If longerValue is 0 or greater, the return value will represent it. If longerValue is less than 0, the return value will store 2^64 plus this value instead.
public static PeterO.Numbers.EFloat FromSByte( sbyte inputSByte);
This API is not CLS-compliant.
Converts an 8-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputSByte: The number to convert as an 8-bit signed integer.
Return Value:
This number’s value as an arbitrary-precision binary floating-point number.
public static PeterO.Numbers.EFloat FromSingle( float flt);
Creates a binary floating-point number from a 32-bit floating-point number. This method computes the exact value of the floating point number, not an approximation, as is often the case by converting the floating point number to a string first. The input value can be a not-a-number (NaN) value (such as Single.NaN
in DotNet or Float.NaN in Java); however, NaN values have multiple forms that are equivalent for many applications’ purposes, and Single.NaN
/ Float.NaN
is only one of these equivalent forms. In fact, EFloat.FromSingle(Single.NaN)
or EFloat.FromSingle(Float.NaN)
could produce an object that is represented differently between DotNet and Java, because Single.NaN
/ Float.NaN
may have a different form in DotNet and Java (for example, the NaN value’s sign may be negative in DotNet, but positive in Java). Use IsNaN()
to determine whether an object from this class stores a NaN value of any form.
Parameters:
- flt: The parameter flt is a 64-bit floating-point number.
Return Value:
A binary floating-point number with the same value as flt .
public static PeterO.Numbers.EFloat FromSingleBits( int value);
Creates a binary floating-point number from a 32-bit floating-point number encoded in the IEEE 754 binary32 format. This method computes the exact value of the floating point number, not an approximation, as is often the case by converting the floating point number to a string first.
Parameters:
- value: A 32-bit binary floating-point number encoded in the IEEE 754 binary32 format.
Return Value:
A binary floating-point number with the same floating-point value as value .
public static PeterO.Numbers.EFloat FromString( byte[] bytes, int offset, int length, PeterO.Numbers.EContext ctx);
Creates a binary floating-point number from a sequence of bytes that represents a number. Note that if the sequence contains a negative exponent, the resulting value might not be exact, in which case the resulting binary floating-point number will be an approximation of this decimal number’s value. The format of the sequence generally consists of:
-
An optional plus sign (“+” , U+002B) or minus sign (“-“, U+002D) (if ‘-‘ , the value is negative.)
-
One or more digits, with a single optional decimal point (“.”, U+002E) before or after those digits or between two of them. These digits may begin with any number of zeros.
-
Optionally, “E+”/”e+” (positive exponent) or “E-“/”e-“ (negative exponent) plus one or more digits specifying the exponent (these digits may begin with any number of zeros).
The sequence can also be “-INF”, “-Infinity”, “Infinity”, “INF”, quiet NaN (“NaN”) followed by any number of digits (these digits may begin with any number of zeros), or signaling NaN (“sNaN”) followed by any number of digits (these digits may begin with any number of zeros), all where the letters can be any combination of basic uppercase and basic lowercase letters.
All characters mentioned earlier are the corresponding characters in the Basic Latin range. In particular, the digits must be the basic digits 0 to 9 (U+0030 to U+0039). The sequence is not allowed to contain white space characters, including spaces.
Parameters:
-
bytes: A sequence of bytes to convert to a binary floating-point number.
-
offset: An index starting at 0 showing where the desired portion of bytes begins.
-
length: The length, in code units, of the desired portion of bytes (but not more than bytes ‘s length).
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited. Note that providing a context is often much faster than creating an EDecimal without a context then calling ToEFloat on that EDecimal, especially if the context specifies a precision limit and exponent range.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
-
System.ArgumentNullException: The parameter bytes is null.
-
System.FormatException: The portion given of bytes is not a correctly formatted number sequence; or either offset or length is less than 0 or greater than bytes ‘s length, or bytes ‘s length minus offset is less than length .
public static PeterO.Numbers.EFloat FromString( byte[] bytes, int offset, int length);
Creates a binary floating-point number from a sequence of bytes that represents a number. For more information, see the FromString(String, int, int, EContext)
method.
Parameters:
-
bytes: A sequence of bytes to convert to a binary floating-point number.
-
offset: An index starting at 0 showing where the desired portion of bytes begins.
-
length: The length, in code units, of the desired portion of bytes (but not more than bytes ‘s length).
Return Value:
An arbitrary-precision binary floating-point number.
Exceptions:
-
System.ArgumentNullException: The parameter bytes is null.
-
System.ArgumentException: Either offset or length is less than 0 or greater than bytes ‘s length, or bytes ‘s length minus offset is less than length .
public static PeterO.Numbers.EFloat FromString( byte[] bytes, PeterO.Numbers.EContext ctx);
Creates a binary floating-point number from a sequence of bytes that represents a number. For more information, see the FromString(String, int, int, EContext)
method.
Parameters:
-
bytes: A sequence of bytes to convert to a binary floating-point number.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited. Note that providing a context is often much faster than creating an EDecimal without a context then calling ToEFloat on that EDecimal, especially if the context specifies a precision limit and exponent range.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter bytes is null.
public static PeterO.Numbers.EFloat FromString( byte[] bytes);
Creates a binary floating-point number from a sequence of bytes that represents a number, using an unlimited precision context. For more information, see the FromString(String, int,
int, EContext)
method.
Parameters:
- bytes: A sequence of bytes to convert to a binary floating-point number.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
-
System.ArgumentNullException: The parameter bytes is null.
-
System.FormatException: The portion given of bytes is not a correctly formatted number sequence.
public static PeterO.Numbers.EFloat FromString( char[] chars, int offset, int length, PeterO.Numbers.EContext ctx);
Creates a binary floating-point number from a sequence of char
s that represents a number. Note that if the sequence contains a negative exponent, the resulting value might not be exact, in which case the resulting binary floating-point number will be an approximation of this decimal number’s value. The format of the sequence generally consists of:
-
An optional plus sign (“+” , U+002B) or minus sign (“-“, U+002D) (if ‘-‘ , the value is negative.)
-
One or more digits, with a single optional decimal point (“.”, U+002E) before or after those digits or between two of them. These digits may begin with any number of zeros.
-
Optionally, “E+”/”e+” (positive exponent) or “E-“/”e-“ (negative exponent) plus one or more digits specifying the exponent (these digits may begin with any number of zeros).
The sequence can also be “-INF”, “-Infinity”, “Infinity”, “INF”, quiet NaN (“NaN”) followed by any number of digits (these digits may begin with any number of zeros), or signaling NaN (“sNaN”) followed by any number of digits (these digits may begin with any number of zeros), all where the letters can be any combination of basic uppercase and basic lowercase letters.
All characters mentioned earlier are the corresponding characters in the Basic Latin range. In particular, the digits must be the basic digits 0 to 9 (U+0030 to U+0039). The sequence is not allowed to contain white space characters, including spaces.
Parameters:
-
chars: A sequence of
char
s to convert to a binary floating-point number. -
offset: An index starting at 0 showing where the desired portion of chars begins.
-
length: The length, in code units, of the desired portion of chars (but not more than chars ‘s length).
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited. Note that providing a context is often much faster than creating an EDecimal without a context then calling ToEFloat on that EDecimal, especially if the context specifies a precision limit and exponent range.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
-
System.ArgumentNullException: The parameter chars is null.
-
System.FormatException: The portion given of chars is not a correctly formatted number sequence; or either offset or length is less than 0 or greater than chars ‘s length, or chars ‘s length minus offset is less than length .
public static PeterO.Numbers.EFloat FromString( char[] chars, int offset, int length);
Creates a binary floating-point number from a sequence of char
s that represents a number. For more information, see the FromString(String, int, int, EContext)
method.
Parameters:
-
chars: A sequence of
char
s to convert to a binary floating-point number. -
offset: An index starting at 0 showing where the desired portion of chars begins.
-
length: The length, in code units, of the desired portion of chars (but not more than chars ‘s length).
Return Value:
An arbitrary-precision binary floating-point number.
Exceptions:
-
System.ArgumentNullException: The parameter chars is null.
-
System.ArgumentException: Either offset or length is less than 0 or greater than chars ‘s length, or chars ‘s length minus offset is less than length .
public static PeterO.Numbers.EFloat FromString( char[] chars, PeterO.Numbers.EContext ctx);
Creates a binary floating-point number from a sequence of char
s that represents a number. For more information, see the FromString(String, int, int, EContext)
method.
Parameters:
-
chars: A sequence of
char
s to convert to a binary floating-point number. -
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited. Note that providing a context is often much faster than creating an EDecimal without a context then calling ToEFloat on that EDecimal, especially if the context specifies a precision limit and exponent range.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter chars is null.
public static PeterO.Numbers.EFloat FromString( char[] chars);
Creates a binary floating-point number from a sequence of char
s that represents a number, using an unlimited precision context. For more information, see the FromString(String, int, int, EContext)
method.
Parameters:
- chars: A sequence of
char
s to convert to a binary floating-point number.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
-
System.ArgumentNullException: The parameter chars is null.
-
System.FormatException: The portion given of chars is not a correctly formatted number sequence.
public static PeterO.Numbers.EFloat FromString( string str, int offset, int length, PeterO.Numbers.EContext ctx);
Creates a binary floating-point number from a text string that represents a number. Note that if the string contains a negative exponent, the resulting value might not be exact, in which case the resulting binary floating-point number will be an approximation of this decimal number’s value. The format of the string generally consists of:
-
An optional plus sign (“+” , U+002B) or minus sign (“-“, U+002D) (if ‘-‘ , the value is negative.)
-
One or more digits, with a single optional decimal point (“.”, U+002E) before or after those digits or between two of them. These digits may begin with any number of zeros.
-
Optionally, “E+”/”e+” (positive exponent) or “E-“/”e-“ (negative exponent) plus one or more digits specifying the exponent (these digits may begin with any number of zeros).
The string can also be “-INF”, “-Infinity”, “Infinity”, “INF”, quiet NaN (“NaN”) followed by any number of digits (these digits may begin with any number of zeros), or signaling NaN (“sNaN”) followed by any number of digits (these digits may begin with any number of zeros), all where the letters can be any combination of basic uppercase and basic lowercase letters.
All characters mentioned earlier are the corresponding characters in the Basic Latin range. In particular, the digits must be the basic digits 0 to 9 (U+0030 to U+0039). The string is not allowed to contain white space characters, including spaces.
Parameters:
-
str: The parameter str is a text string.
-
offset: An index starting at 0 showing where the desired portion of str begins.
-
length: The length, in code units, of the desired portion of str (but not more than str ‘s length).
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited. Note that providing a context is often much faster than creating an EDecimal without a context then calling ToEFloat on that EDecimal, especially if the context specifies a precision limit and exponent range.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
-
System.ArgumentNullException: The parameter str is null.
-
System.FormatException: The portion given of str is not a correctly formatted number string; or either offset or length is less than 0 or greater than str ‘s length, or str ‘s length minus offset is less than length .
public static PeterO.Numbers.EFloat FromString( string str, int offset, int length);
Creates a binary floating-point number from a text string that represents a number. For more information, see the FromString(String, int, int, EContext)
method.
Parameters:
-
str: The parameter str is a text string.
-
offset: An index starting at 0 showing where the desired portion of str begins.
-
length: The length, in code units, of the desired portion of str (but not more than str ‘s length).
Return Value:
An arbitrary-precision binary floating-point number.
Exceptions:
-
T:System.ArgumentException: Either offset or length is less than 0 or greater than str ‘s length, or str ‘s length minus offset is less than length .
-
System.ArgumentNullException: The parameter str is null.
-
System.ArgumentException: Either offset or length is less than 0 or greater than str ‘s length, or str ‘s length minus offset is less than length .
public static PeterO.Numbers.EFloat FromString( string str, PeterO.Numbers.EContext ctx);
Creates a binary floating-point number from a text string that represents a number. For more information, see the FromString(String, int, int, EContext)
method.
Parameters:
-
str: A text string to convert to a binary floating-point number.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited. Note that providing a context is often much faster than creating an EDecimal without a context then calling ToEFloat on that EDecimal, especially if the context specifies a precision limit and exponent range.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter str is null.
public static PeterO.Numbers.EFloat FromString( string str);
Creates a binary floating-point number from a text string that represents a number, using an unlimited precision context. For more information, see the FromString(String, int, int,
EContext)
method.
Parameters:
- str: A text string to convert to a binary floating-point number.
Return Value:
The parsed number, converted to arbitrary-precision binary floating-point number.
Exceptions:
-
System.ArgumentNullException: The parameter str is null.
-
System.FormatException: The portion given of str is not a correctly formatted number string.
public static PeterO.Numbers.EFloat FromUInt16( ushort inputUInt16);
This API is not CLS-compliant.
Converts a 16-bit unsigned integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputUInt16: The number to convert as a 16-bit unsigned integer.
Return Value:
This number’s value as an arbitrary-precision binary floating-point number.
public static PeterO.Numbers.EFloat FromUInt32( uint inputUInt32);
This API is not CLS-compliant.
Converts a 32-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputUInt32: The number to convert as a 32-bit signed integer.
Return Value:
This number’s value as an arbitrary-precision binary floating-point number.
public static PeterO.Numbers.EFloat FromUInt64( ulong inputUInt64);
This API is not CLS-compliant.
Converts a 64-bit unsigned integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputUInt64: The number to convert as a 64-bit unsigned integer.
Return Value:
This number’s value as an arbitrary-precision binary floating-point number.
public override int GetHashCode();
Calculates this object’s hash code. No application or process IDs are used in the hash code calculation.
Return Value:
A 32-bit signed integer.
public PeterO.Numbers.EFloat Increment();
Returns one added to this arbitrary-precision binary floating-point number.
Return Value:
The given arbitrary-precision binary floating-point number plus one.
public bool IsInfinity();
Gets a value indicating whether this object is positive or negative infinity.
Return Value:
true
if this object is positive or negative infinity; otherwise, false
.
public bool IsInteger();
Returns whether this object’s value is an integer.
Return Value:
true
if this object’s value is an integer; otherwise, false
.
public bool IsNaN();
Gets a value indicating whether this object is not a number (NaN).
Return Value:
true
if this object is not a number (NaN); otherwise, false
.
public bool IsNegativeInfinity();
Returns whether this object is negative infinity.
Return Value:
true
if this object is negative infinity; otherwise, false
.
public bool IsPositiveInfinity();
Returns whether this object is positive infinity.
Return Value:
true
if this object is positive infinity; otherwise, false
.
public bool IsQuietNaN();
Gets a value indicating whether this object is a quiet not-a-number value.
Return Value:
true
if this object is a quiet not-a-number value; otherwise, false
.
public bool IsSignalingNaN();
Gets a value indicating whether this object is a signaling not-a-number value.
Return Value:
true
if this object is a signaling not-a-number value; otherwise, false
.
public PeterO.Numbers.EFloat Log( PeterO.Numbers.EContext ctx);
Finds the natural logarithm of this object, that is, the power (exponent) that e (the base of natural logarithms) must be raised to in order to equal this object’s value.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). This parameter can’t be null, as the ln function’s results are generally not exact. (Unlike in the General Binary Arithmetic Specification, any rounding mode is allowed.).
Return Value:
Ln(this object). Signals the flag FlagInvalid and returns NaN if this object is less than 0 (the result would be a complex number with a real part equal to Ln of this object’s absolute value and an imaginary part equal to pi, but the return value is still NaN.). Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0). Signals no flags and returns negative infinity if this object’s value is 0.
public PeterO.Numbers.EFloat Log10( PeterO.Numbers.EContext ctx);
Finds the base-10 logarithm of this object, that is, the power (exponent) that the number 10 must be raised to in order to equal this object’s value.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). This parameter can’t be null, as the ln function’s results are generally not exact. (Unlike in the General Binary Arithmetic Specification, any rounding mode is allowed.).
Return Value:
Ln(this object)/Ln(10). Signals the flag FlagInvalid and returns not-a-number (NaN) if this object is less than 0. Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0).
public PeterO.Numbers.EFloat Log1P( PeterO.Numbers.EContext ctx);
Adds 1 to this object’s value and finds the natural logarithm of the result, in a way that avoids loss of precision when this object’s value is between 0 and 1.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). This parameter can’t be null, as the ln function’s results are generally not exact. (Unlike in the General Binary Arithmetic Specification, any rounding mode is allowed.).
Return Value:
Ln(1+(this object)). Signals the flag FlagInvalid and returns NaN if this object is less than -1 (the result would be a complex number with a real part equal to Ln of 1 plus this object’s absolute value and an imaginary part equal to pi, but the return value is still NaN.). Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0). Signals no flags and returns negative infinity if this object’s value is 0.
public PeterO.Numbers.EFloat LogN( PeterO.Numbers.EFloat baseValue, PeterO.Numbers.EContext ctx);
Finds the base-N logarithm of this object, that is, the power (exponent) that the number N must be raised to in order to equal this object’s value.
Parameters:
-
baseValue: The parameter baseValue is a Numbers.EFloat object.
-
ctx: The parameter ctx is a Numbers.EContext object.
Return Value:
Ln(this object)/Ln(baseValue). Signals the flag FlagInvalid and returns not-a-number (NaN) if this object is less than 0. Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0).
Exceptions:
- System.ArgumentNullException: The parameter baseValue is null.
public static PeterO.Numbers.EFloat Max( PeterO.Numbers.EFloat first, PeterO.Numbers.EFloat second, PeterO.Numbers.EContext ctx);
Gets the greater value between two binary floating-point numbers.
Parameters:
-
first: The first value to compare.
-
second: The second value to compare.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
The larger value of the two numbers. If one is positive zero and the other is negative zero, returns the positive zero. If the two numbers are positive and have the same value, returns the one with the larger exponent. If the two numbers are negative and have the same value, returns the one with the smaller exponent.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EFloat Max( PeterO.Numbers.EFloat first, PeterO.Numbers.EFloat second);
Gets the greater value between two binary floating-point numbers.
Parameters:
-
first: The first value to compare.
-
second: The second value to compare.
Return Value:
The larger value of the two numbers. If one is positive zero and the other is negative zero, returns the positive zero. If the two numbers are positive and have the same value, returns the one with the larger exponent. If the two numbers are negative and have the same value, returns the one with the smaller exponent.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EFloat MaxMagnitude( PeterO.Numbers.EFloat first, PeterO.Numbers.EFloat second, PeterO.Numbers.EContext ctx);
Gets the greater value between two values, ignoring their signs. If the absolute values are equal, has the same effect as Max.
Parameters:
-
first: The first value to compare.
-
second: The second value to compare.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
The larger value of the two numbers, ignoring their signs.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EFloat MaxMagnitude( PeterO.Numbers.EFloat first, PeterO.Numbers.EFloat second);
Gets the greater value between two values, ignoring their signs. If the absolute values are equal, has the same effect as Max.
Parameters:
-
first: The first value to compare.
-
second: The second value to compare.
Return Value:
The larger value of the two numbers, ignoring their signs.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EFloat Min( PeterO.Numbers.EFloat first, PeterO.Numbers.EFloat second, PeterO.Numbers.EContext ctx);
Gets the lesser value between two binary floating-point numbers.
Parameters:
-
first: The first value to compare.
-
second: The second value to compare.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
The smaller value of the two numbers. If one is positive zero and the other is negative zero, returns the negative zero. If the two numbers are positive and have the same value, returns the one with the smaller exponent. If the two numbers are negative and have the same value, returns the one with the larger exponent.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EFloat Min( PeterO.Numbers.EFloat first, PeterO.Numbers.EFloat second);
Gets the lesser value between two binary floating-point numbers.
Parameters:
-
first: The first value to compare.
-
second: The second value to compare.
Return Value:
The smaller value of the two numbers. If one is positive zero and the other is negative zero, returns the negative zero. If the two numbers are positive and have the same value, returns the one with the smaller exponent. If the two numbers are negative and have the same value, returns the one with the larger exponent.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EFloat MinMagnitude( PeterO.Numbers.EFloat first, PeterO.Numbers.EFloat second, PeterO.Numbers.EContext ctx);
Gets the lesser value between two values, ignoring their signs. If the absolute values are equal, has the same effect as Min.
Parameters:
-
first: The first value to compare.
-
second: The second value to compare.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
The smaller value of the two numbers, ignoring their signs.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EFloat MinMagnitude( PeterO.Numbers.EFloat first, PeterO.Numbers.EFloat second);
Gets the lesser value between two values, ignoring their signs. If the absolute values are equal, has the same effect as Min.
Parameters:
-
first: The first value to compare.
-
second: The second value to compare.
Return Value:
The smaller value of the two numbers, ignoring their signs.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public PeterO.Numbers.EFloat MovePointLeft( int places, PeterO.Numbers.EContext ctx);
Returns a number similar to this number but with the radix point moved to the left.
Parameters:
-
places: The number of binary digit places to move the radix point to the left. If this number is negative, instead moves the radix point to the right by this number’s absolute value.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
A number whose exponent is decreased by places , but not to more than 0.
public PeterO.Numbers.EFloat MovePointLeft( int places);
Returns a number similar to this number but with the radix point moved to the left.
Parameters:
- places: The number of binary digit places to move the radix point to the left. If this number is negative, instead moves the radix point to the right by this number’s absolute value.
Return Value:
A number whose exponent is decreased by places , but not to more than 0.
public PeterO.Numbers.EFloat MovePointLeft( PeterO.Numbers.EInteger bigPlaces, PeterO.Numbers.EContext ctx);
Returns a number similar to this number but with the radix point moved to the left.
Parameters:
-
bigPlaces: The number of binary digit places to move the radix point to the left. If this number is negative, instead moves the radix point to the right by this number’s absolute value.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
A number whose exponent is decreased by bigPlaces , but not to more than 0.
public PeterO.Numbers.EFloat MovePointLeft( PeterO.Numbers.EInteger bigPlaces);
Returns a number similar to this number but with the radix point moved to the left.
Parameters:
- bigPlaces: The number of binary digit places to move the radix point to the left. If this number is negative, instead moves the radix point to the right by this number’s absolute value.
Return Value:
A number whose exponent is decreased by bigPlaces , but not to more than 0.
public PeterO.Numbers.EFloat MovePointRight( int places, PeterO.Numbers.EContext ctx);
Returns a number similar to this number but with the radix point moved to the right.
Parameters:
-
places: The number of binary digit places to move the radix point to the right. If this number is negative, instead moves the radix point to the left by this number’s absolute value.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
A number whose exponent is increased by places , but not to more than 0.
public PeterO.Numbers.EFloat MovePointRight( int places);
Returns a number similar to this number but with the radix point moved to the right.
Parameters:
- places: The number of binary digit places to move the radix point to the right. If this number is negative, instead moves the radix point to the left by this number’s absolute value.
Return Value:
A number whose exponent is increased by places , but not to more than 0.
public PeterO.Numbers.EFloat MovePointRight( PeterO.Numbers.EInteger bigPlaces, PeterO.Numbers.EContext ctx);
Returns a number similar to this number but with the radix point moved to the right.
Parameters:
-
bigPlaces: The number of binary digit places to move the radix point to the right. If this number is negative, instead moves the radix point to the left by this number’s absolute value.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
A number whose exponent is increased by bigPlaces , but not to more than 0.
public PeterO.Numbers.EFloat MovePointRight( PeterO.Numbers.EInteger bigPlaces);
Returns a number similar to this number but with the radix point moved to the right.
Parameters:
- bigPlaces: The number of binary digit places to move the radix point to the right. If this number is negative, instead moves the radix point to the left by this number’s absolute value.
Return Value:
A number whose exponent is increased by bigPlaces , but not to more than 0.
public PeterO.Numbers.EFloat Multiply( int intValue);
Multiplies this arbitrary-precision binary floating-point number by a 32-bit signed integer and returns the result. The exponent for the result is this arbitrary-precision binary floating-point number’s exponent plus the other 32-bit signed integer’s exponent.
EInteger result = EInteger.FromString("5").Multiply(200);
.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
The product of the two numbers, that is, this arbitrary-precision binary floating-point number times a 32-bit signed integer.
public PeterO.Numbers.EFloat Multiply( long longValue);
Multiplies this arbitrary-precision binary floating-point number by a 64-bit signed integer and returns the result. The exponent for the result is this arbitrary-precision binary floating-point number’s exponent plus the other 64-bit signed integer’s exponent.
EInteger result = EInteger.FromString("5").Multiply(200L);
.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The product of the two numbers, that is, this arbitrary-precision binary floating-point number times a 64-bit signed integer.
public PeterO.Numbers.EFloat Multiply( PeterO.Numbers.EFloat op, PeterO.Numbers.EContext ctx);
Multiplies this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result.
Parameters:
-
op: Another binary floating-point number.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
The product of the two numbers, that is, this arbitrary-precision binary floating-point number times another arbitrary-precision binary floating-point number.
public PeterO.Numbers.EFloat Multiply( PeterO.Numbers.EFloat otherValue);
Multiplies this arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result. The exponent for the result is this arbitrary-precision binary floating-point number’s exponent plus the other arbitrary-precision binary floating-point number’s exponent.
Parameters:
- otherValue: Another binary floating-point number.
Return Value:
The product of the two numbers, that is, this arbitrary-precision binary floating-point number times another arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter otherValue is null.
public PeterO.Numbers.EFloat MultiplyAndAdd( PeterO.Numbers.EFloat multiplicand, PeterO.Numbers.EFloat augend);
Multiplies by one binary floating-point number, and then adds another binary floating-point number.
Parameters:
-
multiplicand: The value to multiply.
-
augend: The value to add.
Return Value:
An arbitrary-precision binary floating-point number.
public PeterO.Numbers.EFloat MultiplyAndAdd( PeterO.Numbers.EFloat op, PeterO.Numbers.EFloat augend, PeterO.Numbers.EContext ctx);
Multiplies by one value, and then adds another value.
Parameters:
-
op: The value to multiply.
-
augend: The value to add.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed. If the precision doesn’t indicate a simplified arithmetic, rounding and precision/exponent adjustment is done only once, namely, after multiplying and adding.
Return Value:
The result thisValue * multiplicand + augend.
public PeterO.Numbers.EFloat MultiplyAndSubtract( PeterO.Numbers.EFloat op, PeterO.Numbers.EFloat subtrahend, PeterO.Numbers.EContext ctx);
Multiplies by one value, and then subtracts another value.
Parameters:
-
op: The value to multiply.
-
subtrahend: The value to subtract.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed. If the precision doesn’t indicate a simplified arithmetic, rounding and precision/exponent adjustment is done only once, namely, after multiplying and subtracting.
Return Value:
The result thisValue * multiplicand - subtrahend.
Exceptions:
- System.ArgumentNullException: The parameter op or subtrahend is null.
public PeterO.Numbers.EFloat Negate( PeterO.Numbers.EContext context);
Returns a binary floating-point number with the same value as this object but with the sign reversed.
Parameters:
- context: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
An arbitrary-precision binary floating-point number. If this value is positive zero, returns positive zero. Signals FlagInvalid and returns quiet NaN if this value is signaling NaN.
public PeterO.Numbers.EFloat Negate();
Gets an object with the same value as this one, but with the sign reversed.
Return Value:
An arbitrary-precision binary floating-point number. If this value is positive zero, returns negative zero. Returns signaling NaN if this value is signaling NaN. (In this sense, this method is similar to the “copy-negate” operation in the General Decimal Arithmetic Specification, except this method does not necessarily return a copy of this object.).
public PeterO.Numbers.EFloat NextMinus( PeterO.Numbers.EContext ctx);
Finds the largest value that’s smaller than the specified value.
Parameters:
- ctx: An arithmetic context object to control the precision and exponent range of the result. The rounding mode from this context is ignored. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags).
Return Value:
Returns the largest value that’s less than the specified value. Returns negative infinity if the result is negative infinity. Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null, the precision is 0, or ctx has an unlimited exponent range.
public PeterO.Numbers.EFloat NextPlus( PeterO.Numbers.EContext ctx);
Finds the smallest value that’s greater than the specified value.
Parameters:
- ctx: An arithmetic context object to control the precision and exponent range of the result. The rounding mode from this context is ignored. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags).
Return Value:
Returns the smallest value that’s greater than the specified value.Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null, the precision is 0, or ctx has an unlimited exponent range.
public PeterO.Numbers.EFloat NextToward( PeterO.Numbers.EFloat otherValue, PeterO.Numbers.EContext ctx);
Finds the next value that is closer to the other object’s value than this object’s value. Returns a copy of this value with the same sign as the other value if both values are equal.
Parameters:
-
otherValue: An arbitrary-precision binary floating-point number that the return value will approach.
-
ctx: An arithmetic context object to control the precision and exponent range of the result. The rounding mode from this context is ignored. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags).
Return Value:
Returns the next value that is closer to the other object’ s value than this object’s value. Signals FlagInvalid and returns NaN if the parameter ctx is null, the precision is 0, or ctx has an unlimited exponent range.
public static PeterO.Numbers.EFloat operator +( PeterO.Numbers.EFloat bthis, PeterO.Numbers.EFloat otherValue);
Adds an arbitrary-precision binary floating-point number and another arbitrary-precision binary floating-point number and returns the result.
Parameters:
-
bthis: The first arbitrary-precision binary floating-point number.
-
otherValue: The second arbitrary-precision binary floating-point number.
Return Value:
The sum of the two numbers, that is, an arbitrary-precision binary floating-point number plus another arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter bthis or otherValue is null.
public static PeterO.Numbers.EFloat operator --( PeterO.Numbers.EFloat bthis);
Subtracts one from an arbitrary-precision binary floating-point number.
Parameters:
- bthis: An arbitrary-precision binary floating-point number.
Return Value:
The number given in bthis minus one.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static PeterO.Numbers.EFloat operator /( PeterO.Numbers.EFloat dividend, PeterO.Numbers.EFloat divisor);
Divides one binary floating-point number by another and returns the result. When possible, the result will be exact.
Parameters:
-
dividend: The number that will be divided by the divisor.
-
divisor: The number to divide by.
Return Value:
The quotient of the two numbers. Returns infinity if the divisor is 0 and the dividend is nonzero. Returns not-a-number (NaN) if the divisor and the dividend are 0. Returns NaN if the result can’t be exact because it would have a nonterminating binary expansion. If this is not desired, use DivideToExponent instead, or use the Divide overload that takes an EContext instead.
Exceptions:
- System.ArgumentNullException: The parameter dividend is null.
public static explicit operator byte( PeterO.Numbers.EFloat input);
Converts an arbitrary-precision binary floating-point number to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255) after converting it to an integer by discarding its fractional part.
Parameters:
- input: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The value of input , truncated to a byte (from 0 to 255).
Exceptions:
-
System.OverflowException: The parameter input is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than 0 or greater than 255.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator double( PeterO.Numbers.EFloat bigValue);
Converts this value to its closest equivalent as a 64-bit floating-point number. The half-even rounding mode is used. If this value is a NaN, sets the high bit of the 64-bit floating point number’s significand area for a quiet NaN, and clears it for a signaling NaN. Then the other bits of the significand area are set to the lowest bits of this object’s unsigned significand, and the next-highest bit of the significand area is set if those bits are all zeros and this is a signaling NaN. Unfortunately, in the.NET implementation, the return value of this method may be a quiet NaN even if a signaling NaN would otherwise be generated.
Parameters:
- bigValue: The value to convert to a 64-bit floating-point number.
Return Value:
The closest 64-bit floating-point number to this value. The return value can be positive infinity or negative infinity if this value exceeds the range of a 64-bit floating point number.
Exceptions:
- System.ArgumentNullException: The parameter bigValue is null.
public static explicit operator float( PeterO.Numbers.EFloat bigValue);
Converts an arbitrary-precision binary floating-point number to its closest equivalent as a 32-bit floating-point number. The half-even rounding mode is used. If this value is a NaN, sets the high bit of the 32-bit floating point number’s significand area for a quiet NaN, and clears it for a signaling NaN. Then the other bits of the significand area are set to the lowest bits of this object’s unsigned significand, and the next-highest bit of the significand area is set if those bits are all zeros and this is a signaling NaN. Unfortunately, in the.NET implementation, the return value of this method may be a quiet NaN even if a signaling NaN would otherwise be generated.
Parameters:
- bigValue: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The closest 32-bit binary floating-point number to this value. The return value can be positive infinity or negative infinity if this value exceeds the range of a 32-bit floating point number.
Exceptions:
- System.ArgumentNullException: The parameter bigValue is null.
public static explicit operator int( PeterO.Numbers.EFloat input);
Converts an arbitrary-precision binary floating-point number to a 32-bit signed integer if it can fit in a 32-bit signed integer after converting it to an integer by discarding its fractional part.
Parameters:
- input: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The value of input , truncated to a 32-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than -2147483648 or greater than 2147483647.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator long( PeterO.Numbers.EFloat input);
Converts an arbitrary-precision binary floating-point number to a 64-bit signed integer if it can fit in a 64-bit signed integer after converting it to an integer by discarding its fractional part.
Parameters:
- input: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The value of input , truncated to a 64-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than -9223372036854775808 or greater than 9223372036854775807.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator PeterO.Numbers.EFloat( bool boolValue);
Converts a Boolean value (true or false) to an arbitrary-precision binary floating-point number.
Parameters:
- boolValue: Either true or false.
Return Value:
The number 1 if boolValue is true; otherwise, 0.
public static explicit operator PeterO.Numbers.EInteger( PeterO.Numbers.EFloat bigValue);
Converts an arbitrary-precision binary floating-point number to a value to an arbitrary-precision integer. Any fractional part in this value will be discarded when converting to an arbitrary-precision integer.
Parameters:
- bigValue: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
An arbitrary-precision integer.
Exceptions:
-
System.OverflowException: This object’s value is infinity or not-a-number (NaN).
-
System.ArgumentNullException: The parameter bigValue is null.
public static explicit operator sbyte( PeterO.Numbers.EFloat input);
This API is not CLS-compliant.
Converts an arbitrary-precision binary floating-point number to an 8-bit signed integer if it can fit in an 8-bit signed integer after converting it to an integer by discarding its fractional part.
Parameters:
- input: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The value of input , truncated to an 8-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than -128 or greater than 127.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator short( PeterO.Numbers.EFloat input);
Converts an arbitrary-precision binary floating-point number to a 16-bit signed integer if it can fit in a 16-bit signed integer after converting it to an integer by discarding its fractional part.
Parameters:
- input: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The value of input , truncated to a 16-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than -32768 or greater than 32767.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator uint( PeterO.Numbers.EFloat input);
This API is not CLS-compliant.
Converts an arbitrary-precision binary floating-point number to a 32-bit signed integer if it can fit in a 32-bit signed integer after converting it to an integer by discarding its fractional part.
Parameters:
- input: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The value of input , truncated to a 32-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than 0 or greater than 4294967295.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator ulong( PeterO.Numbers.EFloat input);
This API is not CLS-compliant.
Converts an arbitrary-precision binary floating-point number to a 64-bit unsigned integer if it can fit in a 64-bit unsigned integer after converting it to an integer by discarding its fractional part.
Parameters:
- input: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The value of input , truncated to a 64-bit unsigned integer.
Exceptions:
-
System.OverflowException: The parameter input is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than 0 or greater than 18446744073709551615.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator ushort( PeterO.Numbers.EFloat input);
This API is not CLS-compliant.
Converts an arbitrary-precision binary floating-point number to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer after converting it to an integer by discarding its fractional part.
Parameters:
- input: The number to convert as an arbitrary-precision binary floating-point number.
Return Value:
The value of input , truncated to a 16-bit unsigned integer.
Exceptions:
-
System.OverflowException: The parameter input is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than 0 or greater than 65535.
-
System.ArgumentNullException: The parameter input is null.
public static implicit operator PeterO.Numbers.EFloat( byte inputByte);
Converts a byte (from 0 to 255) to an arbitrary-precision binary floating-point number.
Parameters:
- inputByte: The number to convert as a byte (from 0 to 255).
Return Value:
The value of inputByte as an arbitrary-precision binary floating-point number.
public static implicit operator PeterO.Numbers.EFloat( double dbl);
Creates a binary floating-point number from a 64-bit floating-point number. This method computes the exact value of the floating point number, not an approximation, as is often the case by converting the floating point number to a string first.
Parameters:
- dbl: The parameter dbl is a 64-bit floating-point number.
Return Value:
A binary floating-point number with the same value as dbl .
public static implicit operator PeterO.Numbers.EFloat( float flt);
Creates a binary floating-point number from a 32-bit floating-point number. This method computes the exact value of the floating point number, not an approximation, as is often the case by converting the floating point number to a string first.
Parameters:
- flt: The parameter flt is a 32-bit binary floating-point number.
Return Value:
A binary floating-point number with the same value as flt .
public static implicit operator PeterO.Numbers.EFloat( int inputInt32);
Converts a 32-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputInt32: The number to convert as a 32-bit signed integer.
Return Value:
The value of inputInt32 as an arbitrary-precision binary floating-point number.
public static implicit operator PeterO.Numbers.EFloat( long inputInt64);
Converts a 64-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputInt64: The number to convert as a 64-bit signed integer.
Return Value:
The value of inputInt64 as an arbitrary-precision binary floating-point number.
public static implicit operator PeterO.Numbers.EFloat( PeterO.Numbers.EInteger eint);
Converts an arbitrary-precision integer to an arbitrary precision binary.
Parameters:
- eint: An arbitrary-precision integer.
Return Value:
An arbitrary-precision binary floating-point number with the exponent set to 0.
public static implicit operator PeterO.Numbers.EFloat( sbyte inputSByte);
This API is not CLS-compliant.
Converts an 8-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputSByte: The number to convert as an 8-bit signed integer.
Return Value:
The value of inputSByte as an arbitrary-precision binary floating-point number.
public static implicit operator PeterO.Numbers.EFloat( short inputInt16);
Converts a 16-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputInt16: The number to convert as a 16-bit signed integer.
Return Value:
The value of inputInt16 as an arbitrary-precision binary floating-point number.
public static implicit operator PeterO.Numbers.EFloat( uint inputUInt32);
This API is not CLS-compliant.
Converts a 32-bit signed integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputUInt32: The number to convert as a 32-bit signed integer.
Return Value:
The value of inputUInt32 as an arbitrary-precision binary floating-point number.
public static implicit operator PeterO.Numbers.EFloat( ulong inputUInt64);
This API is not CLS-compliant.
Converts a 64-bit unsigned integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputUInt64: The number to convert as a 64-bit unsigned integer.
Return Value:
The value of inputUInt64 as an arbitrary-precision binary floating-point number.
public static implicit operator PeterO.Numbers.EFloat( ushort inputUInt16);
This API is not CLS-compliant.
Converts a 16-bit unsigned integer to an arbitrary-precision binary floating-point number.
Parameters:
- inputUInt16: The number to convert as a 16-bit unsigned integer.
Return Value:
The value of inputUInt16 as an arbitrary-precision binary floating-point number.
public static PeterO.Numbers.EFloat operator ++( PeterO.Numbers.EFloat bthis);
Adds one to an arbitrary-precision binary floating-point number.
Parameters:
- bthis: An arbitrary-precision binary floating-point number.
Return Value:
The number given in bthis plus one.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static PeterO.Numbers.EFloat operator %( PeterO.Numbers.EFloat dividend, PeterO.Numbers.EFloat divisor);
Returns the remainder that would result when an arbitrary-precision binary floating-point number is divided by another arbitrary-precision binary floating-point number. The remainder is the number that remains when the absolute value of an arbitrary-precision binary floating-point number is divided (as though by DivideToIntegerZeroScale) by the absolute value of the other arbitrary-precision binary floating-point number; the remainder has the same sign (positive or negative) as this arbitrary-precision binary floating-point number.
Parameters:
-
dividend: The number that will be divided by the divisor.
-
divisor: The number to divide by.
Return Value:
The remainder that would result when an arbitrary-precision binary floating-point number is divided by another arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter dividend is null.
public static PeterO.Numbers.EFloat operator *( PeterO.Numbers.EFloat operand1, PeterO.Numbers.EFloat operand2);
Multiplies an arbitrary-precision binary floating-point number by another arbitrary-precision binary floating-point number and returns the result.
Parameters:
-
operand1: The first operand.
-
operand2: The second operand.
Return Value:
The product of the two numbers, that is, an arbitrary-precision binary floating-point number times another arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter operand1 is null.
public static PeterO.Numbers.EFloat operator -( PeterO.Numbers.EFloat bthis, PeterO.Numbers.EFloat subtrahend);
Subtracts one arbitrary-precision binary floating-point number from another.
Parameters:
-
bthis: The first operand.
-
subtrahend: The second operand.
Return Value:
The difference of the two objects.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static PeterO.Numbers.EFloat operator -( PeterO.Numbers.EFloat bigValue);
Gets an object with the same value as this one, but with the sign reversed.
Parameters:
- bigValue: An arbitrary-precision binary floating-point number.
Return Value:
The negated form of the specified number. If the specified number is positive zero, returns negative zero. Returns signaling NaN if this value is signaling NaN.
Exceptions:
- System.ArgumentNullException: The parameter bigValue is null.
public static PeterO.Numbers.EFloat PI( PeterO.Numbers.EContext ctx);
Finds the constant π, the circumference of a circle divided by its diameter.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). This parameter can’t be null, as π can never be represented exactly..
Return Value:
The constant π rounded to the specified precision. Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0).
public PeterO.Numbers.EFloat Plus( PeterO.Numbers.EContext ctx);
Rounds this object’s value to the specified precision, using the specified rounding mode and range of exponent, and also converts negative zero to positive zero. The idiom EDecimal.SignalingNaN.Plus(ctx)
is useful for triggering an invalid operation and returning not-a-number (NaN) for custom arithmetic operations.
Parameters:
- ctx: A context for controlling the precision, rounding mode, and exponent range. Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
The closest value to this object’s value, rounded to the specified precision. If ctx is null or the precision and exponent range are unlimited, returns the same value as this object (or a quiet NaN if this object is a signaling NaN).
public PeterO.Numbers.EFloat Pow( int exponentSmall, PeterO.Numbers.EContext ctx);
Raises this object’s value to the specified exponent.
Parameters:
-
exponentSmall: The exponent to raise this object’s value to.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
This^exponent. Signals the flag FlagInvalid and returns NaN if this object and exponent are both 0.
public PeterO.Numbers.EFloat Pow( int exponentSmall);
Raises this object’s value to the specified exponent.
Parameters:
- exponentSmall: The exponent to raise this object’s value to.
Return Value:
This^exponent. Returns not-a-number (NaN) if this object and exponent are both 0.
public PeterO.Numbers.EFloat Pow( PeterO.Numbers.EFloat exponent, PeterO.Numbers.EContext ctx);
Raises this object’s value to the specified exponent.
Parameters:
-
exponent: An arbitrary-precision binary floating-point number expressing the exponent to raise this object’s value to.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
This^exponent. Signals the flag FlagInvalid and returns NaN if this object and exponent are both 0; or if this value is less than 0 and the exponent either has a fractional part or is infinity. Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0), and the exponent has a fractional part.
public PeterO.Numbers.EFloat Pow( PeterO.Numbers.EFloat exponent);
Raises this object’s value to the specified exponent, using unlimited precision.
Parameters:
- exponent: An arbitrary-precision binary floating-point number expressing the exponent to raise this object’s value to.
Return Value:
This^exponent. Returns not-a-number (NaN) if the exponent has a fractional part.
public PeterO.Numbers.EInteger Precision();
Finds the number of digits in this number’s significand. Returns 1 if this value is 0, and 0 if this value is infinity or not-a-number (NaN).
Return Value:
An arbitrary-precision integer.
public PeterO.Numbers.EFloat PreRound( PeterO.Numbers.EContext ctx);
Returns a number in which the value of this object is rounded to fit the maximum precision allowed if it has more significant digits than the maximum precision. The maximum precision allowed is given in an arithmetic context. This method is designed for preparing operands to a custom arithmetic operation per the “simplified” arithmetic given in Appendix A of the General Decimal Arithmetic Specification.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited. Signals the flag LostDigits if the input number has greater precision than allowed and was rounded to a different numerical value in order to fit the precision.
Return Value:
This object rounded to the specified precision. Returns this object and signals no flags if ctx is null or specifies an unlimited precision, if this object is infinity or not-a-number (including signaling NaN), or if the number’s value has no more significant digits than the maximum precision given in ctx .
public PeterO.Numbers.EFloat Quantize( int desiredExponentInt, PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value but a new exponent. Note that this is not always the same as rounding to a given number of binary digit 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 binary digit places is desired, it’s better to use the RoundToExponent and RoundToIntegral methods instead.
Remark: This method can be used to implement fixed-point binary arithmetic, in which each binary floating-point number has a fixed number of digits after the radix point. The following code example returns a fixed-point number with up to 20 digits before and exactly 5 digits after the radix point:
/* After performing arithmetic operations, adjust /* the number to 5*/*/ digits after the radix point number = number.Quantize(-5, /* five digits*/ after the radix point EContext.ForPrecision(25) /* 25-digit precision);*/
A fixed-point binary arithmetic in which no digits come after the radix point (a desired exponent of 0) is considered an “integer arithmetic”.
Parameters:
-
desiredExponentInt: The desired exponent for the result. 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 thousand (10^3, 1000). A value of 0 rounds the number to an integer.
-
ctx: An arithmetic context to control precision and rounding of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number with the same value as this object but with the exponent changed. Signals FlagInvalid and returns not-a-number (NaN) if this object is infinity, if the rounded result can’t fit the specified precision, or if the context defines an exponent range and the specified exponent is outside that range.
public PeterO.Numbers.EFloat Quantize( PeterO.Numbers.EFloat otherValue, PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value as this object but with the same exponent as another binary floating-point number. Note that this is not always the same as rounding to a given number of binary digit 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 binary digit places is desired, it’s better to use the RoundToExponent and RoundToIntegral methods instead.
Remark: This method can be used to implement fixed-point binary arithmetic, in which a fixed number of digits come after the radix point. A fixed-point binary arithmetic in which no digits come after the radix point (a desired exponent of 0) is considered an “integer arithmetic” .
Parameters:
-
otherValue: A binary floating-point number containing the desired exponent of the result. The significand is ignored. 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 sixteenth (10b^-3, 0.0001b), and 3 means round to the sixteen-place (10b^3, 1000b). A value of 0 rounds the number to an integer.
-
ctx: An arithmetic context to control precision and rounding of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point 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 specified precision without rounding, or if the arithmetic context defines an exponent range and the specified exponent is outside that range.
public PeterO.Numbers.EFloat Quantize( PeterO.Numbers.EInteger desiredExponent, PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value but a new exponent. Note that this is not always the same as rounding to a given number of binary digit 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 binary digit places is desired, it’s better to use the RoundToExponent and RoundToIntegral methods instead.
Remark: This method can be used to implement fixed-point binary arithmetic, in which each binary floating-point number has a fixed number of digits after the radix point. The following code example returns a fixed-point number with up to 20 digits before and exactly 5 digits after the radix point:
/* After performing arithmetic operations, adjust /* the number to 5 /* */*/*/ digits after the radix point number = number.Quantize( EInteger.FromInt32(-5), /* five digits after the radix point*/ EContext.ForPrecision(25) /* 25-digit precision);*/
A fixed-point binary arithmetic in which no digits come after the radix point (a desired exponent of 0) is considered an “integer arithmetic”.
Parameters:
-
desiredExponent: The desired exponent for the result. 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 thousand (10^3, 1000). A value of 0 rounds the number to an integer.
-
ctx: An arithmetic context to control precision and rounding of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number with the same value as this object but with the exponent changed. Signals FlagInvalid and returns not-a-number (NaN) if this object is infinity, if the rounded result can’t fit the specified precision, or if the context defines an exponent range and the specified exponent is outside that range.
public PeterO.Numbers.EFloat Reduce( PeterO.Numbers.EContext ctx);
Returns an object with the same numerical value as this one but with trailing zeros removed from its significand. For example, 1.00 becomes 1. If this object’s value is 0, changes the exponent to 0.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and rounding isn’t needed.
Return Value:
This value with trailing zeros removed. Note that if the result has a very high exponent and the context says to clamp high exponents, there may still be some trailing zeros in the significand.
public PeterO.Numbers.EFloat Remainder( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Returns the remainder that would result when this arbitrary-precision binary floating-point number is divided by another arbitrary-precision binary floating-point number. The remainder is the number that remains when the absolute value of this arbitrary-precision binary floating-point number is divided (as though by DivideToIntegerZeroScale) by the absolute value of the other arbitrary-precision binary floating-point number; the remainder has the same sign (positive or negative) as this arbitrary-precision binary floating-point number.
Parameters:
-
divisor: An arbitrary-precision binary floating-point number.
-
ctx: The parameter ctx is an EContext object.
Return Value:
The remainder that would result when this arbitrary-precision binary floating-point number is divided by another arbitrary-precision binary floating-point number. Signals FlagDivideByZero and returns infinity if the divisor (this arbitrary-precision binary floating-point number) is 0 and the dividend (the other arbitrary-precision binary floating-point number) is nonzero. Signals FlagInvalid and returns not-a-number (NaN) if the divisor and the dividend are 0, or if the result of the division doesn’t fit the specified precision.
public PeterO.Numbers.EFloat RemainderNaturalScale( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Calculates the remainder of a number by the formula “this” - ((“this” / “divisor”) * “divisor”).
Parameters:
-
divisor: The number to divide by.
-
ctx: An arithmetic context object to control the precision, rounding, and exponent range of the result. This context will be used only in the division portion of the remainder calculation; as a result, it’s possible for the return value to have a higher precision than given in this context. Flags will be set on the specified context only if the context’s
HasFlags
is true and the integer part of the division result doesn’t fit the precision and exponent range without rounding. Can be null, in which the precision is unlimited and no additional rounding, other than the rounding down to an integer after division, is needed.
Return Value:
An arbitrary-precision binary floating-point number.
public PeterO.Numbers.EFloat RemainderNaturalScale( PeterO.Numbers.EFloat divisor);
Calculates the remainder of a number by the formula "this" - (("this" / "divisor") * "divisor")
.
Parameters:
- divisor: The number to divide by.
Return Value:
An arbitrary-precision binary floating-point number.
public PeterO.Numbers.EFloat RemainderNear( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Finds the distance to the closest multiple of the specified divisor, based on the result of dividing this object’s value by another object’s value.
-
If this and the other object divide evenly, the result is 0.
-
If the remainder’s absolute value is less than half of the divisor’s absolute value, the result has the same sign as this object and will be the distance to the closest multiple.
-
If the remainder’s absolute value is more than half of the divisor’s absolute value, the result has the opposite sign of this object and will be the distance to the closest multiple.
-
If the remainder’s absolute value is exactly half of the divisor’s absolute value, the result has the opposite sign of this object if the quotient, rounded down, is odd, and has the same sign as this object if the quotient, rounded down, is even, and the result’s absolute value is half of the divisor’s absolute value.
This function is also known as the “IEEE Remainder” function.
Parameters:
-
divisor: The number to divide by.
-
ctx: An arithmetic context object to control the precision. The rounding and exponent range settings of this context are ignored (the rounding mode is always treated as HalfEven). If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which the precision is unlimited.
Return Value:
The distance of the closest multiple. Signals FlagInvalid and returns not-a-number (NaN) if the divisor is 0, or either the result of integer division (the quotient) or the remainder wouldn’t fit the specified precision.
### RemainderNoRoundAfterDivide
public PeterO.Numbers.EFloat RemainderNoRoundAfterDivide( PeterO.Numbers.EFloat divisor, PeterO.Numbers.EContext ctx);
Finds the remainder that results when dividing two arbitrary-precision binary floating-point numbers. The remainder is the value that remains when the absolute value of this object is divided by the absolute value of the other object; the remainder has the same sign (positive or negative) as this object’s value.
Parameters:
-
divisor: An arbitrary-precision binary floating-point number.
-
ctx: The parameter ctx is an EContext object.
Return Value:
The remainder of the two numbers. Signals FlagInvalid and returns not-a-number (NaN) if the divisor is 0, or if the result doesn’t fit the specified precision.
public PeterO.Numbers.EFloat RoundToExponent( int exponentSmall, PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value as this object but rounded to a new exponent if necessary. The resulting number’s Exponent property will not necessarily be the specified exponent; use the Quantize method instead to give the result a particular exponent.
Parameters:
-
exponentSmall: The minimum exponent the result can have. This is the maximum 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 thousand (10^3, 1000). A value of 0 rounds the number to an integer.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number rounded to the closest value representable in the specified precision. If the result can’t fit the precision, additional digits are discarded to make it fit. Signals FlagInvalid and returns not-a-number (NaN) if the arithmetic context defines an exponent range, the new exponent must be changed to the specified exponent when rounding, and the specified exponent is outside the valid range of the arithmetic context.
public PeterO.Numbers.EFloat RoundToExponent( PeterO.Numbers.EInteger exponent, PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value as this object but rounded to a new exponent if necessary. The resulting number’s Exponent property will not necessarily be the specified exponent; use the Quantize method instead to give the result a particular exponent.
Parameters:
-
exponent: The minimum exponent the result can have. This is the maximum 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 thousand (10^3, 1000). A value of 0 rounds the number to an integer.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number rounded to the closest value representable in the specified precision. If the result can’t fit the precision, additional digits are discarded to make it fit. Signals FlagInvalid and returns not-a-number (NaN) if the arithmetic context defines an exponent range, the new exponent must be changed to the specified exponent when rounding, and the specified exponent is outside the valid range of the arithmetic context.
public PeterO.Numbers.EFloat RoundToExponentExact( int exponentSmall, PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value as this object but rounded to the specified exponent represented as a 32-bit signed integer, and signals an inexact flag if the result would be inexact. The resulting number’s Exponent property will not necessarily be the specified exponent; use the Quantize method instead to give the result a particular exponent.
Parameters:
-
exponentSmall: The minimum exponent the result can have. This is the maximum 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 thousand (10^3, 1000). A value of 0 rounds the number to an integer.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number rounded to the closest value representable in the specified precision. Signals FlagInvalid and returns not-a-number (NaN) if the result can’t fit the specified precision without rounding. Signals FlagInvalid and returns not-a-number (NaN) if the arithmetic context defines an exponent range, the new exponent must be changed to the specified exponent when rounding, and the specified exponent is outside the valid range of the arithmetic context.
public PeterO.Numbers.EFloat RoundToExponentExact( PeterO.Numbers.EInteger exponent, PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value as this object but rounded to the specified exponent, and signals an inexact flag if the result would be inexact. The resulting number’s Exponent property will not necessarily be the specified exponent; use the Quantize method instead to give the result a particular exponent.
Parameters:
-
exponent: The minimum exponent the result can have. This is the maximum 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 thousand (10^3, 1000). A value of 0 rounds the number to an integer.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number rounded to the closest value representable in the specified precision. Signals FlagInvalid and returns not-a-number (NaN) if the result can’t fit the specified precision without rounding. Signals FlagInvalid and returns not-a-number (NaN) if the arithmetic context defines an exponent range, the new exponent must be changed to the specified exponent when rounding, and the specified exponent is outside the valid range of the arithmetic context.
public PeterO.Numbers.EFloat RoundToExponentExact( PeterO.Numbers.EInteger exponent, PeterO.Numbers.ERounding rounding);
Returns a binary number with the same value as this object but rounded to the specified exponent. The resulting number’s Exponent property will not necessarily be the specified exponent; use the Quantize method instead to give the result a particular exponent.
Parameters:
-
exponent: The minimum exponent the result can have. This is the maximum 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 eighth (10^-1, 1/8), and 3 means round to the eight (2^3, 8). A value of 0 rounds the number to an integer.
-
rounding: Desired mode for rounding this object’s value.
Return Value:
A binary number rounded to the closest value representable in the specified precision.
public PeterO.Numbers.EFloat RoundToIntegerExact( PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value as this object but rounded to an integer, and signals an inexact flag if the result would be inexact. The resulting number’s Exponent property will not necessarily be 0; use the Quantize method instead to give the result an exponent of 0.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number rounded to the closest integer representable in the specified precision. Signals FlagInvalid and returns not-a-number (NaN) if the result can’t fit the specified precision without rounding. Signals FlagInvalid and returns not-a-number (NaN) if the arithmetic context defines an exponent range, the new exponent must be changed to 0 when rounding, and 0 is outside the valid range of the arithmetic context.
### RoundToIntegerNoRoundedFlag
public PeterO.Numbers.EFloat RoundToIntegerNoRoundedFlag( PeterO.Numbers.EContext ctx);
Returns a binary floating-point number with the same value as this object but rounded to an integer, without adding the FlagInexact
or FlagRounded
flags. The resulting number’s Exponent property will not necessarily be 0; use the Quantize method instead to give the result an exponent of 0.
Parameters:
- ctx: An arithmetic context to control precision and rounding of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags), except that this function will never add theFlagRounded
andFlagInexact
flags (the only difference between this and RoundToExponentExact). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number rounded to the closest integer representable in the specified precision. If the result can’t fit the precision, additional digits are discarded to make it fit. Signals FlagInvalid and returns not-a-number (NaN) if the arithmetic context defines an exponent range, the new exponent must be changed to 0 when rounding, and 0 is outside the valid range of the arithmetic context.
public PeterO.Numbers.EFloat RoundToIntegralExact( PeterO.Numbers.EContext ctx);
Obsolete. Renamed to RoundToIntegerExact.
Returns a binary floating-point number with the same value as this object but rounded to an integer, and signals an inexact flag if the result would be inexact.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number rounded to the closest integer representable in the specified precision. Signals FlagInvalid and returns not-a-number (NaN) if the result can’t fit the specified precision without rounding. Signals FlagInvalid and returns not-a-number (NaN) if the arithmetic context defines an exponent range, the new exponent must be changed to 0 when rounding, and 0 is outside the valid range of the arithmetic context.
### RoundToIntegralNoRoundedFlag
public PeterO.Numbers.EFloat RoundToIntegralNoRoundedFlag( PeterO.Numbers.EContext ctx);
Obsolete. Renamed to RoundToIntegerNoRoundedFlag.
Returns a binary floating-point number with the same value as this object but rounded to an integer, without adding the FlagInexact
or FlagRounded
flags.
Parameters:
- ctx: An arithmetic context to control precision and rounding of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags), except that this function will never add theFlagRounded
andFlagInexact
flags (the only difference between this and RoundToExponentExact). Can be null, in which case the default rounding mode is HalfEven.
Return Value:
A binary floating-point number rounded to the closest integer representable in the specified precision. If the result can’t fit the precision, additional digits are discarded to make it fit. Signals FlagInvalid and returns not-a-number (NaN) if the arithmetic context defines an exponent range, the new exponent must be changed to 0 when rounding, and 0 is outside the valid range of the arithmetic context.
public PeterO.Numbers.EFloat RoundToPrecision( PeterO.Numbers.EContext ctx);
Rounds this object’s value to the specified precision, using the specified rounding mode and range of exponent.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and no rounding is needed.
Return Value:
The closest value to this object’s value, rounded to the specified precision. Returns the same value as this object if ctx is null or the precision and exponent range are unlimited.
public PeterO.Numbers.EFloat ScaleByPowerOfTwo( int places, PeterO.Numbers.EContext ctx);
Returns a number similar to this number but with the scale adjusted.
Parameters:
-
places: The parameter places is a 32-bit signed integer.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
Return Value:
An arbitrary-precision binary floating-point number.
public PeterO.Numbers.EFloat ScaleByPowerOfTwo( int places);
Returns a number similar to this number but with the scale adjusted.
Parameters:
- places: The parameter places is a 32-bit signed integer.
Return Value:
An arbitrary-precision binary floating-point number.
public PeterO.Numbers.EFloat ScaleByPowerOfTwo( PeterO.Numbers.EInteger bigPlaces, PeterO.Numbers.EContext ctx);
Returns a number similar to this number but with its scale adjusted.
Parameters:
-
bigPlaces: An arbitrary-precision integer.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
Return Value:
An arbitrary-precision binary floating-point number.
Exceptions:
- System.ArgumentNullException: The parameter bigPlaces is null.
public PeterO.Numbers.EFloat ScaleByPowerOfTwo( PeterO.Numbers.EInteger bigPlaces);
Returns a number similar to this number but with the scale adjusted.
Parameters:
- bigPlaces: An arbitrary-precision integer.
Return Value:
A number whose exponent is increased by bigPlaces .
public PeterO.Numbers.EFloat Sqrt( PeterO.Numbers.EContext ctx);
Finds the square root of this object’s value.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). This parameter can’t be null, as the square root function’s results are generally not exact for many inputs. (Unlike in the General Binary Arithmetic Specification, any rounding mode is allowed.).
Return Value:
The square root. Signals the flag FlagInvalid and returns NaN if this object is less than 0 (the square root would be a complex number, but the return value is still NaN). Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0).
public PeterO.Numbers.EFloat SquareRoot( PeterO.Numbers.EContext ctx);
Obsolete. Renamed to Sqrt.
Finds the square root of this object’s value.
Parameters:
- ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). This parameter can’t be null, as the square root function’s results are generally not exact for many inputs. (Unlike in the General Binary Arithmetic Specification, any rounding mode is allowed.).
Return Value:
The square root. Signals the flag FlagInvalid and returns NaN if this object is less than 0 (the square root would be a complex number, but the return value is still NaN). Signals FlagInvalid and returns not-a-number (NaN) if the parameter ctx is null or the precision is unlimited (the context’s Precision property is 0).
public PeterO.Numbers.EFloat Subtract( int intValue);
Subtracts a 32-bit signed integer from this arbitrary-precision binary floating-point number and returns the result. The exponent for the result is the lower of this arbitrary-precision binary floating-point number’s exponent and the other 32-bit signed integer’s exponent.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
The difference between the two numbers, that is, this arbitrary-precision binary floating-point number minus a 32-bit signed integer. If this arbitrary-precision binary floating-point number is not-a-number (NaN), returns NaN.
public PeterO.Numbers.EFloat Subtract( long longValue);
Subtracts a 64-bit signed integer from this arbitrary-precision binary floating-point number and returns the result. The exponent for the result is the lower of this arbitrary-precision binary floating-point number’s exponent and the other 64-bit signed integer’s exponent.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The difference between the two numbers, that is, this arbitrary-precision binary floating-point number minus a 64-bit signed integer. If this arbitrary-precision binary floating-point number is not-a-number (NaN), returns NaN.
public PeterO.Numbers.EFloat Subtract( PeterO.Numbers.EFloat otherValue, PeterO.Numbers.EContext ctx);
Subtracts an arbitrary-precision binary floating-point number from this arbitrary-precision binary floating-point number and returns the result.
Parameters:
-
otherValue: The number to subtract from this instance’s value.
-
ctx: An arithmetic context to control the precision, rounding, and exponent range of the result. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null, in which case the precision is unlimited and no rounding is needed.
Return Value:
The difference between the two numbers, that is, this arbitrary-precision binary floating-point number minus another arbitrary-precision binary floating-point number. If this arbitrary-precision binary floating-point number is not-a-number (NaN), returns NaN.
Exceptions:
- System.ArgumentNullException: The parameter otherValue is null.
public PeterO.Numbers.EFloat Subtract( PeterO.Numbers.EFloat otherValue);
Subtracts an arbitrary-precision binary floating-point number from this arbitrary-precision binary floating-point number and returns the result. The exponent for the result is the lower of this arbitrary-precision binary floating-point number’s exponent and the other arbitrary-precision binary floating-point number’s exponent.
Parameters:
- otherValue: The number to subtract from this instance’s value.
Return Value:
The difference between the two numbers, that is, this arbitrary-precision binary floating-point number minus another arbitrary-precision binary floating-point number. If this arbitrary-precision binary floating-point number is not-a-number (NaN), returns NaN.
public byte ToByteChecked();
Converts this number’s value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255) after converting it to an integer by discarding its fractional part.
Return Value:
This number’s value, truncated to a byte (from 0 to 255).
Exceptions:
- System.OverflowException: This value is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than 0 or greater than 255.
public byte ToByteIfExact();
Converts this number’s value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255) without rounding to a different numerical value.
Return Value:
This number’s value as a byte (from 0 to 255).
Exceptions:
- System.ArithmeticException: This value is infinity or not-a-number, is not an exact integer, or is less than 0 or greater than 255.
public byte ToByteUnchecked();
Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a byte (from 0 to 255).
Return Value:
This number, converted to a byte (from 0 to 255). Returns 0 if this value is infinity or not-a-number.
public double ToDouble();
Converts this value to a 64-bit floating-point number encoded in the IEEE 754 binary64 format.
Return Value:
This number, converted to a 64-bit floating-point number encoded in the IEEE 754 binary64 format. The return value can be positive infinity or negative infinity if this value exceeds the range of a 64-bit floating point number.
public long ToDoubleBits();
Converts this value to its closest equivalent as a 64-bit floating-point number, expressed as an integer in the IEEE 754 binary64 format. The half-even rounding mode is used. If this value is a NaN, sets the high bit of the 64-bit floating point number’s significand area for a quiet NaN, and clears it for a signaling NaN. Then the other bits of the significand area are set to the lowest bits of this object’s unsigned significand, and the next-highest bit of the significand area is set if those bits are all zeros and this is a signaling NaN.
Return Value:
The closest 64-bit binary floating-point number to this value, expressed as an integer in the IEEE 754 binary64 format. The return value can be positive infinity or negative infinity if this value exceeds the range of a 64-bit floating point number.
public PeterO.Numbers.EDecimal ToEDecimal();
Converts this value to an arbitrary-precision decimal number.
Return Value:
This number, converted to an arbitrary-precision decimal number.
public PeterO.Numbers.EInteger ToEInteger();
Converts this value to an arbitrary-precision integer. Any fractional part of this value will be discarded when converting to an arbitrary-precision integer. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEInteger method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.OverflowException: This object’s value is infinity or not-a-number (NaN).
public PeterO.Numbers.EInteger ToEIntegerExact();
Obsolete. Renamed to ToEIntegerIfExact.
Converts this value to an arbitrary-precision integer, checking whether the value contains a fractional part. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
Return Value:
An arbitrary-precision integer.
Exceptions:
-
System.OverflowException: This object’s value is infinity or not-a-number (NaN).
-
System.ArithmeticException: This object’s value is not an exact integer.
public PeterO.Numbers.EInteger ToEIntegerIfExact();
Converts this value to an arbitrary-precision integer, checking whether the value contains a fractional part. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
Return Value:
An arbitrary-precision integer.
Exceptions:
-
System.OverflowException: This object’s value is infinity or not-a-number (NaN).
-
System.ArithmeticException: This object’s value is not an exact integer.
public string ToEngineeringString();
Converts this value to an arbitrary-precision decimal number, then returns the value of that decimal’s ToEngineeringString method.
Return Value:
A text string.
public PeterO.Numbers.EDecimal ToExtendedDecimal();
Obsolete. Renamed to ToEDecimal.
Converts this value to an arbitrary-precision decimal number.
Return Value:
An arbitrary-precision decimal number.
public short ToHalfBits();
Converts this value to its closest equivalent as a binary floating-point number, expressed as an integer in the IEEE 754 binary16 format (also known as a “half-precision” floating-point number). The half-even rounding mode is used. If this value is a NaN, sets the high bit of the binary16 number’s significand area for a quiet NaN, and clears it for a signaling NaN. Then the other bits of the significand area are set to the lowest bits of this object’s unsigned significand, and the next-highest bit of the significand area is set if those bits are all zeros and this is a signaling NaN.
Return Value:
The closest binary floating-point number to this value, expressed as an integer in the IEEE 754 binary16 format. The return value can be positive infinity or negative infinity if this value exceeds the range of a floating-point number in the binary16 format.
public short ToInt16Checked();
Converts this number’s value to a 16-bit signed integer if it can fit in a 16-bit signed integer after converting it to an integer by discarding its fractional part.
Return Value:
This number’s value, truncated to a 16-bit signed integer.
Exceptions:
- System.OverflowException: This value is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than -32768 or greater than 32767.
public short ToInt16IfExact();
Converts this number’s value to a 16-bit signed integer if it can fit in a 16-bit signed integer without rounding to a different numerical value.
Return Value:
This number’s value as a 16-bit signed integer.
Exceptions:
- System.ArithmeticException: This value is infinity or not-a-number, is not an exact integer, or is less than -32768 or greater than 32767.
public short ToInt16Unchecked();
Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 16-bit signed integer.
Return Value:
This number, converted to a 16-bit signed integer. Returns 0 if this value is infinity or not-a-number.
public int ToInt32Checked();
Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer after converting it to an integer by discarding its fractional part.
Return Value:
This number’s value, truncated to a 32-bit signed integer.
Exceptions:
- System.OverflowException: This value is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than -2147483648 or greater than 2147483647.
public int ToInt32IfExact();
Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer without rounding to a different numerical value.
Return Value:
This number’s value as a 32-bit signed integer.
Exceptions:
- System.ArithmeticException: This value is infinity or not-a-number, is not an exact integer, or is less than -2147483648 or greater than 2147483647.
public int ToInt32Unchecked();
Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 32-bit signed integer.
Return Value:
This number, converted to a 32-bit signed integer. Returns 0 if this value is infinity or not-a-number.
public long ToInt64Checked();
Converts this number’s value to a 64-bit signed integer if it can fit in a 64-bit signed integer after converting it to an integer by discarding its fractional part.
Return Value:
This number’s value, truncated to a 64-bit signed integer.
Exceptions:
- System.OverflowException: This value is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than -9223372036854775808 or greater than 9223372036854775807.
public long ToInt64IfExact();
Converts this number’s value to a 64-bit signed integer if it can fit in a 64-bit signed integer without rounding to a different numerical value.
Return Value:
This number’s value as a 64-bit signed integer.
Exceptions:
- System.ArithmeticException: This value is infinity or not-a-number, is not an exact integer, or is less than -9223372036854775808 or greater than 9223372036854775807.
public long ToInt64Unchecked();
Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 64-bit signed integer.
Return Value:
This number, converted to a 64-bit signed integer. Returns 0 if this value is infinity or not-a-number.
public string ToPlainString();
Converts this value to a string, but without exponential notation.
Return Value:
A text string.
public sbyte ToSByteChecked();
This API is not CLS-compliant.
Converts this number’s value to an 8-bit signed integer if it can fit in an 8-bit signed integer after converting it to an integer by discarding its fractional part.
Return Value:
This number’s value, truncated to an 8-bit signed integer.
Exceptions:
- System.OverflowException: This value is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than -128 or greater than 127.
public sbyte ToSByteIfExact();
This API is not CLS-compliant.
Converts this number’s value to an 8-bit signed integer if it can fit in an 8-bit signed integer without rounding to a different numerical value.
Return Value:
This number’s value as an 8-bit signed integer.
Exceptions:
- System.ArithmeticException: This value is infinity or not-a-number, is not an exact integer, or is less than -128 or greater than 127.
public sbyte ToSByteUnchecked();
This API is not CLS-compliant.
Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as an 8-bit signed integer.
Return Value:
This number, converted to an 8-bit signed integer. Returns 0 if this value is infinity or not-a-number.
public string ToShortestString( PeterO.Numbers.EContext ctx);
Returns a string representation of this number’s value after rounding that value to the specified precision (using the specified arithmetic context, such as EContext.Binary64
). If the number after rounding is neither infinity nor not-a-number (NaN), returns the shortest decimal form of this number’s value (in terms of decimal digits starting with the first nonzero digit and ending with the last nonzero digit) that results in the rounded number after the decimal form is converted to binary floating-point format (using the specified arithmetic context).
The following example converts an EFloat number to its shortest round-tripping decimal form using the same precision as the double
type in Java and.NET:
String str = efloat.ToShortestString(EContext.Binary64);
Parameters:
- ctx: An arithmetic context to control precision (in bits), rounding, and exponent range of the rounded number. If
HasFlags
of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null. If this parameter is null or defines no maximum precision, returns the same value as the ToString() method.
Return Value:
Shortest decimal form of this number’s value for the specified arithmetic context. The text string will be in exponential notation (expressed as a number 1 or greater, but less than 10, times a power of 10) if the number’s first nonzero decimal digit is more than five digits after the decimal point, or if the number’s exponent is greater than 0 and its value is 10, 000, 000 or greater.
public float ToSingle();
Converts this value to its closest equivalent as a 32-bit floating-point number. The half-even rounding mode is used. If this value is a NaN, sets the high bit of the 32-bit floating point number’s significand area for a quiet NaN, and clears it for a signaling NaN. Then the other bits of the significand area are set to the lowest bits of this object’s unsigned significand, and the next-highest bit of the significand area is set if those bits are all zeros and this is a signaling NaN. Unfortunately, in the.NET implementation, the return value of this method may be a quiet NaN even if a signaling NaN would otherwise be generated.
Return Value:
The closest 32-bit binary floating-point number to this value. The return value can be positive infinity or negative infinity if this value exceeds the range of a 32-bit floating point number.
public int ToSingleBits();
Converts this value to its closest equivalent as 32-bit floating-point number, expressed as an integer in the IEEE 754 binary32 format. The half-even rounding mode is used. If this value is a NaN, sets the high bit of the 32-bit floating point number’s significand area for a quiet NaN, and clears it for a signaling NaN. Then the other bits of the significand area are set to the lowest bits of this object’s unsigned significand, and the next-highest bit of the significand area is set if those bits are all zeros and this is a signaling NaN.
Return Value:
The closest 32-bit binary floating-point number to this value, expressed as an integer in the IEEE 754 binary32 format. The return value can be positive infinity or negative infinity if this value exceeds the range of a 32-bit floating point number.
public PeterO.Numbers.EInteger ToSizedEInteger( int maxBitLength);
Converts this value to an arbitrary-precision integer by discarding its fractional part and checking whether the resulting integer overflows the specified signed bit count.
Parameters:
- maxBitLength: The maximum number of signed bits the integer can have. The integer’s value may not be less than -(2^maxBitLength) or greater than (2^maxBitLength) - 1.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.OverflowException: This object’s value is infinity or not-a-number (NaN), or this number’s value, once converted to an integer by discarding its fractional part, is less than -(2^maxBitLength) or greater than (2^maxBitLength) - 1.
public PeterO.Numbers.EInteger ToSizedEIntegerIfExact( int maxBitLength);
Converts this value to an arbitrary-precision integer, only if this number’s value is an exact integer and that integer does not overflow the specified signed bit count.
Parameters:
- maxBitLength: The maximum number of signed bits the integer can have. The integer’s value may not be less than -(2^maxBitLength) or greater than (2^maxBitLength) - 1.
Return Value:
An arbitrary-precision integer.
Exceptions:
-
System.OverflowException: This object’s value is infinity or not-a-number (NaN), or this number’s value, once converted to an integer by discarding its fractional part, is less than -(2^maxBitLength) or greater than (2^maxBitLength) - 1.
-
System.ArithmeticException: This object’s value is not an exact integer.
public override string ToString();
Converts this number’s value to a text string.
Return Value:
A string representation of this object. The value is converted to a decimal number (using the EDecimal.FromEFloat method) and the decimal form of this number’s value is returned. The text string will be in exponential notation (expressed as a number 1 or greater, but less than 10, times a power of 10) if the converted decimal number’s exponent (EDecimal’s Exponent property) is greater than 0 or if the number’s first nonzero decimal digit is more than five digits after the decimal point.
public ushort ToUInt16Checked();
This API is not CLS-compliant.
Converts this number’s value to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer after converting it to an integer by discarding its fractional part.
Return Value:
This number’s value, truncated to a 16-bit unsigned integer.
Exceptions:
- System.OverflowException: This value is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than 0 or greater than 65535.
public ushort ToUInt16IfExact();
This API is not CLS-compliant.
Converts this number’s value to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer without rounding to a different numerical value.
Return Value:
This number’s value as a 16-bit unsigned integer.
Exceptions:
- System.ArithmeticException: This value is infinity or not-a-number, is not an exact integer, or is less than 0 or greater than 65535.
public ushort ToUInt16Unchecked();
This API is not CLS-compliant.
Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 16-bit unsigned integer.
Return Value:
This number, converted to a 16-bit unsigned integer. Returns 0 if this value is infinity or not-a-number.
public uint ToUInt32Checked();
This API is not CLS-compliant.
Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer after converting it to an integer by discarding its fractional part.
Return Value:
This number’s value, truncated to a 32-bit signed integer.
Exceptions:
- System.OverflowException: This value is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than 0 or greater than 4294967295.
public uint ToUInt32IfExact();
This API is not CLS-compliant.
Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer without rounding to a different numerical value.
Return Value:
This number’s value as a 32-bit signed integer.
Exceptions:
- System.ArithmeticException: This value is infinity or not-a-number, is not an exact integer, or is less than 0 or greater than 4294967295.
public uint ToUInt32Unchecked();
This API is not CLS-compliant.
Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 32-bit signed integer.
Return Value:
This number, converted to a 32-bit signed integer. Returns 0 if this value is infinity or not-a-number.
public ulong ToUInt64Checked();
This API is not CLS-compliant.
Converts this number’s value to a 64-bit unsigned integer if it can fit in a 64-bit unsigned integer after converting it to an integer by discarding its fractional part.
Return Value:
This number’s value, truncated to a 64-bit unsigned integer.
Exceptions:
- System.OverflowException: This value is infinity or not-a-number, or the number, once converted to an integer by discarding its fractional part, is less than 0 or greater than 18446744073709551615.
public ulong ToUInt64IfExact();
This API is not CLS-compliant.
Converts this number’s value to a 64-bit unsigned integer if it can fit in a 64-bit unsigned integer without rounding to a different numerical value.
Return Value:
This number’s value as a 64-bit unsigned integer.
Exceptions:
- System.ArithmeticException: This value is infinity or not-a-number, is not an exact integer, or is less than 0 or greater than 18446744073709551615.
public ulong ToUInt64Unchecked();
This API is not CLS-compliant.
Converts this number’s value to an integer by discarding its fractional part, and returns the least-significant bits of its two’s-complement form as a 64-bit unsigned integer.
Return Value:
This number, converted to a 64-bit unsigned integer. Returns 0 if this value is infinity or not-a-number.
public PeterO.Numbers.EFloat Ulp();
Returns the unit in the last place. The significand will be 1 and the exponent will be this number’s exponent. Returns 1 with an exponent of 0 if this number is infinity or not-a-number (NaN).
Return Value:
An arbitrary-precision binary floating-point number.