diff --git a/src/Tests/Tests/Shared/TestHalf.cs b/src/Tests/Tests/Shared/TestHalf.cs
index 7cd3e330..567273a6 100644
--- a/src/Tests/Tests/Shared/TestHalf.cs
+++ b/src/Tests/Tests/Shared/TestHalf.cs
@@ -522,6 +522,212 @@ public static void half4_maxvalue()
TestUtils.AreEqual(0x7bff, max.w.value);
}
+ static void CheckAllComponentsForExpected(uint expected, half actual)
+ {
+ TestUtils.AreEqual(expected, actual.value);
+ }
+
+ static void CheckAllComponentsForExpected(uint expected, half2 actual)
+ {
+ TestUtils.AreEqual(expected, actual.x.value);
+ TestUtils.AreEqual(expected, actual.y.value);
+ }
+
+ static void CheckAllComponentsForExpected(uint expected, half3 actual)
+ {
+ TestUtils.AreEqual(expected, actual.x.value);
+ TestUtils.AreEqual(expected, actual.y.value);
+ TestUtils.AreEqual(expected, actual.z.value);
+ }
+
+ static void CheckAllComponentsForExpected(uint expected, half4 actual)
+ {
+ TestUtils.AreEqual(expected, actual.x.value);
+ TestUtils.AreEqual(expected, actual.y.value);
+ TestUtils.AreEqual(expected, actual.z.value);
+ TestUtils.AreEqual(expected, actual.w.value);
+ }
+
+ [TestCompiler]
+ public static void half_check_rounding()
+ {
+ // 1 ulp away from a representable half.
+ CheckAllComponentsForExpected(0x3c01, new half(1.00097668170928955078f));
+ CheckAllComponentsForExpected(0x3c01, new half(1.00097644329071044922f));
+
+ CheckAllComponentsForExpected(0x3c01, new half(1.00097668170928955078));
+ CheckAllComponentsForExpected(0x3c01, new half(1.00097644329071044922));
+
+ // 1 ulp away from the midpoint between two representable halfs.
+ CheckAllComponentsForExpected(0x5c00, new half(256.124969482421875f));
+ CheckAllComponentsForExpected(0x5c01, new half(256.125030517578125f));
+ CheckAllComponentsForExpected(0x5c01, new half(256.374969482421875f));
+ CheckAllComponentsForExpected(0x5c02, new half(256.375030517578125f));
+ CheckAllComponentsForExpected(0xdc00, new half(-256.124969482421875f));
+ CheckAllComponentsForExpected(0xdc01, new half(-256.125030517578125f));
+ CheckAllComponentsForExpected(0xdc01, new half(-256.374969482421875f));
+ CheckAllComponentsForExpected(0xdc02, new half(-256.375030517578125f));
+
+ CheckAllComponentsForExpected(0x5c00, new half(256.124969482421875));
+ CheckAllComponentsForExpected(0x5c01, new half(256.125030517578125));
+ CheckAllComponentsForExpected(0x5c01, new half(256.374969482421875));
+ CheckAllComponentsForExpected(0x5c02, new half(256.375030517578125));
+ CheckAllComponentsForExpected(0xdc00, new half(-256.124969482421875));
+ CheckAllComponentsForExpected(0xdc01, new half(-256.125030517578125));
+ CheckAllComponentsForExpected(0xdc01, new half(-256.374969482421875));
+ CheckAllComponentsForExpected(0xdc02, new half(-256.375030517578125));
+
+ // At the midpoint between two representable halfs.
+ CheckAllComponentsForExpected(0x3c01, new half(1.00048828125f));
+ CheckAllComponentsForExpected(0x5c01, new half(256.125f));
+ CheckAllComponentsForExpected(0x5c02, new half(256.375f));
+ CheckAllComponentsForExpected(0xbc01, new half(-1.00048828125f));
+ CheckAllComponentsForExpected(0xdc01, new half(-256.125f));
+ CheckAllComponentsForExpected(0xdc02, new half(-256.375f));
+
+ CheckAllComponentsForExpected(0x3c01, new half(1.00048828125));
+ CheckAllComponentsForExpected(0x5c01, new half(256.125));
+ CheckAllComponentsForExpected(0x5c02, new half(256.375));
+ CheckAllComponentsForExpected(0xbc01, new half(-1.00048828125));
+ CheckAllComponentsForExpected(0xdc01, new half(-256.125));
+ CheckAllComponentsForExpected(0xdc02, new half(-256.375));
+ }
+
+ [TestCompiler]
+ public static void half2_check_rounding()
+ {
+ // 1 ulp away from a representable half.
+ CheckAllComponentsForExpected(0x3c01, new half2(1.00097668170928955078f));
+ CheckAllComponentsForExpected(0x3c01, new half2(1.00097644329071044922f));
+
+ CheckAllComponentsForExpected(0x3c01, new half2(1.00097668170928955078));
+ CheckAllComponentsForExpected(0x3c01, new half2(1.00097644329071044922));
+
+ // 1 ulp away from the midpoint between two representable halfs.
+ CheckAllComponentsForExpected(0x5c00, new half2(256.124969482421875f));
+ CheckAllComponentsForExpected(0x5c01, new half2(256.125030517578125f));
+ CheckAllComponentsForExpected(0x5c01, new half2(256.374969482421875f));
+ CheckAllComponentsForExpected(0x5c02, new half2(256.375030517578125f));
+ CheckAllComponentsForExpected(0xdc00, new half2(-256.124969482421875f));
+ CheckAllComponentsForExpected(0xdc01, new half2(-256.125030517578125f));
+ CheckAllComponentsForExpected(0xdc01, new half2(-256.374969482421875f));
+ CheckAllComponentsForExpected(0xdc02, new half2(-256.375030517578125f));
+
+ CheckAllComponentsForExpected(0x5c00, new half2(256.124969482421875));
+ CheckAllComponentsForExpected(0x5c01, new half2(256.125030517578125));
+ CheckAllComponentsForExpected(0x5c01, new half2(256.374969482421875));
+ CheckAllComponentsForExpected(0x5c02, new half2(256.375030517578125));
+ CheckAllComponentsForExpected(0xdc00, new half2(-256.124969482421875));
+ CheckAllComponentsForExpected(0xdc01, new half2(-256.125030517578125));
+ CheckAllComponentsForExpected(0xdc01, new half2(-256.374969482421875));
+ CheckAllComponentsForExpected(0xdc02, new half2(-256.375030517578125));
+
+ // At the midpoint between two representable halfs.
+ CheckAllComponentsForExpected(0x3c01, new half2(1.00048828125f));
+ CheckAllComponentsForExpected(0x5c01, new half2(256.125f));
+ CheckAllComponentsForExpected(0x5c02, new half2(256.375f));
+ CheckAllComponentsForExpected(0xbc01, new half2(-1.00048828125f));
+ CheckAllComponentsForExpected(0xdc01, new half2(-256.125f));
+ CheckAllComponentsForExpected(0xdc02, new half2(-256.375f));
+
+ CheckAllComponentsForExpected(0x3c01, new half2(1.00048828125));
+ CheckAllComponentsForExpected(0x5c01, new half2(256.125));
+ CheckAllComponentsForExpected(0x5c02, new half2(256.375));
+ CheckAllComponentsForExpected(0xbc01, new half2(-1.00048828125));
+ CheckAllComponentsForExpected(0xdc01, new half2(-256.125));
+ CheckAllComponentsForExpected(0xdc02, new half2(-256.375));
+ }
+
+ [TestCompiler]
+ public static void half3_check_rounding()
+ {
+ // 1 ulp away from a representable half.
+ CheckAllComponentsForExpected(0x3c01, new half3(1.00097668170928955078f));
+ CheckAllComponentsForExpected(0x3c01, new half3(1.00097644329071044922f));
+
+ CheckAllComponentsForExpected(0x3c01, new half3(1.00097668170928955078));
+ CheckAllComponentsForExpected(0x3c01, new half3(1.00097644329071044922));
+
+ // 1 ulp away from the midpoint between two representable halfs.
+ CheckAllComponentsForExpected(0x5c00, new half3(256.124969482421875f));
+ CheckAllComponentsForExpected(0x5c01, new half3(256.125030517578125f));
+ CheckAllComponentsForExpected(0x5c01, new half3(256.374969482421875f));
+ CheckAllComponentsForExpected(0x5c02, new half3(256.375030517578125f));
+ CheckAllComponentsForExpected(0xdc00, new half3(-256.124969482421875f));
+ CheckAllComponentsForExpected(0xdc01, new half3(-256.125030517578125f));
+ CheckAllComponentsForExpected(0xdc01, new half3(-256.374969482421875f));
+ CheckAllComponentsForExpected(0xdc02, new half3(-256.375030517578125f));
+
+ CheckAllComponentsForExpected(0x5c00, new half3(256.124969482421875));
+ CheckAllComponentsForExpected(0x5c01, new half3(256.125030517578125));
+ CheckAllComponentsForExpected(0x5c01, new half3(256.374969482421875));
+ CheckAllComponentsForExpected(0x5c02, new half3(256.375030517578125));
+ CheckAllComponentsForExpected(0xdc00, new half3(-256.124969482421875));
+ CheckAllComponentsForExpected(0xdc01, new half3(-256.125030517578125));
+ CheckAllComponentsForExpected(0xdc01, new half3(-256.374969482421875));
+ CheckAllComponentsForExpected(0xdc02, new half3(-256.375030517578125));
+
+ // At the midpoint between two representable halfs.
+ CheckAllComponentsForExpected(0x3c01, new half3(1.00048828125f));
+ CheckAllComponentsForExpected(0x5c01, new half3(256.125f));
+ CheckAllComponentsForExpected(0x5c02, new half3(256.375f));
+ CheckAllComponentsForExpected(0xbc01, new half3(-1.00048828125f));
+ CheckAllComponentsForExpected(0xdc01, new half3(-256.125f));
+ CheckAllComponentsForExpected(0xdc02, new half3(-256.375f));
+
+ CheckAllComponentsForExpected(0x3c01, new half3(1.00048828125));
+ CheckAllComponentsForExpected(0x5c01, new half3(256.125));
+ CheckAllComponentsForExpected(0x5c02, new half3(256.375));
+ CheckAllComponentsForExpected(0xbc01, new half3(-1.00048828125));
+ CheckAllComponentsForExpected(0xdc01, new half3(-256.125));
+ CheckAllComponentsForExpected(0xdc02, new half3(-256.375));
+ }
+
+ [TestCompiler]
+ public static void half4_check_rounding()
+ {
+ // 1 ulp away from a representable half.
+ CheckAllComponentsForExpected(0x3c01, new half4(1.00097668170928955078f));
+ CheckAllComponentsForExpected(0x3c01, new half4(1.00097644329071044922f));
+
+ CheckAllComponentsForExpected(0x3c01, new half4(1.00097668170928955078));
+ CheckAllComponentsForExpected(0x3c01, new half4(1.00097644329071044922));
+
+ // 1 ulp away from the midpoint between two representable halfs.
+ CheckAllComponentsForExpected(0x5c00, new half4(256.124969482421875f));
+ CheckAllComponentsForExpected(0x5c01, new half4(256.125030517578125f));
+ CheckAllComponentsForExpected(0x5c01, new half4(256.374969482421875f));
+ CheckAllComponentsForExpected(0x5c02, new half4(256.375030517578125f));
+ CheckAllComponentsForExpected(0xdc00, new half4(-256.124969482421875f));
+ CheckAllComponentsForExpected(0xdc01, new half4(-256.125030517578125f));
+ CheckAllComponentsForExpected(0xdc01, new half4(-256.374969482421875f));
+ CheckAllComponentsForExpected(0xdc02, new half4(-256.375030517578125f));
+
+ CheckAllComponentsForExpected(0x5c00, new half4(256.124969482421875));
+ CheckAllComponentsForExpected(0x5c01, new half4(256.125030517578125));
+ CheckAllComponentsForExpected(0x5c01, new half4(256.374969482421875));
+ CheckAllComponentsForExpected(0x5c02, new half4(256.375030517578125));
+ CheckAllComponentsForExpected(0xdc00, new half4(-256.124969482421875));
+ CheckAllComponentsForExpected(0xdc01, new half4(-256.125030517578125));
+ CheckAllComponentsForExpected(0xdc01, new half4(-256.374969482421875));
+ CheckAllComponentsForExpected(0xdc02, new half4(-256.375030517578125));
+
+ // At the midpoint between two representable halfs.
+ CheckAllComponentsForExpected(0x3c01, new half4(1.00048828125f));
+ CheckAllComponentsForExpected(0x5c01, new half4(256.125f));
+ CheckAllComponentsForExpected(0x5c02, new half4(256.375f));
+ CheckAllComponentsForExpected(0xbc01, new half4(-1.00048828125f));
+ CheckAllComponentsForExpected(0xdc01, new half4(-256.125f));
+ CheckAllComponentsForExpected(0xdc02, new half4(-256.375f));
+
+ CheckAllComponentsForExpected(0x3c01, new half4(1.00048828125));
+ CheckAllComponentsForExpected(0x5c01, new half4(256.125));
+ CheckAllComponentsForExpected(0x5c02, new half4(256.375));
+ CheckAllComponentsForExpected(0xbc01, new half4(-1.00048828125));
+ CheckAllComponentsForExpected(0xdc01, new half4(-256.125));
+ CheckAllComponentsForExpected(0xdc02, new half4(-256.375));
+ }
+
[TestCase]
public static void half_EqualsObjectOverride()
{
diff --git a/src/Unity.Mathematics.CodeGen~/VectorGenerator.cs b/src/Unity.Mathematics.CodeGen~/VectorGenerator.cs
index a6c203b3..c450f201 100644
--- a/src/Unity.Mathematics.CodeGen~/VectorGenerator.cs
+++ b/src/Unity.Mathematics.CodeGen~/VectorGenerator.cs
@@ -356,6 +356,16 @@ private void GenerateDebuggerTypeProxy(StringBuilder str)
str.Append("\t\t}\n\n");
}
+ void AppendIfHalf(StringBuilder str, string toAppend)
+ {
+ if (m_BaseType == "half")
+ {
+ str.AppendFormat(toAppend);
+ }
+ }
+
+ static readonly string halfRoundingModeRemark = "\t\t/// The rounding mode for this conversion is round away from zero (toward infinity).\n";
+
private void GenerateConversion(StringBuilder str, StringBuilder opStr, StringBuilder mathStr, string sourceBaseType, bool isExplicit, bool isScalar)
{
string sourceType = isScalar ? sourceBaseType : ToTypeName(sourceBaseType, m_Rows, m_Columns);
@@ -372,12 +382,15 @@ private void GenerateConversion(StringBuilder str, StringBuilder opStr, StringBu
{
str.AppendFormat("\t\t/// Constructs a {0} {1} from a single {2} value by converting it to {3} and assigning it to every component.\n", m_TypeName, dstTypeCategory, sourceType, m_BaseType);
str.AppendFormat($"\t\t/// {sourceType} to convert to {m_TypeName}\n");
+ AppendIfHalf(str, halfRoundingModeRemark);
mathStr.AppendFormat("\t\t/// Returns a {0} {1} constructed from a single {2} value by converting it to {3} and assigning it to every component.\n", m_TypeName, dstTypeCategory, sourceType, m_BaseType);
mathStr.AppendFormat($"\t\t/// {sourceType} to convert to {m_TypeName}\n");
+ AppendIfHalf(mathStr, halfRoundingModeRemark);
opStr.AppendFormat("\t\t/// {0} converts a single {1} value to a {2} {3} by converting it to {4} and assigning it to every component.\n", plicitlyString, sourceType, m_TypeName, dstTypeCategory, m_BaseType);
opStr.AppendFormat($"\t\t/// {sourceType} to convert to {m_TypeName}\n");
+ AppendIfHalf(opStr, halfRoundingModeRemark);
}
else
{
@@ -397,12 +410,15 @@ private void GenerateConversion(StringBuilder str, StringBuilder opStr, StringBu
{
str.AppendFormat("\t\t/// Constructs a {0} {1} from a {2} {1} by componentwise conversion.\n", m_TypeName, dstTypeCategory, sourceType);
str.AppendFormat($"\t\t/// {sourceType} to convert to {m_TypeName}\n");
+ AppendIfHalf(str, halfRoundingModeRemark);
mathStr.AppendFormat("\t\t/// Return a {0} {1} constructed from a {2} {1} by componentwise conversion.\n", m_TypeName, dstTypeCategory, sourceType);
mathStr.AppendFormat($"\t\t/// {sourceType} to convert to {m_TypeName}\n");
+ AppendIfHalf(mathStr, halfRoundingModeRemark);
opStr.AppendFormat("\t\t/// {0} converts a {1} {2} to a {3} {2} by componentwise conversion.\n", plicitlyString, sourceType, dstTypeCategory, m_TypeName);
opStr.AppendFormat($"\t\t/// {sourceType} to convert to {m_TypeName}\n");
+ AppendIfHalf(opStr, halfRoundingModeRemark);
}
}
diff --git a/src/Unity.Mathematics/half.cs b/src/Unity.Mathematics/half.cs
index 0e5a5286..8eb95890 100644
--- a/src/Unity.Mathematics/half.cs
+++ b/src/Unity.Mathematics/half.cs
@@ -48,6 +48,7 @@ public half(half x)
}
/// Constructs a half value from a float value.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The single precision float value to convert to half.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half(float v)
@@ -56,6 +57,7 @@ public half(float v)
}
/// Constructs a half value from a double value.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The double precision float value to convert to half.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half(double v)
@@ -64,12 +66,14 @@ public half(double v)
}
/// Explicitly converts a float value to a half value.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The single precision float value to convert to half.
/// The converted half value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half(float v) { return new half(v); }
/// Explicitly converts a double value to a half value.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The double precision float value to convert to half.
/// The converted half value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -147,12 +151,14 @@ public static partial class math
public static half half(half x) { return new half(x); }
/// Returns a half value constructed from a float value.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The single precision float value to convert to half.
/// The constructed half value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half half(float v) { return new half(v); }
/// Returns a half value constructed from a double value.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The double precision float value to convert to half.
/// The constructed half value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/Unity.Mathematics/half2.gen.cs b/src/Unity.Mathematics/half2.gen.cs
index 78c4fcdd..f2162b61 100644
--- a/src/Unity.Mathematics/half2.gen.cs
+++ b/src/Unity.Mathematics/half2.gen.cs
@@ -59,6 +59,7 @@ public half2(half v)
/// Constructs a half2 vector from a single float value by converting it to half and assigning it to every component.
/// float to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(float v)
{
@@ -68,6 +69,7 @@ public half2(float v)
/// Constructs a half2 vector from a float2 vector by componentwise conversion.
/// float2 to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(float2 v)
{
@@ -77,6 +79,7 @@ public half2(float2 v)
/// Constructs a half2 vector from a single double value by converting it to half and assigning it to every component.
/// double to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(double v)
{
@@ -86,6 +89,7 @@ public half2(double v)
/// Constructs a half2 vector from a double2 vector by componentwise conversion.
/// double2 to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(double2 v)
{
@@ -102,24 +106,28 @@ public half2(double2 v)
/// Explicitly converts a single float value to a half2 vector by converting it to half and assigning it to every component.
/// float to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half2(float v) { return new half2(v); }
/// Explicitly converts a float2 vector to a half2 vector by componentwise conversion.
/// float2 to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half2(float2 v) { return new half2(v); }
/// Explicitly converts a single double value to a half2 vector by converting it to half and assigning it to every component.
/// double to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half2(double v) { return new half2(v); }
/// Explicitly converts a double2 vector to a half2 vector by componentwise conversion.
/// double2 to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half2(double2 v) { return new half2(v); }
@@ -521,24 +529,28 @@ public static partial class math
/// Returns a half2 vector constructed from a single float value by converting it to half and assigning it to every component.
/// float to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(float v) { return new half2(v); }
/// Return a half2 vector constructed from a float2 vector by componentwise conversion.
/// float2 to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(float2 v) { return new half2(v); }
/// Returns a half2 vector constructed from a single double value by converting it to half and assigning it to every component.
/// double to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(double v) { return new half2(v); }
/// Return a half2 vector constructed from a double2 vector by componentwise conversion.
/// double2 to convert to half2
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(double2 v) { return new half2(v); }
diff --git a/src/Unity.Mathematics/half3.gen.cs b/src/Unity.Mathematics/half3.gen.cs
index 2e5e8904..6512caee 100644
--- a/src/Unity.Mathematics/half3.gen.cs
+++ b/src/Unity.Mathematics/half3.gen.cs
@@ -87,6 +87,7 @@ public half3(half v)
/// Constructs a half3 vector from a single float value by converting it to half and assigning it to every component.
/// float to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half3(float v)
{
@@ -97,6 +98,7 @@ public half3(float v)
/// Constructs a half3 vector from a float3 vector by componentwise conversion.
/// float3 to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half3(float3 v)
{
@@ -107,6 +109,7 @@ public half3(float3 v)
/// Constructs a half3 vector from a single double value by converting it to half and assigning it to every component.
/// double to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half3(double v)
{
@@ -117,6 +120,7 @@ public half3(double v)
/// Constructs a half3 vector from a double3 vector by componentwise conversion.
/// double3 to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half3(double3 v)
{
@@ -134,24 +138,28 @@ public half3(double3 v)
/// Explicitly converts a single float value to a half3 vector by converting it to half and assigning it to every component.
/// float to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half3(float v) { return new half3(v); }
/// Explicitly converts a float3 vector to a half3 vector by componentwise conversion.
/// float3 to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half3(float3 v) { return new half3(v); }
/// Explicitly converts a single double value to a half3 vector by converting it to half and assigning it to every component.
/// double to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half3(double v) { return new half3(v); }
/// Explicitly converts a double3 vector to a half3 vector by componentwise conversion.
/// double3 to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half3(double3 v) { return new half3(v); }
@@ -1391,24 +1399,28 @@ public static partial class math
/// Returns a half3 vector constructed from a single float value by converting it to half and assigning it to every component.
/// float to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half3 half3(float v) { return new half3(v); }
/// Return a half3 vector constructed from a float3 vector by componentwise conversion.
/// float3 to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half3 half3(float3 v) { return new half3(v); }
/// Returns a half3 vector constructed from a single double value by converting it to half and assigning it to every component.
/// double to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half3 half3(double v) { return new half3(v); }
/// Return a half3 vector constructed from a double3 vector by componentwise conversion.
/// double3 to convert to half3
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half3 half3(double3 v) { return new half3(v); }
diff --git a/src/Unity.Mathematics/half4.gen.cs b/src/Unity.Mathematics/half4.gen.cs
index f9786994..5fc92ffe 100644
--- a/src/Unity.Mathematics/half4.gen.cs
+++ b/src/Unity.Mathematics/half4.gen.cs
@@ -146,6 +146,7 @@ public half4(half v)
/// Constructs a half4 vector from a single float value by converting it to half and assigning it to every component.
/// float to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half4(float v)
{
@@ -157,6 +158,7 @@ public half4(float v)
/// Constructs a half4 vector from a float4 vector by componentwise conversion.
/// float4 to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half4(float4 v)
{
@@ -168,6 +170,7 @@ public half4(float4 v)
/// Constructs a half4 vector from a single double value by converting it to half and assigning it to every component.
/// double to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half4(double v)
{
@@ -179,6 +182,7 @@ public half4(double v)
/// Constructs a half4 vector from a double4 vector by componentwise conversion.
/// double4 to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half4(double4 v)
{
@@ -197,24 +201,28 @@ public half4(double4 v)
/// Explicitly converts a single float value to a half4 vector by converting it to half and assigning it to every component.
/// float to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half4(float v) { return new half4(v); }
/// Explicitly converts a float4 vector to a half4 vector by componentwise conversion.
/// float4 to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half4(float4 v) { return new half4(v); }
/// Explicitly converts a single double value to a half4 vector by converting it to half and assigning it to every component.
/// double to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half4(double v) { return new half4(v); }
/// Explicitly converts a double4 vector to a half4 vector by componentwise conversion.
/// double4 to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half4(double4 v) { return new half4(v); }
@@ -3555,24 +3563,28 @@ public static partial class math
/// Returns a half4 vector constructed from a single float value by converting it to half and assigning it to every component.
/// float to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half4 half4(float v) { return new half4(v); }
/// Return a half4 vector constructed from a float4 vector by componentwise conversion.
/// float4 to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half4 half4(float4 v) { return new half4(v); }
/// Returns a half4 vector constructed from a single double value by converting it to half and assigning it to every component.
/// double to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half4 half4(double v) { return new half4(v); }
/// Return a half4 vector constructed from a double4 vector by componentwise conversion.
/// double4 to convert to half4
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// Converted value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half4 half4(double4 v) { return new half4(v); }
diff --git a/src/Unity.Mathematics/math.cs b/src/Unity.Mathematics/math.cs
index f2ef33b7..7b3da84d 100644
--- a/src/Unity.Mathematics/math.cs
+++ b/src/Unity.Mathematics/math.cs
@@ -6545,6 +6545,7 @@ public static float4 f16tof32(uint4 x)
}
/// Returns the result converting a float value to its nearest half-precision floating point representation.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The single precision float.
/// The half precision float representation of the single precision float.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -6561,6 +6562,7 @@ public static uint f32tof16(float x)
}
/// Returns the result of a componentwise conversion of a float2 vector to its nearest half-precision floating point representation.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The single precision float vector.
/// The half precision float vector representation of the single precision float vector.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -6577,6 +6579,7 @@ public static uint2 f32tof16(float2 x)
}
/// Returns the result of a componentwise conversion of a float3 vector to its nearest half-precision floating point representation.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The single precision float vector.
/// The half precision float vector representation of the single precision float vector.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -6593,6 +6596,7 @@ public static uint3 f32tof16(float3 x)
}
/// Returns the result of a componentwise conversion of a float4 vector to its nearest half-precision floating point representation.
+ /// The rounding mode for this conversion is round away from zero (toward infinity).
/// The single precision float vector.
/// The half precision float vector representation of the single precision float vector.
[MethodImpl(MethodImplOptions.AggressiveInlining)]