half
A half precision float that uses 16 bits instead of 32 bits.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Struct
- Namespace: Unity.Mathematics
- Assembly: UnityEngine.MathematicsModule
- Implements: IEquatable<half>, IFormattable
public struct half : IEquatable<half>, IFormattable
Fields
Value | Description |
|---|---|
| value | The raw 16 bit value of the half. |
Static Fields
Value | Description |
|---|---|
| zero | half zero value. |
Constructors
Constructor | Description |
|---|---|
| half(System.Double) | Constructs a half value from a double value. |
| half(System.Single) | Constructs a half value from a float value. |
| half(Unity.Mathematics.half) | Constructs a half value from a half value. |
Static Properties
Property | Description |
|---|---|
| MaxValue | The maximum finite half value as a single precision float. |
| MaxValueAsHalf | The maximum finite half value as a half. |
| MinValue | The minimum finite half value as a single precision float. |
| MinValueAsHalf | The minimum finite half value as a half. |
Methods
Method | Description |
|---|---|
| Equals | Returns true if the half is equal to a given half, false otherwise. |
| GetHashCode | Returns a hash code for the half. |
| ToString | Returns a string representation of the half. |
Operators
Operator | Description |
|---|---|
| operator == | Returns whether two half values are bitwise equivalent. |
| half | Explicitly converts a double value to a half value. |
| double | Implicitly converts a half value to a double value. |
| float | Implicitly converts a half value to a float value. |
| operator != | Returns whether two half values are not bitwise equivalent. |