Xeno-rat
Loading...
Searching...
No Matches
NAudio.Utils.IEEE Class Reference

Methods for converting between IEEE 80-bit extended double precision and standard C# double precision. More...

Collaboration diagram for NAudio.Utils.IEEE:

Static Public Member Functions

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 Private Member Functions

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.
 

Detailed Description

Methods for converting between IEEE 80-bit extended double precision and standard C# double precision.

Member Function Documentation

◆ ConvertFromIeeeExtended()

static double NAudio.Utils.IEEE.ConvertFromIeeeExtended ( byte[] bytes)
inlinestatic

Converts the given IEEE extended byte array to a double value.

Parameters
bytesThe IEEE extended byte array to be converted.
Exceptions
ExceptionThrown 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
numThe 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FloatToUnsigned()

static ulong NAudio.Utils.IEEE.FloatToUnsigned ( double f)
inlinestaticprivate

Converts a floating-point number to an unsigned long integer.

Parameters
fThe floating-point number to be converted.
Returns
The unsigned long integer equivalent of the input floating-point number f .
Here is the caller graph for this function:

◆ 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
xThe value to be split.
expWhen 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.

Here is the caller graph for this function:

◆ ldexp()

static double NAudio.Utils.IEEE.ldexp ( double x,
int exp )
inlinestaticprivate

Returns x multiplied by 2 raised to the power of exp.

Parameters
xThe number to be multiplied.
expThe exponent to raise 2 to.
Returns
The result of multiplying x by 2 raised to the power of exp .
Here is the caller graph for this function:

◆ UnsignedToFloat()

static double NAudio.Utils.IEEE.UnsignedToFloat ( ulong u)
inlinestaticprivate

Converts the unsigned 64-bit integer to a floating-point number.

Parameters
uThe 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.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: