Methods for converting between IEEE 80-bit extended double precision and standard C# double precision.
More...
|
static byte[] | ConvertToIeeeExtended (double num) |
| Converts a double-precision floating-point number to its IEEE 754 extended precision representation.
|
|
static double | ConvertFromIeeeExtended (byte[] bytes) |
| Converts the given IEEE extended byte array to a double value.
|
|
|
static double | UnsignedToFloat (ulong u) |
| Converts the unsigned 64-bit integer to a floating-point number.
|
|
static double | ldexp (double x, int exp) |
| Returns x multiplied by 2 raised to the power of exp.
|
|
static double | frexp (double x, out int exp) |
| Splits a double-precision floating-point value into a normalized fraction and an integral power of 2.
|
|
static ulong | FloatToUnsigned (double f) |
| Converts a floating-point number to an unsigned long integer.
|
|
Methods for converting between IEEE 80-bit extended double precision and standard C# double precision.
◆ ConvertFromIeeeExtended()
static double NAudio.Utils.IEEE.ConvertFromIeeeExtended |
( |
byte[] | bytes | ) |
|
|
inlinestatic |
Converts the given IEEE extended byte array to a double value.
- Parameters
-
bytes | The IEEE extended byte array to be converted. |
- Exceptions
-
Exception | Thrown when the length of the input byte array is not 10. |
- Returns
- The double value converted from the IEEE extended byte array.
This method converts the given IEEE extended byte array to a double value according to the IEEE 754 standard. It first extracts the sign, exponent, and mantissa from the byte array and then performs the necessary calculations to obtain the double value. If the input represents Infinity or NaN, the method returns double.NaN.
◆ ConvertToIeeeExtended()
static byte[] NAudio.Utils.IEEE.ConvertToIeeeExtended |
( |
double | num | ) |
|
|
inlinestatic |
Converts a double-precision floating-point number to its IEEE 754 extended precision representation.
- Parameters
-
num | The number to be converted. |
- Returns
- The IEEE 754 extended precision representation of the input num .
This method first determines the sign of the input number and then calculates the exponent and mantissa based on the input number. If the input number is 0, the resulting IEEE 754 extended precision representation will have all bits set to 0. If the input number is Infinity or NaN, the resulting IEEE 754 extended precision representation will be set accordingly. For finite numbers, the method calculates the exponent and mantissa, and then constructs the 10-byte representation of the IEEE 754 extended precision format. The resulting byte array contains the sign bit, exponent, and mantissa in the IEEE 754 extended precision format.
◆ FloatToUnsigned()
static ulong NAudio.Utils.IEEE.FloatToUnsigned |
( |
double | f | ) |
|
|
inlinestaticprivate |
Converts a floating-point number to an unsigned long integer.
- Parameters
-
f | The floating-point number to be converted. |
- Returns
- The unsigned long integer equivalent of the input floating-point number f .
◆ frexp()
static double NAudio.Utils.IEEE.frexp |
( |
double | x, |
|
|
out int | exp ) |
|
inlinestaticprivate |
Splits a double-precision floating-point value into a normalized fraction and an integral power of 2.
- Parameters
-
x | The value to be split. |
exp | When this method returns, contains the exponent of the value. |
- Returns
- The normalized fraction of the value, and sets exp to the exponent.
This method calculates the exponent of the input value x and sets it in the out parameter exp . It then computes the normalized fraction by subtracting the power of 2 raised to the exponent from the input value and dividing it by the same power of 2.
◆ ldexp()
static double NAudio.Utils.IEEE.ldexp |
( |
double | x, |
|
|
int | exp ) |
|
inlinestaticprivate |
Returns x multiplied by 2 raised to the power of exp.
- Parameters
-
x | The number to be multiplied. |
exp | The exponent to raise 2 to. |
- Returns
- The result of multiplying x by 2 raised to the power of exp .
◆ UnsignedToFloat()
static double NAudio.Utils.IEEE.UnsignedToFloat |
( |
ulong | u | ) |
|
|
inlinestaticprivate |
Converts the unsigned 64-bit integer to a floating-point number.
- Parameters
-
u | The unsigned 64-bit integer to be converted. |
- Returns
- The floating-point representation of the input unsigned 64-bit integer.
This method converts the input unsigned 64-bit integer u to a floating-point number by subtracting 2147483647 and 1 from it, casting the result to a long, then casting it to a double, and finally adding 2147483648.0 to the result.
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.Core/Utils/IEEE.cs