Struct half
Syntax
public struct half : IEquatable<half>, IFormattable
Constructors
half(Double)
Constructs a half value from a double value.
Declaration
Parameters
Type |
Name |
Description |
System.Double |
v |
|
half(Single)
Constructs a half value from a float value.
Declaration
Parameters
Type |
Name |
Description |
System.Single |
v |
|
half(half)
Constructs a half value from a half value.
Declaration
Parameters
Type |
Name |
Description |
half |
x |
|
Fields
value
Declaration
Field Value
Type |
Description |
System.UInt16 |
|
zero
Declaration
public static readonly half zero
Field Value
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()
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
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
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
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
Returns
Type |
Description |
System.Boolean |
|
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.