Struct half | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Struct half

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

    Constructors

    half(Double)

    Constructs a half value from a double value.

    Declaration
    public half(double v)
    Parameters
    Type Name Description
    System.Double v

    half(Single)

    Constructs a half value from a float value.

    Declaration
    public half(float v)
    Parameters
    Type Name Description
    System.Single v

    half(half)

    Constructs a half value from a half value.

    Declaration
    public half(half x)
    Parameters
    Type Name Description
    half x

    Fields

    value

    Declaration
    public ushort value
    Field Value
    Type Description
    System.UInt16

    zero

    half zero value.

    Declaration
    public static readonly half zero
    Field Value
    Type Description
    half

    Properties

    MaxValue

    Declaration
    public static float MaxValue { get; }
    Property Value
    Type Description
    System.Single

    MinValue

    Declaration
    public static float MinValue { get; }
    Property Value
    Type Description
    System.Single

    Methods

    Equals(Object)

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

    Declaration
    public override bool Equals(object o)
    Parameters
    Type Name Description
    System.Object o
    Returns
    Type Description
    System.Boolean
    Overrides
    System.ValueType.Equals(System.Object)

    Equals(half)

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

    Declaration
    public bool Equals(half rhs)
    Parameters
    Type Name Description
    half rhs
    Returns
    Type Description
    System.Boolean

    GetHashCode()

    Returns a hash code for the half.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.ValueType.GetHashCode()

    ToString()

    Returns a string representation of the half.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.ValueType.ToString()

    ToString(String, IFormatProvider)

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

    Declaration
    public string ToString(string format, IFormatProvider formatProvider)
    Parameters
    Type Name Description
    System.String format
    System.IFormatProvider formatProvider
    Returns
    Type Description
    System.String

    Operators

    Equality(half, half)

    Returns whether two half values are equal.

    Declaration
    public static bool operator ==(half lhs, half rhs)
    Parameters
    Type Name Description
    half lhs
    half rhs
    Returns
    Type Description
    System.Boolean

    Explicit(Double to half)

    Explicitly converts a double value to a half value.

    Declaration
    public static explicit operator half(double v)
    Parameters
    Type Name Description
    System.Double v
    Returns
    Type Description
    half

    Explicit(Single to half)

    Explicitly converts a float value to a half value.

    Declaration
    public static explicit operator half(float v)
    Parameters
    Type Name Description
    System.Single v
    Returns
    Type Description
    half

    Implicit(half to Double)

    Implicitly converts a half value to a double value.

    Declaration
    public static implicit operator double (half d)
    Parameters
    Type Name Description
    half d
    Returns
    Type Description
    System.Double

    Implicit(half to Single)

    Implicitly converts a half value to a float value.

    Declaration
    public static implicit operator float (half d)
    Parameters
    Type Name Description
    half d
    Returns
    Type Description
    System.Single

    Inequality(half, half)

    Returns whether two half values are different.

    Declaration
    public static bool operator !=(half lhs, half rhs)
    Parameters
    Type Name Description
    half lhs
    half rhs
    Returns
    Type Description
    System.Boolean
    Back to top
    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