docs.unity3d.com
    Show / Hide Table of Contents

    Struct half

    A half precision float that uses 16 bits instead of 32 bits.

    Namespace: Unity.Mathematics
    Syntax
    public struct half : System.IEquatable<half>, IFormattable

    Constructors

    Name Description
    half(Double)

    Constructs a half value from a double value.

    half(Single)

    Constructs a half value from a float value.

    half(half)

    Constructs a half value from a half value.

    Fields

    Name Description
    value

    The raw 16 bit value of the half.

    zero

    half zero value.

    Properties

    Name 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

    Name Description
    Equals(Object)

    Returns true if the half is equal to a given half, false otherwise.

    Equals(half)

    Returns true if the half is bitwise equivalent to a given half, false otherwise.

    GetHashCode()

    Returns a hash code for the half.

    ToString()

    Returns a string representation of the half.

    ToString(String, IFormatProvider)

    Returns a string representation of the half using a specified format and culture-specific format information.

    Operators

    Name Description
    Equality(half, half)

    Returns whether two half values are bitwise equivalent.

    Explicit(Double to half)

    Explicitly converts a double value to a half value.

    Explicit(Single to half)

    Explicitly converts a float value to a half value.

    Implicit(half to Double)

    Implicitly converts a half value to a double value.

    Implicit(half to Single)

    Implicitly converts a half value to a float value.

    Inequality(half, half)

    Returns whether two half values are not bitwise equivalent.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023