Class XFloat
Extension methods and other bonus stuff for float.
Inheritance
System.Object
XFloat
Namespace: Galaxon.Core.Numbers
Assembly: Galaxon.Core.dll
Syntax
public static class XFloat : object
Fields
MaxExp
The maximum binary exponent supported by the type.
Declaration
public const short MaxExp = null
Field Value
| Type | Description |
|---|---|
| System.Int16 |
MinExp
The minimum binary exponent supported by the type.
Declaration
public const short MinExp = null
Field Value
| Type | Description |
|---|---|
| System.Int16 |
NumExpBits
The number of bits in the exponent.
Declaration
public const byte NumExpBits = null
Field Value
| Type | Description |
|---|---|
| System.Byte |
NumFracBits
The number of bits in the fraction.
Declaration
public const byte NumFracBits = null
Field Value
| Type | Description |
|---|---|
| System.Byte |
Properties
MaxPosSubnormalValue
The maximum positive subnormal value.
Declaration
public static float MaxPosSubnormalValue { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
MinPosNormalValue
The minimum positive normal value.
Declaration
public static float MinPosNormalValue { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
Assemble(Byte, UInt16, UInt64)
Assemble a new float from parts.
Declaration
public static float Assemble(byte signBit, ushort expBits, ulong fracBits)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte | signBit | The sign bit (1 or 0). |
| System.UInt16 | expBits | The exponent bits. |
| System.UInt64 | fracBits | The fraction bits. |
Returns
| Type | Description |
|---|---|
| System.Single | The new float. |
Disassemble(Single)
Disassemble the float into its bitwise components.
Declaration
public static (byte signBit, ushort expBits, ulong fracBits) Disassemble(this float x)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x |
Returns
| Type | Description |
|---|---|
| System.ValueTuple<System.Byte, System.UInt16, System.UInt64> |
GetRandom()
Get a random float.
Declaration
public static float GetRandom()
Returns
| Type | Description |
|---|---|
| System.Single |