Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Half Struct

    Namespace: Stride.Core.Mathematics
    Assembly: Stride.Core.Mathematics.dll

    A half precision (16 bit) floating point value.

    [DataContract]
    public struct Half
    Name Description
    Constructors
    Half(Single)

    Initializes a new instance of the Half structure.

    Fields
    AdditionRounding

    Additional rounding.

    Epsilon

    Smallest such that 1.0 + epsilon != 1.0

    ExponentRadix

    Exponent radix.

    MantissaBits

    Number of bits in the mantissa.

    MaximumBinaryExponent

    Maximum binary exponent.

    MaximumDecimalExponent

    Maximum decimal exponent.

    MaxValue

    Maximum value of the number.

    MinimumBinaryExponent

    Minimum binary exponent.

    MinimumDecimalExponent

    Minimum decimal exponent.

    MinValue

    Minimum value of the number.

    One

    A Half whose value is 1.0f.

    PrecisionDigits

    Number of decimal digits of precision.

    Zero

    A Half whose value is 0.0f.

    Properties
    RawValue

    Gets or sets the raw 16 bit value used to back this half-float.

    Methods
    ConvertToFloat(Half[])

    Converts an array of half precision values into full precision values.

    ConvertToHalf(Single[])

    Converts an array of full precision values into half precision values.

    Equals(Half)

    Returns a value that indicates whether the current instance is equal to the specified object.

    Equals(ref Half, ref Half)

    Determines whether the specified object instances are considered equal.

    Equals(Object)

    Returns a value that indicates whether the current instance is equal to a specified object.

    GetHashCode()

    Returns the hash code for this instance.

    ToString()

    Converts the value of the object to its equivalent string representation.

    Operators
    Equality(Half, Half)

    Tests for equality between two objects.

    Explicit(Single to Half)

    Performs an explicit conversion from System.Single to Half.

    Implicit(Half to Single)

    Performs an implicit conversion from Half to System.Single.

    Inequality(Half, Half)

    Tests for inequality between two objects.

    | Improve this Doc View Source

    Constructors


    Half(Single)

    Initializes a new instance of the Half structure.

    public Half(float value)
    Parameters
    Type Name Description
    System.Single value

    The floating point value that should be stored in 16 bit format.

    | Improve this Doc View Source

    Fields


    AdditionRounding

    Additional rounding.

    public const int AdditionRounding = 1
    Field Value
    Type Description
    System.Int32

    Epsilon

    Smallest such that 1.0 + epsilon != 1.0

    public static readonly float Epsilon
    Field Value
    Type Description
    System.Single

    ExponentRadix

    Exponent radix.

    public const int ExponentRadix = 2
    Field Value
    Type Description
    System.Int32

    MantissaBits

    Number of bits in the mantissa.

    public const int MantissaBits = 11
    Field Value
    Type Description
    System.Int32

    MaximumBinaryExponent

    Maximum binary exponent.

    public const int MaximumBinaryExponent = 15
    Field Value
    Type Description
    System.Int32

    MaximumDecimalExponent

    Maximum decimal exponent.

    public const int MaximumDecimalExponent = 4
    Field Value
    Type Description
    System.Int32

    MaxValue

    Maximum value of the number.

    public static readonly float MaxValue
    Field Value
    Type Description
    System.Single

    MinimumBinaryExponent

    Minimum binary exponent.

    public const int MinimumBinaryExponent = -14
    Field Value
    Type Description
    System.Int32

    MinimumDecimalExponent

    Minimum decimal exponent.

    public const int MinimumDecimalExponent = -4
    Field Value
    Type Description
    System.Int32

    MinValue

    Minimum value of the number.

    public static readonly float MinValue
    Field Value
    Type Description
    System.Single

    One

    A Half whose value is 1.0f.

    public static readonly Half One
    Field Value
    Type Description
    Half

    PrecisionDigits

    Number of decimal digits of precision.

    public const int PrecisionDigits = 3
    Field Value
    Type Description
    System.Int32

    Zero

    A Half whose value is 0.0f.

    public static readonly Half Zero
    Field Value
    Type Description
    Half
    | Improve this Doc View Source

    Properties


    RawValue

    Gets or sets the raw 16 bit value used to back this half-float.

    public ushort RawValue { get; set; }
    Property Value
    Type Description
    System.UInt16
    | Improve this Doc View Source

    Methods


    ConvertToFloat(Half[])

    Converts an array of half precision values into full precision values.

    public static float[] ConvertToFloat(Half[] values)
    Parameters
    Type Name Description
    Half[] values

    The values to be converted.

    Returns
    Type Description
    System.Single[]

    An array of converted values.


    ConvertToHalf(Single[])

    Converts an array of full precision values into half precision values.

    public static Half[] ConvertToHalf(float[] values)
    Parameters
    Type Name Description
    System.Single[] values

    The values to be converted.

    Returns
    Type Description
    Half[]

    An array of converted values.


    Equals(Half)

    Returns a value that indicates whether the current instance is equal to the specified object.

    public bool Equals(Half other)
    Parameters
    Type Name Description
    Half other

    Object to make the comparison with.

    Returns
    Type Description
    System.Boolean

    true if the current instance is equal to the specified object; false otherwise.


    Equals(ref Half, ref Half)

    Determines whether the specified object instances are considered equal.

    public static bool Equals(ref Half value1, ref Half value2)
    Parameters
    Type Name Description
    Half value1

    The first value.

    Half value2

    The second value.

    Returns
    Type Description
    System.Boolean

    true if value1 is the same instance as value2 or if both are null references or if value1.Equals(value2) returns true; otherwise, false.


    Equals(Object)

    Returns a value that indicates whether the current instance is equal to a specified object.

    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    Object to make the comparison with.

    Returns
    Type Description
    System.Boolean

    true if the current instance is equal to the specified object; false otherwise.

    Overrides
    System.ValueType.Equals(System.Object)

    GetHashCode()

    Returns the hash code for this instance.

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

    A 32-bit signed integer hash code.

    Overrides
    System.ValueType.GetHashCode()

    ToString()

    Converts the value of the object to its equivalent string representation.

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

    The string representation of the value of this instance.

    Overrides
    System.ValueType.ToString()
    | Improve this Doc View Source

    Operators


    Equality(Half, Half)

    Tests for equality between two objects.

    public static bool operator ==(Half left, Half right)
    Parameters
    Type Name Description
    Half left

    The first value to compare.

    Half right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has the same value as right; otherwise, false.


    Explicit(Single to Half)

    Performs an explicit conversion from System.Single to Half.

    public static explicit operator Half(float value)
    Parameters
    Type Name Description
    System.Single value

    The value to be converted.

    Returns
    Type Description
    Half

    The converted value.


    Implicit(Half to Single)

    Performs an implicit conversion from Half to System.Single.

    public static implicit operator float (Half value)
    Parameters
    Type Name Description
    Half value

    The value to be converted.

    Returns
    Type Description
    System.Single

    The converted value.


    Inequality(Half, Half)

    Tests for inequality between two objects.

    public static bool operator !=(Half left, Half right)
    Parameters
    Type Name Description
    Half left

    The first value to compare.

    Half right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has a different value than right; otherwise, false.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation