29 instantiations of Half
System.Private.CoreLib (29)
src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (2)
948public static Half Int16BitsToHalf(short value) => new Half((ushort)(value)); 1002public static Half UInt16BitsToHalf(ushort value) => new Half(value);
src\libraries\System.Private.CoreLib\src\System\Half.cs (27)
89public static Half Epsilon => new Half(EpsilonBits); // 5.9604645E-08 91public static Half PositiveInfinity => new Half(PositiveInfinityBits); // 1.0 / 0.0; 93public static Half NegativeInfinity => new Half(NegativeInfinityBits); // -1.0 / 0.0 95public static Half NaN => new Half(NegativeQNaNBits); // 0.0 / 0.0 98public static Half MinValue => new Half(MinValueBits); // -65504 101public static Half MaxValue => new Half(MaxValueBits); // 65504 592return new Half(sign, 0, 0); 594return new Half(RoundPackToHalf(sign, (short)(exp - 0x3F1), (ushort)(sigHalf | 0x4000))); 1100return IsNaN(value) ? value : new Half((ushort)(value._value ^ SignMask)); 1150return new Half(sign, (ushort)exp, sig)._value; 1198static Half IAdditiveIdentity<Half, Half>.AdditiveIdentity => new Half(PositiveZeroBits); 1246return new Half((ushort)(left._value & right._value)); 1252return new Half((ushort)(left._value | right._value)); 1258return new Half((ushort)(left._value ^ right._value)); 1264return new Half((ushort)(~value._value)); 1424public static Half E => new Half(EBits); 1427public static Half Pi => new Half(PiBits); 1430public static Half Tau => new Half(TauBits); 1437public static Half NegativeZero => new Half(NegativeZeroBits); 1475return new Half((ushort)bits); 1508return new Half((ushort)bits); 1628public static Half MultiplicativeIdentity => new Half(PositiveOneBits); 1664return new Half((ushort)((xbits & ~SignMask) | (ybits & SignMask))); 1748public static Half One => new Half(PositiveOneBits); 1754public static Half Zero => new Half(PositiveZeroBits); 1757public static Half Abs(Half value) => new Half((ushort)(value._value & ~SignMask)); 2206public static Half NegativeOne => new Half(NegativeOneBits);
1132 references to Half
GenerateDocumentationAndConfigFiles (17)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (17)
311|| typeof(T) == typeof(Half) 626if (typeof(T) == typeof(Half)) 627return (Half)(object)left < (Half)(object)right; 660if (typeof(T) == typeof(Half)) 661return (Half)(object)left > (Half)(object)right; 913|| typeof(TKey) == typeof(Half) 1177if (typeof(TKey) == typeof(Half)) 1178return (Half)(object)left < (Half)(object)right; 1211if (typeof(TKey) == typeof(Half)) 1212return (Half)(object)left > (Half)(object)right; 1244|| (typeof(TKey) == typeof(Half) && Half.IsNaN((Half)(object)keys[i]))
Microsoft.AspNetCore.Components.Endpoints (6)
FormMapping\WellKnownConverters.cs (6)
36{ typeof(Half), new ParsableConverter<Half>() }, 68converters.Add(typeof(Half?), new NullableConverter<Half>((FormDataConverter<Half>)converters[typeof(Half)]));
Microsoft.AspNetCore.Components.Endpoints.Tests (6)
Binding\FormDataMapperTests.cs (6)
2119{ "12.56", typeof(Half?), new Half?((Half)12.56f)}, 2161{ typeof(Half?) }, 2204{ "12.56", typeof(Half), (Half)12.56f },
Microsoft.AspNetCore.Http.Extensions (10)
src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
36{ typeof(Half), new ParsableConverter<Half>() }, 68converters.Add(typeof(Half?), new NullableConverter<Half>((FormDataConverter<Half>)converters[typeof(Half)]));
src\Shared\ParameterBindingMethodCache.cs (4)
647else if (type == typeof(Half)) 649method = typeof(Half).GetMethod( 650nameof(Half.TryParse), 652new[] { typeof(string), typeof(NumberStyles), typeof(IFormatProvider), typeof(Half).MakeByRefType() });
Microsoft.AspNetCore.Http.Extensions.Tests (7)
ParameterBindingMethodCacheTests.cs (1)
19[InlineData(typeof(Half))]
RequestDelegateFactoryTests.cs (4)
323new object[] { (Action<HttpContext, Half[]>)Store, new[] { "0.5" }, new[] { (Half)0.5f } }, 374new object[] { (Action<HttpContext, Half>)Store, "0.5", (Half)0.5f },
RequestDelegateGenerator\RequestDelegateCreationTests.Arrays.cs (1)
130new object[] { "Half[]", new[] { "0.5" }, new[] { (Half)0.5f } },
RequestDelegateGenerator\RequestDelegateCreationTests.TryParse.cs (1)
37new object[] { "Half", "0.5", (Half)0.5f },
Microsoft.AspNetCore.Mvc.Abstractions (4)
src\Shared\ParameterBindingMethodCache.cs (4)
647else if (type == typeof(Half)) 649method = typeof(Half).GetMethod( 650nameof(Half.TryParse), 652new[] { typeof(string), typeof(NumberStyles), typeof(IFormatProvider), typeof(Half).MakeByRefType() });
Microsoft.AspNetCore.OpenApi (5)
Services\OpenApiConstants.cs (1)
51typeof(Half),
src\Shared\ParameterBindingMethodCache.cs (4)
647else if (type == typeof(Half)) 649method = typeof(Half).GetMethod( 650nameof(Half.TryParse), 652new[] { typeof(string), typeof(NumberStyles), typeof(IFormatProvider), typeof(Half).MakeByRefType() });
Microsoft.CodeAnalysis (17)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (17)
311|| typeof(T) == typeof(Half) 626if (typeof(T) == typeof(Half)) 627return (Half)(object)left < (Half)(object)right; 660if (typeof(T) == typeof(Half)) 661return (Half)(object)left > (Half)(object)right; 913|| typeof(TKey) == typeof(Half) 1177if (typeof(TKey) == typeof(Half)) 1178return (Half)(object)left < (Half)(object)right; 1211if (typeof(TKey) == typeof(Half)) 1212return (Half)(object)left > (Half)(object)right; 1244|| (typeof(TKey) == typeof(Half) && Half.IsNaN((Half)(object)keys[i]))
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (17)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (17)
311|| typeof(T) == typeof(Half) 626if (typeof(T) == typeof(Half)) 627return (Half)(object)left < (Half)(object)right; 660if (typeof(T) == typeof(Half)) 661return (Half)(object)left > (Half)(object)right; 913|| typeof(TKey) == typeof(Half) 1177if (typeof(TKey) == typeof(Half)) 1178return (Half)(object)left < (Half)(object)right; 1211if (typeof(TKey) == typeof(Half)) 1212return (Half)(object)left > (Half)(object)right; 1244|| (typeof(TKey) == typeof(Half) && Half.IsNaN((Half)(object)keys[i]))
Microsoft.Extensions.AI.Integration.Tests (7)
EmbeddingGeneratorIntegrationTests.cs (2)
186using IEmbeddingGenerator<string, Embedding<Half>> generator = 193var distances = new Half[embeddings.Count, embeddings.Count];
QuantizationEmbeddingGenerator.cs (5)
19, IEmbeddingGenerator<string, Embedding<Half>> 68async Task<GeneratedEmbeddings<Embedding<Half>>> IEmbeddingGenerator<string, Embedding<Half>>.GenerateAsync( 79private static Embedding<Half> QuantizeToHalf(Embedding<float> embedding) 82var result = new Half[vector.Length];
Shared.Tests (3)
JsonSchemaExporter\TestTypes.cs (3)
71yield return new TestData<Half>((Half)3.141, """{"type":"number"}"""); 1216[JsonSerializable(typeof(Half))]
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
66typeof(T) == typeof(Half) ||
System.ComponentModel.TypeConverter (4)
System\ComponentModel\HalfConverter.cs (3)
23internal override Type TargetType => typeof(Half); 33internal override object FromString(string value, NumberFormatInfo? formatInfo) => Half.Parse(value, formatInfo); 39((Half)value).ToString(formatInfo);
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
165[typeof(Half)] = new IntrinsicTypeConverterData((type) => new HalfConverter()),
System.Formats.Cbor (11)
System\Formats\Cbor\CborHelpers.netcoreapp.cs (1)
44public static Half ReadHalfBigEndian(ReadOnlySpan<byte> source)
System\Formats\Cbor\HalfHelpers.netcoreapp.cs (2)
11public static unsafe float HalfToFloat(Half value) 14public static unsafe double HalfToDouble(Half value)
System\Formats\Cbor\Reader\CborReader.Simple.netcoreapp.cs (2)
22public Half ReadHalf() 26Half result;
System\Formats\Cbor\Writer\CborWriter.Simple.cs (2)
26TryConvertSingleToHalf(value, out var half)) 48if (TryConvertSingleToHalf(single, out var half))
System\Formats\Cbor\Writer\CborWriter.Simple.netcoreapp.cs (4)
20public void WriteHalf(Half value) 24if (Half.IsNaN(value) && !CborConformanceModeHelpers.RequiresPreservingFloatPrecision(ConformanceMode)) 37internal static bool TryConvertSingleToHalf(float value, out Half result) 39result = (Half)value;
System.Numerics.Tensors (179)
System\Numerics\Tensors\netcore\TensorPrimitives.Abs.cs (1)
32if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, AbsoluteOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Add.cs (2)
29if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, AddOperator<float>>(x, y, destination)) 54if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, AddOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.AddMultiply.cs (3)
31if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, AddMultiplyOperator<float>>(x, y, multiplier, destination)) 59if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, AddMultiplyOperator<float>>(x, y, multiplier, destination)) 87if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, AddMultiplyOperator<float>>(x, y, multiplier, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.BitwiseAnd.cs (2)
26if (typeof(T) == typeof(Half) && TryBinaryBitwiseInvokeHalfAsInt16<T, BitwiseAndOperator<short>>(x, y, destination)) 48if (typeof(T) == typeof(Half) && TryBinaryBitwiseInvokeHalfAsInt16<T, BitwiseAndOperator<short>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.BitwiseOr.cs (2)
26if (typeof(T) == typeof(Half) && TryBinaryBitwiseInvokeHalfAsInt16<T, BitwiseOrOperator<short>>(x, y, destination)) 48if (typeof(T) == typeof(Half) && TryBinaryBitwiseInvokeHalfAsInt16<T, BitwiseOrOperator<short>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Ceiling.cs (1)
24if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, CeilingOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Clamp.cs (7)
35if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, ClampOperatorXMinMax<float>>(x, min, max, destination)) 64if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, ClampOperatorXMinMax<float>>(x, min, max, destination)) 93if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, ClampOperatorXMinMax<float>>(x, min, max, destination)) 122if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, ClampOperatorMinMaxX<float>>(min, max, x, destination)) 154if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, ClampOperatorXMinMax<float>>(x, min, max, destination)) 181if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, ClampOperatorMinMaxX<float>>(min, max, x, destination)) 208if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, ClampOperatorMaxXMin<float>>(max, x, min, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertHelpers.cs (5)
128if (typeof(TFrom) == typeof(Half)) 139if (typeof(TTo) == typeof(Half)) 392public static float Invoke(short x) => (float)Unsafe.BitCast<short, Half>(x); 573public static ushort Invoke(float x) => Unsafe.BitCast<Half, ushort>((Half)x);
System\Numerics\Tensors\netcore\TensorPrimitives.CopySign.cs (2)
26if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, CopySignOperator<float>>(x, sign, destination)) 48if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, CopySignOperator<float>>(x, sign, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Cos.cs (1)
32if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, CosOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Cosh.cs (1)
35if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, CoshOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.CosineSimilarity.cs (17)
34if (typeof(T) == typeof(Half)) 37return (T)(object)CosineSimilarityHalfCore(Rename<T, Half>(x), Rename<T, Half>(y)); 183/// <summary>Provides the same implementation as <see cref="CosineSimilarityCore"/>, but specifically for <see cref="Half"/>.</summary> 184private static Half CosineSimilarityHalfCore(ReadOnlySpan<Half> x, ReadOnlySpan<Half> y) 203ref short xRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(x)); 204ref short yRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(y)); 240return (Half)Finalize(dotProductVector, xSumOfSquaresVector, ySumOfSquaresVector); 245ref short xRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(x)); 246ref short yRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(y)); 282return (Half)Finalize(dotProductVector, xSumOfSquaresVector, ySumOfSquaresVector); 287ref short xRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(x)); 288ref short yRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(y)); 324return (Half)Finalize(dotProductVector, xSumOfSquaresVector, ySumOfSquaresVector); 335return (Half)Finalize(dotProduct, xSumOfSquares, ySumOfSquares);
System\Numerics\Tensors\netcore\TensorPrimitives.CosPi.cs (1)
31if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, CosPiOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Decrement.cs (1)
23if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, DecrementOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.DegreesToRadians.cs (1)
24if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, DegreesToRadiansOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Divide.cs (3)
29if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, DivideOperator<float>>(x, y, destination)) 55if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, DivideOperator<float>>(x, y, destination)) 81if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, DivideOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Exp.cs (1)
32if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, ExpOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Exp10.cs (1)
27if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, Exp10Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Exp10M1.cs (1)
27if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, Exp10M1Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Exp2.cs (1)
27if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, Exp2Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Exp2M1.cs (1)
27if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, Exp2M1Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.ExpM1.cs (1)
27if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, ExpM1Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Floor.cs (1)
24if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, FloorOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.FusedMultiplyAdd.cs (3)
40if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, FusedMultiplyAddOperator<float>>(x, y, addend, destination)) 75if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, FusedMultiplyAddOperator<float>>(x, y, addend, destination)) 109if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, FusedMultiplyAddOperator<float>>(x, y, addend, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Half.cs (48)
27public static void ConvertToHalf(ReadOnlySpan<float> source, Span<Half> destination) => 45public static void ConvertToSingle(ReadOnlySpan<Half> source, Span<float> destination) => 52Debug.Assert(typeof(T) == typeof(Half)); 54if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 69Debug.Assert(typeof(T) == typeof(Half)); 86Debug.Assert(typeof(T) == typeof(Half)); 88if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 104Debug.Assert(typeof(T) == typeof(Half)); 106if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 110BitConverter.HalfToInt16Bits((Half)(object)y!), 122Debug.Assert(typeof(T) == typeof(Half)); 124if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(y))) 127BitConverter.HalfToInt16Bits((Half)(object)x!), 140Debug.Assert(typeof(T) == typeof(Half)); 158Debug.Assert(typeof(T) == typeof(Half)); 164BitConverter.HalfToInt16Bits((Half)(object)y!), 176Debug.Assert(typeof(T) == typeof(Half)); 178if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 194Debug.Assert(typeof(T) == typeof(Half)); 196if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 200BitConverter.HalfToInt16Bits((Half)(object)y!), 212if (typeof(T) == typeof(Half) && IsVectorizable(Rename<T, Half>(x))) 228Debug.Assert(typeof(T) == typeof(Half)); 230if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 247Debug.Assert(typeof(T) == typeof(Half)); 249if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 253BitConverter.HalfToInt16Bits((Half)(object)y!), 266Debug.Assert(typeof(T) == typeof(Half)); 268if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 273BitConverter.HalfToInt16Bits((Half)(object)z!), 285Debug.Assert(typeof(T) == typeof(Half)); 287if (TOp.Vectorizable && IsVectorizable(Rename<T, Half>(x))) 291BitConverter.HalfToInt16Bits((Half)(object)y!), 292BitConverter.HalfToInt16Bits((Half)(object)z!), 305private static bool IsVectorizable(ReadOnlySpan<Half> source) => 309/// <summary><see cref="IUnaryOperator{T, T}"/> wrapper for working with <see cref="Half"/> reinterpreted as <see cref="short"/> in order to enable vectorization.</summary> 317(Half)TUnary.Invoke((float)BitConverter.Int16BitsToHalf(x))); 344/// <summary><see cref="IBinaryOperator{T}"/> wrapper for working with <see cref="Half"/> reinterpreted as <see cref="short"/> in order to enable vectorization.</summary> 351BitConverter.HalfToInt16Bits((Half)TBinary.Invoke( 383/// <summary><see cref="IAggregationOperator{T}"/> wrapper for working with <see cref="Half"/> reinterpreted as <see cref="short"/> in order to enable vectorization.</summary> 390BitConverter.HalfToInt16Bits((Half)TAggregate.Invoke( 424return BitConverter.HalfToInt16Bits((Half)TAggregate.Invoke( 432return BitConverter.HalfToInt16Bits((Half)TAggregate.Invoke( 440return BitConverter.HalfToInt16Bits((Half)TAggregate.Invoke( 445public static short IdentityValue => BitConverter.HalfToInt16Bits((Half)TAggregate.IdentityValue); 448/// <summary><see cref="ITernaryOperator{T}"/> wrapper for working with <see cref="Half"/> reinterpreted as <see cref="short"/> in order to enable vectorization.</summary> 455BitConverter.HalfToInt16Bits((Half)TTernary.Invoke(
System\Numerics\Tensors\netcore\TensorPrimitives.Hypot.cs (1)
27if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, HypotOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Increment.cs (1)
23if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, IncrementOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Lerp.cs (3)
32if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, LerpOperator<float>>(x, y, amount, destination)) 60if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, LerpOperator<float>>(x, y, amount, destination)) 88if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, LerpOperator<float>>(x, y, amount, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Log.cs (3)
34if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, LogOperator<float>>(x, destination)) 62if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, LogBaseOperator<float>>(x, y, destination)) 88if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, LogBaseOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Log10.cs (1)
33if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, Log10Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Log10P1.cs (1)
33if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, Log10P1Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Log2.cs (1)
34if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, Log2Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Log2P1.cs (1)
33if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, Log2P1Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.LogP1.cs (1)
33if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, LogP1Operator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Max.cs (3)
31if (typeof(T) == typeof(Half) && TryMinMaxHalfAsInt16<T, MaxOperator<float>>(x, out T result)) 63if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MaxOperator<float>>(x, y, destination)) 93if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MaxOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.MaxMagnitude.cs (3)
29if (typeof(T) == typeof(Half) && TryMinMaxHalfAsInt16<T, MaxMagnitudeOperator<float>>(x, out T result)) 55if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MaxMagnitudeOperator<float>>(x, y, destination)) 79if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MaxMagnitudeOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.MaxMagnitudeNumber.cs (3)
30if (typeof(T) == typeof(Half) && TryMinMaxHalfAsInt16<T, MaxMagnitudeNumberOperator<float>>(x, out T result)) 63if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MaxMagnitudeNumberOperator<float>>(x, y, destination)) 94if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MaxMagnitudeNumberOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.MaxNumber.cs (3)
30if (typeof(T) == typeof(Half) && TryMinMaxHalfAsInt16<T, MaxNumberOperator<float>>(x, out T result)) 62if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MaxNumberOperator<float>>(x, y, destination)) 92if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MaxNumberOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Min.cs (3)
29if (typeof(T) == typeof(Half) && TryMinMaxHalfAsInt16<T, MinOperator<float>>(x, out T result)) 61if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MinOperator<float>>(x, y, destination)) 91if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MinOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.MinMagnitude.cs (3)
29if (typeof(T) == typeof(Half) && TryMinMaxHalfAsInt16<T, MinMagnitudeOperator<float>>(x, out T result)) 60if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MinMagnitudeOperator<float>>(x, y, destination)) 89if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MinMagnitudeOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.MinMagnitudeNumber.cs (3)
30if (typeof(T) == typeof(Half) && TryMinMaxHalfAsInt16<T, MinMagnitudeNumberOperator<float>>(x, out T result)) 63if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MinMagnitudeNumberOperator<float>>(x, y, destination)) 94if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MinMagnitudeNumberOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.MinNumber.cs (3)
30if (typeof(T) == typeof(Half) && TryMinMaxHalfAsInt16<T, MinNumberOperator<float>>(x, out T result)) 62if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MinNumberOperator<float>>(x, y, destination)) 92if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MinNumberOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Multiply.cs (2)
29if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MultiplyOperator<float>>(x, y, destination)) 55if (typeof(T) == typeof(Half) && TryAggregateInvokeHalfAsInt16<T, MultiplyOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.MultiplyAdd.cs (3)
31if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, MultiplyAddOperator<float>>(x, y, addend, destination)) 60if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, MultiplyAddOperator<float>>(x, y, addend, destination)) 88if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, MultiplyAddOperator<float>>(x, y, addend, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.MultiplyAddEstimate.cs (3)
39if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, MultiplyAddEstimateOperator<float>>(x, y, addend, destination)) 72if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, MultiplyAddEstimateOperator<float>>(x, y, addend, destination)) 104if (typeof(T) == typeof(Half) && TryTernaryInvokeHalfAsInt16<T, MultiplyAddEstimateOperator<float>>(x, y, addend, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Negate.cs (1)
26if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, NegateOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.OnesComplement.cs (1)
23if (typeof(T) == typeof(Half) && TryUnaryBitwiseInvokeHalfAsInt16<T, OnesComplementOperator<short>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Reciprocal.cs (4)
26if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, ReciprocalOperator<float>>(x, destination)) 48if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, ReciprocalEstimateOperator<float>>(x, destination)) 70if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, ReciprocalSqrtOperator<float>>(x, destination)) 92if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, ReciprocalSqrtEstimateOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Remainder.cs (3)
29if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, RemainderOperator<float>>(x, y, destination)) 55if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, RemainderOperator<float>>(x, y, destination)) 81if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, RemainderOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Round.cs (2)
27if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, RoundToEvenOperator<float>>(x, destination)) 56if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, RoundAwayFromZeroOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Sigmoid.cs (1)
33if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, SigmoidOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Sin.cs (1)
31if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, SinOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Sinh.cs (1)
35if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, SinhOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.SinPi.cs (1)
31if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, SinPiOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Sqrt.cs (1)
23if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, SqrtOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Subtract.cs (3)
29if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, SubtractOperator<float>>(x, y, destination)) 54if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, SubtractOperator<float>>(x, y, destination)) 79if (typeof(T) == typeof(Half) && TryBinaryInvokeHalfAsInt16<T, SubtractOperator<float>>(x, y, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Tan.cs (1)
31if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, TanOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Tanh.cs (1)
35if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, TanhOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.TanPi.cs (1)
30if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, TanPiOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Truncate.cs (1)
26if (typeof(T) == typeof(Half) && TryUnaryInvokeHalfAsInt16<T, TruncateOperator<float>>(x, destination))
System\Numerics\Tensors\netcore\TensorPrimitives.Xor.cs (2)
26if (typeof(T) == typeof(Half) && TryBinaryBitwiseInvokeHalfAsInt16<T, XorOperator<short>>(x, y, destination)) 48if (typeof(T) == typeof(Half) && TryBinaryBitwiseInvokeHalfAsInt16<T, XorOperator<short>>(x, y, destination))
System\Numerics\Tensors\TensorPrimitives.Helpers.cs (1)
88typeof(T) == typeof(Half) ||
System.Private.CoreLib (744)
src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (12)
315public static unsafe byte[] GetBytes(Half value) 317byte[] bytes = new byte[sizeof(Half)]; 329public static unsafe bool TryWriteBytes(Span<byte> destination, Half value) 331if (destination.Length < sizeof(Half)) 704public static Half ToHalf(byte[] value, int startIndex) => Int16BitsToHalf(ToInt16(value, startIndex)); 713public static unsafe Half ToHalf(ReadOnlySpan<byte> value) 715if (value.Length < sizeof(Half)) 717return Unsafe.ReadUnaligned<Half>(ref MemoryMarshal.GetReference(value)); 940public static short HalfToInt16Bits(Half value) => (short)value._value; 948public static Half Int16BitsToHalf(short value) => new Half((ushort)(value)); 993public static ushort HalfToUInt16Bits(Half value) => value._value; 1002public static Half UInt16BitsToHalf(ushort value) => new Half(value);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadBigEndian.cs (7)
29/// Reads a <see cref="Half" /> from the beginning of a read-only span of bytes, as big endian. 35/// <paramref name="source"/> is too small to contain a <see cref="Half" />. 38public static Half ReadHalfBigEndian(ReadOnlySpan<byte> source) 42MemoryMarshal.Read<Half>(source); 260/// Reads a <see cref="Half" /> from the beginning of a read-only span of bytes, as big endian. 265/// <see langword="true" /> if the span is large enough to contain a <see cref="Half" />; otherwise, <see langword="false" />. 269public static bool TryReadHalfBigEndian(ReadOnlySpan<byte> source, out Half value)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadLittleEndian.cs (7)
29/// Reads a <see cref="Half" /> from the beginning of a read-only span of bytes, as little endian. 35/// <paramref name="source"/> is too small to contain a <see cref="Half" />. 38public static Half ReadHalfLittleEndian(ReadOnlySpan<byte> source) 42MemoryMarshal.Read<Half>(source); 260/// Reads a <see cref="Half" /> from the beginning of a read-only span of bytes, as little endian. 265/// <see langword="true" /> if the span is large enough to contain a <see cref="Half" />; otherwise, <see langword="false" />. 269public static bool TryReadHalfLittleEndian(ReadOnlySpan<byte> source, out Half value)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (6)
35/// Writes a <see cref="Half" /> into a span of bytes, as big endian. 41/// <paramref name="destination" /> is too small to contain a <see cref="Half" />. 44public static void WriteHalfBigEndian(Span<byte> destination, Half value) 337/// Writes a <see cref="Half" /> into a span of bytes, as big endian. 342/// <see langword="true" /> if the span is large enough to contain a <see cref="Half" />; otherwise, <see langword="false" />. 346public static bool TryWriteHalfBigEndian(Span<byte> destination, Half value)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (6)
35/// Writes a <see cref="Half" /> into a span of bytes, as little endian. 41/// <paramref name="destination" /> is too small to contain a <see cref="Half" />. 44public static void WriteHalfLittleEndian(Span<byte> destination, Half value) 337/// Writes a <see cref="Half" /> into a span of bytes, as little endian. 342/// <see langword="true" /> if the span is large enough to contain a <see cref="Half" />; otherwise, <see langword="false" />. 346public static bool TryWriteHalfLittleEndian(Span<byte> destination, Half value)
src\libraries\System.Private.CoreLib\src\System\Byte.cs (6)
903else if (typeof(TOther) == typeof(Half)) 905Half actualResult = value; 977else if (typeof(TOther) == typeof(Half)) 979Half actualResult = value; 1051else if (typeof(TOther) == typeof(Half)) 1053Half actualResult = value;
src\libraries\System.Private.CoreLib\src\System\Char.cs (9)
1749else if (typeof(TOther) == typeof(Half)) 1751Half actualResult = (Half)value; 1823else if (typeof(TOther) == typeof(Half)) 1825Half actualResult = (Half)value; 1897else if (typeof(TOther) == typeof(Half)) 1899Half actualResult = (Half)value;
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ArraySortHelper.cs (17)
296typeof(T) == typeof(Half)) 585if (typeof(T) == typeof(Half)) return (Half)(object)left < (Half)(object)right; 604if (typeof(T) == typeof(Half)) return (Half)(object)left > (Half)(object)right; 847typeof(TKey) == typeof(Half)) 1082if (typeof(TKey) == typeof(Half)) return (Half)(object)left < (Half)(object)right; 1101if (typeof(TKey) == typeof(Half)) return (Half)(object)left > (Half)(object)right; 1121(typeof(TKey) == typeof(Half) && Half.IsNaN((Half)(object)keys[i])))
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (6)
1657else if (typeof(TOther) == typeof(Half)) 1659Half actualResult = checked((Half)value); 1745else if (typeof(TOther) == typeof(Half)) 1747Half actualResult = (Half)value;
src\libraries\System.Private.CoreLib\src\System\Double.cs (3)
1242if (typeof(TOther) == typeof(Half)) 1244Half actualValue = (Half)(object)value;
src\libraries\System.Private.CoreLib\src\System\Half.cs (533)
23IComparable<Half>, 24IEquatable<Half>, 25IBinaryFloatingPointIeee754<Half>, 26IMinMaxValue<Half>, 28IBinaryFloatParseAndFormatInfo<Half> 89public static Half Epsilon => new Half(EpsilonBits); // 5.9604645E-08 91public static Half PositiveInfinity => new Half(PositiveInfinityBits); // 1.0 / 0.0; 93public static Half NegativeInfinity => new Half(NegativeInfinityBits); // -1.0 / 0.0 95public static Half NaN => new Half(NegativeQNaNBits); // 0.0 / 0.0 98public static Half MinValue => new Half(MinValueBits); // -65504 101public static Half MaxValue => new Half(MaxValueBits); // 65504 157public static bool operator <(Half left, Half right) 179public static bool operator >(Half left, Half right) 185public static bool operator <=(Half left, Half right) 207public static bool operator >=(Half left, Half right) 213public static bool operator ==(Half left, Half right) 226public static bool operator !=(Half left, Half right) 234public static bool IsFinite(Half value) 242public static bool IsInfinity(Half value) 250public static bool IsNaN(Half value) 257internal static bool IsNaNOrZero(Half value) 265public static bool IsNegative(Half value) 272public static bool IsNegativeInfinity(Half value) 280public static bool IsNormal(Half value) 288public static bool IsPositiveInfinity(Half value) 296public static bool IsSubnormal(Half value) 303internal static bool IsZero(Half value) 310/// Parses a <see cref="Half"/> from a <see cref="string"/> in the default parse style. 313/// <returns>The equivalent <see cref="Half"/> value representing the input string. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. </returns> 314public static Half Parse(string s) => Parse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider: null); 317/// Parses a <see cref="Half"/> from a <see cref="string"/> in the given <see cref="NumberStyles"/>. 321/// <returns>The equivalent <see cref="Half"/> value representing the input string. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. </returns> 322public static Half Parse(string s, NumberStyles style) => Parse(s, style, provider: null); 325/// Parses a <see cref="Half"/> from a <see cref="string"/> and <see cref="IFormatProvider"/>. 329/// <returns>The equivalent <see cref="Half"/> value representing the input string. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. </returns> 330public static Half Parse(string s, IFormatProvider? provider) => Parse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider); 333/// Parses a <see cref="Half"/> from a <see cref="string"/> with the given <see cref="NumberStyles"/> and <see cref="IFormatProvider"/>. 338/// <returns>The equivalent <see cref="Half"/> value representing the input string. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. </returns> 339public static Half Parse(string s, NumberStyles style = DefaultParseStyle, IFormatProvider? provider = null) 349/// Parses a <see cref="Half"/> from a <see cref="ReadOnlySpan{Char}"/> and <see cref="IFormatProvider"/>. 354/// <returns>The equivalent <see cref="Half"/> value representing the input string. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. </returns> 355public static Half Parse(ReadOnlySpan<char> s, NumberStyles style = DefaultParseStyle, IFormatProvider? provider = null) 358return Number.ParseFloat<char, Half>(s, style, NumberFormatInfo.GetInstance(provider)); 362/// Tries to parse a <see cref="Half"/> from a <see cref="string"/> in the default parse style. 365/// <param name="result">The equivalent <see cref="Half"/> value representing the input string if the parse was successful. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. If the parse was unsuccessful, a default <see cref="Half"/> value is returned.</param> 367public static bool TryParse([NotNullWhen(true)] string? s, out Half result) => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider: null, out result); 370/// Tries to parse a <see cref="Half"/> from a <see cref="ReadOnlySpan{Char}"/> in the default parse style. 373/// <param name="result">The equivalent <see cref="Half"/> value representing the input string if the parse was successful. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. If the parse was unsuccessful, a default <see cref="Half"/> value is returned.</param> 375public static bool TryParse(ReadOnlySpan<char> s, out Half result) => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider: null, out result); 381public static bool TryParse(ReadOnlySpan<byte> utf8Text, out Half result) => TryParse(utf8Text, NumberStyles.Float | NumberStyles.AllowThousands, provider: null, out result); 384/// Tries to parse a <see cref="Half"/> from a <see cref="string"/> with the given <see cref="NumberStyles"/> and <see cref="IFormatProvider"/>. 389/// <param name="result">The equivalent <see cref="Half"/> value representing the input string if the parse was successful. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. If the parse was unsuccessful, a default <see cref="Half"/> value is returned.</param> 391public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Half result) 404/// Tries to parse a <see cref="Half"/> from a <see cref="ReadOnlySpan{Char}"/> with the given <see cref="NumberStyles"/> and <see cref="IFormatProvider"/>. 409/// <param name="result">The equivalent <see cref="Half"/> value representing the input string if the parse was successful. If the input exceeds Half's range, a <see cref="PositiveInfinity"/> or <see cref="NegativeInfinity"/> is returned. If the parse was unsuccessful, a default <see cref="Half"/> value is returned.</param> 411public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Half result) 417private static bool AreZero(Half left, Half right) 429/// <exception cref="ArgumentException">Thrown when <paramref name="obj"/> is not of type <see cref="Half"/>.</exception> 432if (obj is not Half other) 443public int CompareTo(Half other) 474return (obj is Half other) && Equals(other); 480public bool Equals(Half other) 561public static explicit operator Half(char value) => (Half)(float)value; 566public static explicit operator Half(decimal value) => (Half)(float)value; 571public static explicit operator Half(double value) 600public static explicit operator Half(short value) => (Half)(float)value; 605public static explicit operator Half(int value) => (Half)(float)value; 610public static explicit operator Half(long value) => (Half)(float)value; 615public static explicit operator Half(nint value) => (Half)(float)value; 620public static explicit operator Half(float value) 787public static explicit operator Half(ushort value) => (Half)(float)value; 793public static explicit operator Half(uint value) => (Half)(float)value; 799public static explicit operator Half(ulong value) => (Half)(float)value; 805public static explicit operator Half(nuint value) => (Half)(float)value; 814public static explicit operator byte(Half value) => (byte)(float)value; 820public static explicit operator checked byte(Half value) => checked((byte)(float)value); 825public static explicit operator char(Half value) => (char)(float)value; 831public static explicit operator checked char(Half value) => checked((char)(float)value); 836public static explicit operator decimal(Half value) => (decimal)(float)value; 841public static explicit operator short(Half value) => (short)(float)value; 847public static explicit operator checked short(Half value) => checked((short)(float)value); 852public static explicit operator int(Half value) => (int)(float)value; 858public static explicit operator checked int(Half value) => checked((int)(float)value); 863public static explicit operator long(Half value) => (long)(float)value; 869public static explicit operator checked long(Half value) => checked((long)(float)value); 874public static explicit operator Int128(Half value) => (Int128)(double)(value); 880public static explicit operator checked Int128(Half value) => checked((Int128)(double)(value)); 885public static explicit operator nint(Half value) => (nint)(float)value; 891public static explicit operator checked nint(Half value) => checked((nint)(float)value); 897public static explicit operator sbyte(Half value) => (sbyte)(float)value; 904public static explicit operator checked sbyte(Half value) => checked((sbyte)(float)value); 910public static explicit operator ushort(Half value) => (ushort)(float)value; 917public static explicit operator checked ushort(Half value) => checked((ushort)(float)value); 923public static explicit operator uint(Half value) => (uint)(float)value; 930public static explicit operator checked uint(Half value) => checked((uint)(float)value); 936public static explicit operator ulong(Half value) => (ulong)(float)value; 943public static explicit operator checked ulong(Half value) => checked((ulong)(float)value); 949public static explicit operator UInt128(Half value) => (UInt128)(double)(value); 956public static explicit operator checked UInt128(Half value) => checked((UInt128)(double)(value)); 962public static explicit operator nuint(Half value) => (nuint)(float)value; 969public static explicit operator checked nuint(Half value) => checked((nuint)(float)value); 978public static implicit operator Half(byte value) => (Half)(float)value; 984public static implicit operator Half(sbyte value) => (Half)(float)value; 993public static explicit operator double(Half value) 1024public static explicit operator float(Half value) 1098internal static Half Negate(Half value) 1113private static Half CreateHalfNaN(bool sign, ulong significand) 1191public static Half operator +(Half left, Half right) => (Half)((float)left + (float)right); 1198static Half IAdditiveIdentity<Half, Half>.AdditiveIdentity => new Half(PositiveZeroBits); 1205static Half IBinaryNumber<Half>.AllBitsSet => BitConverter.UInt16BitsToHalf(0xFFFF); 1208public static bool IsPow2(Half value) 1237public static Half Log2(Half value) => (Half)MathF.Log2((float)value); 1244static Half IBitwiseOperators<Half, Half, Half>.operator &(Half left, Half right) 1250static Half IBitwiseOperators<Half, Half, Half>.operator |(Half left, Half right) 1256static Half IBitwiseOperators<Half, Half, Half>.operator ^(Half left, Half right) 1262static Half IBitwiseOperators<Half, Half, Half>.operator ~(Half value) 1272public static Half operator --(Half value) 1276return (Half)tmp; 1284public static Half operator /(Half left, Half right) => (Half)((float)left / (float)right); 1291public static Half Exp(Half x) => (Half)MathF.Exp((float)x); 1294public static Half ExpM1(Half x) => (Half)float.ExpM1((float)x); 1297public static Half Exp2(Half x) => (Half)float.Exp2((float)x); 1300public static Half Exp2M1(Half x) => (Half)float.Exp2M1((float)x); 1303public static Half Exp10(Half x) => (Half)float.Exp10((float)x); 1306public static Half Exp10M1(Half x) => (Half)float.Exp10M1((float)x); 1313public static Half Ceiling(Half x) => (Half)MathF.Ceiling((float)x); 1316public static TInteger ConvertToInteger<TInteger>(Half value) 1320public static TInteger ConvertToIntegerNative<TInteger>(Half value) 1324public static Half Floor(Half x) => (Half)MathF.Floor((float)x); 1327public static Half Round(Half x) => (Half)MathF.Round((float)x); 1330public static Half Round(Half x, int digits) => (Half)MathF.Round((float)x, digits); 1333public static Half Round(Half x, MidpointRounding mode) => (Half)MathF.Round((float)x, mode); 1336public static Half Round(Half x, int digits, MidpointRounding mode) => (Half)MathF.Round((float)x, digits, mode); 1339public static Half Truncate(Half x) => (Half)MathF.Truncate((float)x); 1342int IFloatingPoint<Half>.GetExponentByteCount() => sizeof(sbyte); 1345int IFloatingPoint<Half>.GetExponentShortestBitLength() 1360int IFloatingPoint<Half>.GetSignificandByteCount() => sizeof(ushort); 1363int IFloatingPoint<Half>.GetSignificandBitLength() => 11; 1366bool IFloatingPoint<Half>.TryWriteExponentBigEndian(Span<byte> destination, out int bytesWritten) 1380bool IFloatingPoint<Half>.TryWriteExponentLittleEndian(Span<byte> destination, out int bytesWritten) 1394bool IFloatingPoint<Half>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten) 1407bool IFloatingPoint<Half>.TryWriteSignificandLittleEndian(Span<byte> destination, out int bytesWritten) 1424public static Half E => new Half(EBits); 1427public static Half Pi => new Half(PiBits); 1430public static Half Tau => new Half(TauBits); 1437public static Half NegativeZero => new Half(NegativeZeroBits); 1440public static Half Atan2(Half y, Half x) => (Half)MathF.Atan2((float)y, (float)x); 1443public static Half Atan2Pi(Half y, Half x) => (Half)float.Atan2Pi((float)y, (float)x); 1446public static Half BitDecrement(Half x) 1479public static Half BitIncrement(Half x) 1512public static Half FusedMultiplyAdd(Half left, Half right, Half addend) => (Half)MathF.FusedMultiplyAdd((float)left, (float)right, (float)addend); 1515public static Half Ieee754Remainder(Half left, Half right) => (Half)MathF.IEEERemainder((float)left, (float)right); 1518public static int ILogB(Half x) 1546public static Half Lerp(Half value1, Half value2, Half amount) => (Half)float.Lerp((float)value1, (float)value2, (float)amount); 1549public static Half ReciprocalEstimate(Half x) => (Half)MathF.ReciprocalEstimate((float)x); 1552public static Half ReciprocalSqrtEstimate(Half x) => (Half)MathF.ReciprocalSqrtEstimate((float)x); 1555public static Half ScaleB(Half x, int n) => (Half)MathF.ScaleB((float)x, n); 1565public static Half Acosh(Half x) => (Half)MathF.Acosh((float)x); 1568public static Half Asinh(Half x) => (Half)MathF.Asinh((float)x); 1571public static Half Atanh(Half x) => (Half)MathF.Atanh((float)x); 1574public static Half Cosh(Half x) => (Half)MathF.Cosh((float)x); 1577public static Half Sinh(Half x) => (Half)MathF.Sinh((float)x); 1580public static Half Tanh(Half x) => (Half)MathF.Tanh((float)x); 1587public static Half operator ++(Half value) 1591return (Half)tmp; 1599public static Half Log(Half x) => (Half)MathF.Log((float)x); 1602public static Half Log(Half x, Half newBase) => (Half)MathF.Log((float)x, (float)newBase); 1605public static Half Log10(Half x) => (Half)MathF.Log10((float)x); 1608public static Half LogP1(Half x) => (Half)float.LogP1((float)x); 1611public static Half Log2P1(Half x) => (Half)float.Log2P1((float)x); 1614public static Half Log10P1(Half x) => (Half)float.Log10P1((float)x); 1621public static Half operator %(Half left, Half right) => (Half)((float)left % (float)right); 1628public static Half MultiplicativeIdentity => new Half(PositiveOneBits); 1635public static Half operator *(Half left, Half right) => (Half)((float)left * (float)right); 1642public static Half Clamp(Half value, Half min, Half max) => (Half)float.Clamp((float)value, (float)min, (float)max); 1645public static Half ClampNative(Half value, Half min, Half max) 1655public static Half CopySign(Half value, Half sign) 1668public static Half Max(Half x, Half y) => (Half)float.Max((float)x, (float)y); 1671public static Half MaxNative(Half x, Half y) => (x > y) ? x : y; 1674public static Half MaxNumber(Half x, Half y) 1696public static Half Min(Half x, Half y) => (Half)float.Min((float)x, (float)y); 1699public static Half MinNative(Half x, Half y) => (x < y) ? x : y; 1702public static Half MinNumber(Half x, Half y) 1724public static int Sign(Half value) 1748public static Half One => new Half(PositiveOneBits); 1751static int INumberBase<Half>.Radix => 2; 1754public static Half Zero => new Half(PositiveZeroBits); 1757public static Half Abs(Half value) => new Half((ushort)(value._value & ~SignMask)); 1761public static Half CreateChecked<TOther>(TOther value) 1764Half result; 1766if (typeof(TOther) == typeof(Half)) 1768result = (Half)(object)value; 1780public static Half CreateSaturating<TOther>(TOther value) 1783Half result; 1785if (typeof(TOther) == typeof(Half)) 1787result = (Half)(object)value; 1799public static Half CreateTruncating<TOther>(TOther value) 1802Half result; 1804if (typeof(TOther) == typeof(Half)) 1806result = (Half)(object)value; 1817static bool INumberBase<Half>.IsCanonical(Half value) => true; 1820static bool INumberBase<Half>.IsComplexNumber(Half value) => false; 1823public static bool IsEvenInteger(Half value) => float.IsEvenInteger((float)value); 1826static bool INumberBase<Half>.IsImaginaryNumber(Half value) => false; 1829public static bool IsInteger(Half value) => float.IsInteger((float)value); 1832public static bool IsOddInteger(Half value) => float.IsOddInteger((float)value); 1835public static bool IsPositive(Half value) => (short)(value._value) >= 0; 1838public static bool IsRealNumber(Half value) 1849static bool INumberBase<Half>.IsZero(Half value) => IsZero(value); 1852public static Half MaxMagnitude(Half x, Half y) => (Half)MathF.MaxMagnitude((float)x, (float)y); 1855public static Half MaxMagnitudeNumber(Half x, Half y) 1863Half ax = Abs(x); 1864Half ay = Abs(y); 1880public static Half MinMagnitude(Half x, Half y) => (Half)MathF.MinMagnitude((float)x, (float)y); 1883public static Half MinMagnitudeNumber(Half x, Half y) 1891Half ax = Abs(x); 1892Half ay = Abs(y); 1908public static Half MultiplyAddEstimate(Half left, Half right, Half addend) => (Half)float.MultiplyAddEstimate((float)left, (float)right, (float)addend); 1912static bool INumberBase<Half>.TryConvertFromChecked<TOther>(TOther value, out Half result) 1919static bool INumberBase<Half>.TryConvertFromSaturating<TOther>(TOther value, out Half result) 1926static bool INumberBase<Half>.TryConvertFromTruncating<TOther>(TOther value, out Half result) 1932private static bool TryConvertFrom<TOther>(TOther value, out Half result) 1947result = (Half)actualValue; 1953result = (Half)actualValue; 1959result = (Half)actualValue; 1965result = (Half)actualValue; 1971result = (Half)actualValue; 1977result = (Half)actualValue; 1989result = (Half)actualValue; 2001static bool INumberBase<Half>.TryConvertToChecked<TOther>(Half value, [MaybeNullWhen(false)] out TOther result) 2069static bool INumberBase<Half>.TryConvertToSaturating<TOther>(Half value, [MaybeNullWhen(false)] out TOther result) 2076static bool INumberBase<Half>.TryConvertToTruncating<TOther>(Half value, [MaybeNullWhen(false)] out TOther result) 2082private static bool TryConvertTo<TOther>(Half value, [MaybeNullWhen(false)] out TOther result) 2176public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Half result) => TryParse(s, DefaultParseStyle, provider, out result); 2183public static Half Pow(Half x, Half y) => (Half)MathF.Pow((float)x, (float)y); 2190public static Half Cbrt(Half x) => (Half)MathF.Cbrt((float)x); 2193public static Half Hypot(Half x, Half y) => (Half)float.Hypot((float)x, (float)y); 2196public static Half RootN(Half x, int n) => (Half)float.RootN((float)x, n); 2199public static Half Sqrt(Half x) => (Half)MathF.Sqrt((float)x); 2206public static Half NegativeOne => new Half(NegativeOneBits); 2213public static Half Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, DefaultParseStyle, provider); 2216public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Half result) => TryParse(s, DefaultParseStyle, provider, out result); 2223public static Half operator -(Half left, Half right) => (Half)((float)left - (float)right); 2230public static Half Acos(Half x) => (Half)MathF.Acos((float)x); 2233public static Half AcosPi(Half x) => (Half)float.AcosPi((float)x); 2236public static Half Asin(Half x) => (Half)MathF.Asin((float)x); 2239public static Half AsinPi(Half x) => (Half)float.AsinPi((float)x); 2242public static Half Atan(Half x) => (Half)MathF.Atan((float)x); 2245public static Half AtanPi(Half x) => (Half)float.AtanPi((float)x); 2248public static Half Cos(Half x) => (Half)MathF.Cos((float)x); 2251public static Half CosPi(Half x) => (Half)float.CosPi((float)x); 2254public static Half DegreesToRadians(Half degrees) 2259return (Half)float.DegreesToRadians((float)degrees); 2263public static Half RadiansToDegrees(Half radians) 2268return (Half)float.RadiansToDegrees((float)radians); 2272public static Half Sin(Half x) => (Half)MathF.Sin((float)x); 2275public static (Half Sin, Half Cos) SinCos(Half x) 2278return ((Half)sin, (Half)cos); 2282public static (Half SinPi, Half CosPi) SinCosPi(Half x) 2285return ((Half)sinPi, (Half)cosPi); 2289public static Half SinPi(Half x) => (Half)float.SinPi((float)x); 2292public static Half Tan(Half x) => (Half)MathF.Tan((float)x); 2295public static Half TanPi(Half x) => (Half)float.TanPi((float)x); 2302public static Half operator -(Half value) => (Half)(-(float)value); 2309public static Half operator +(Half value) => value; 2316public static Half Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Float | NumberStyles.AllowThousands, IFormatProvider? provider = null) 2319return Number.ParseFloat<byte, Half>(utf8Text, style, NumberFormatInfo.GetInstance(provider)); 2323public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Half result) 2330public static Half Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Float | NumberStyles.AllowThousands, provider); 2333public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Half result) => TryParse(utf8Text, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); 2339static int IBinaryFloatParseAndFormatInfo<Half>.NumberBufferLength => Number.HalfNumberBufferLength; 2341static ulong IBinaryFloatParseAndFormatInfo<Half>.ZeroBits => 0; 2342static ulong IBinaryFloatParseAndFormatInfo<Half>.InfinityBits => 0x7C00; 2344static ulong IBinaryFloatParseAndFormatInfo<Half>.NormalMantissaMask => (1UL << SignificandLength) - 1; 2345static ulong IBinaryFloatParseAndFormatInfo<Half>.DenormalMantissaMask => TrailingSignificandMask; 2347static int IBinaryFloatParseAndFormatInfo<Half>.MinBinaryExponent => 1 - MaxExponent; 2348static int IBinaryFloatParseAndFormatInfo<Half>.MaxBinaryExponent => MaxExponent; 2350static int IBinaryFloatParseAndFormatInfo<Half>.MinDecimalExponent => -8; 2351static int IBinaryFloatParseAndFormatInfo<Half>.MaxDecimalExponent => 5; 2353static int IBinaryFloatParseAndFormatInfo<Half>.ExponentBias => ExponentBias; 2354static ushort IBinaryFloatParseAndFormatInfo<Half>.ExponentBits => 5; 2356static int IBinaryFloatParseAndFormatInfo<Half>.OverflowDecimalExponent => (MaxExponent + (2 * SignificandLength)) / 3; 2357static int IBinaryFloatParseAndFormatInfo<Half>.InfinityExponent => 0x1F; 2359static ushort IBinaryFloatParseAndFormatInfo<Half>.NormalMantissaBits => SignificandLength; 2360static ushort IBinaryFloatParseAndFormatInfo<Half>.DenormalMantissaBits => TrailingSignificandLength; 2362static int IBinaryFloatParseAndFormatInfo<Half>.MinFastFloatDecimalExponent => -8; 2363static int IBinaryFloatParseAndFormatInfo<Half>.MaxFastFloatDecimalExponent => 4; 2365static int IBinaryFloatParseAndFormatInfo<Half>.MinExponentRoundToEven => -21; 2366static int IBinaryFloatParseAndFormatInfo<Half>.MaxExponentRoundToEven => 5; 2368static int IBinaryFloatParseAndFormatInfo<Half>.MaxExponentFastPath => 4; 2369static ulong IBinaryFloatParseAndFormatInfo<Half>.MaxMantissaFastPath => 2UL << TrailingSignificandLength; 2371static Half IBinaryFloatParseAndFormatInfo<Half>.BitsToFloat(ulong bits) => BitConverter.UInt16BitsToHalf((ushort)(bits)); 2373static ulong IBinaryFloatParseAndFormatInfo<Half>.FloatToBits(Half value) => BitConverter.HalfToUInt16Bits(value); 2375static int IBinaryFloatParseAndFormatInfo<Half>.MaxRoundTripDigits => 5; 2377static int IBinaryFloatParseAndFormatInfo<Half>.MaxPrecisionCustomFormat => 5;
src\libraries\System.Private.CoreLib\src\System\Int128.cs (14)
241/// <summary>Explicitly converts a 128-bit signed integer to a <see cref="Half" /> value.</summary> 243/// <returns><paramref name="value" /> converted to a <see cref="Half" />.</returns> 244public static explicit operator Half(Int128 value) 249return -(Half)(UInt128)(value); 251return (Half)(UInt128)(value); 1514else if (typeof(TOther) == typeof(Half)) 1516Half actualValue = (Half)(object)value; 1586else if (typeof(TOther) == typeof(Half)) 1588Half actualValue = (Half)(object)value; 1658else if (typeof(TOther) == typeof(Half)) 1660Half actualValue = (Half)(object)value;
src\libraries\System.Private.CoreLib\src\System\Int16.cs (9)
895else if (typeof(TOther) == typeof(Half)) 897Half actualValue = (Half)(object)value; 968else if (typeof(TOther) == typeof(Half)) 970Half actualValue = (Half)(object)value; 1047else if (typeof(TOther) == typeof(Half)) 1049Half actualValue = (Half)(object)value;
src\libraries\System.Private.CoreLib\src\System\Int32.cs (9)
936else if (typeof(TOther) == typeof(Half)) 938Half actualValue = (Half)(object)value; 1013else if (typeof(TOther) == typeof(Half)) 1015Half actualValue = (Half)(object)value; 1103else if (typeof(TOther) == typeof(Half)) 1105Half actualValue = (Half)(object)value;
src\libraries\System.Private.CoreLib\src\System\Int64.cs (9)
933else if (typeof(TOther) == typeof(Half)) 935Half actualValue = (Half)(object)value; 1010else if (typeof(TOther) == typeof(Half)) 1012Half actualValue = (Half)(object)value; 1098else if (typeof(TOther) == typeof(Half)) 1100Half actualValue = (Half)(object)value;
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (9)
928else if (typeof(TOther) == typeof(Half)) 930Half actualValue = (Half)(object)value; 1005else if (typeof(TOther) == typeof(Half)) 1007Half actualValue = (Half)(object)value; 1094else if (typeof(TOther) == typeof(Half)) 1096Half actualValue = (Half)(object)value;
src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (2)
225public virtual unsafe Half ReadHalf() => BinaryPrimitives.ReadHalfLittleEndian(InternalRead(stackalloc byte[sizeof(Half)]));
src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (1)
334public virtual void Write(Half value)
src\libraries\System.Private.CoreLib\src\System\Numerics\TotalOrderIeee754Comparer.cs (3)
61else if (typeof(T) == typeof(Half)) 63return CompareIntegerSemantic(BitConverter.HalfToInt16Bits((Half)(object)x!), BitConverter.HalfToInt16Bits((Half)(object)y!));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (15)
284/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="Half" /> value.</summary> 286/// <returns><paramref name="value" /> converted to its nearest representable <see cref="Half" /> value.</returns> 288public static explicit operator Half(NFloat value) => (Half)(value._value); 467/// <summary>Implicitly converts a <see cref="Half" /> value to its nearest representable native-sized floating-point value.</summary> 471public static implicit operator NFloat(Half value) => (NFloat)(float)value; 1441else if (typeof(TOther) == typeof(Half)) 1443Half actualValue = (Half)(object)value; 1554else if (typeof(TOther) == typeof(Half)) 1556Half actualResult = (Half)value; 1685else if (typeof(TOther) == typeof(Half)) 1687Half actualResult = (Half)value;
src\libraries\System.Private.CoreLib\src\System\SByte.cs (9)
858else if (typeof(TOther) == typeof(Half)) 860Half actualValue = (Half)(object)value; 931else if (typeof(TOther) == typeof(Half)) 933Half actualValue = (Half)(object)value; 1011else if (typeof(TOther) == typeof(Half)) 1013Half actualValue = (Half)(object)value;
src\libraries\System.Private.CoreLib\src\System\Single.cs (3)
1267else if (typeof(TOther) == typeof(Half)) 1269Half actualValue = (Half)(object)value;
src\libraries\System.Private.CoreLib\src\System\UInt128.cs (13)
285/// <summary>Explicitly converts a 128-bit unsigned integer to a <see cref="Half" /> value.</summary> 287/// <returns><paramref name="value" /> converted to a <see cref="Half" />.</returns> 288public static explicit operator Half(UInt128 value) => (Half)(double)(value); 1788else if (typeof(TOther) == typeof(Half)) 1790Half actualResult = (Half)value; 1862else if (typeof(TOther) == typeof(Half)) 1864Half actualResult = (Half)value; 1942else if (typeof(TOther) == typeof(Half)) 1944Half actualResult = (Half)value;
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (9)
922else if (typeof(TOther) == typeof(Half)) 924Half actualResult = (Half)value; 996else if (typeof(TOther) == typeof(Half)) 998Half actualResult = (Half)value; 1070else if (typeof(TOther) == typeof(Half)) 1072Half actualResult = (Half)value;
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (9)
961else if (typeof(TOther) == typeof(Half)) 963Half actualResult = (Half)value; 1035else if (typeof(TOther) == typeof(Half)) 1037Half actualResult = (Half)value; 1115else if (typeof(TOther) == typeof(Half)) 1117Half actualResult = (Half)value;
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (9)
960else if (typeof(TOther) == typeof(Half)) 962Half actualResult = (Half)value; 1034else if (typeof(TOther) == typeof(Half)) 1036Half actualResult = (Half)value; 1108else if (typeof(TOther) == typeof(Half)) 1110Half actualResult = (Half)value;
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (9)
963else if (typeof(TOther) == typeof(Half)) 965Half actualResult = (Half)value; 1037else if (typeof(TOther) == typeof(Half)) 1039Half actualResult = (Half)value; 1111else if (typeof(TOther) == typeof(Half)) 1113Half actualResult = (Half)value;
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
262[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Half))]
System.Runtime.Numerics (41)
System\Numerics\BigInteger.cs (26)
1887/// <summary>Explicitly converts a big integer to a <see cref="Half" /> value.</summary> 1889/// <returns><paramref name="value" /> converted to <see cref="Half" /> value.</returns> 1890public static explicit operator Half(BigInteger value) 1892return (Half)(double)value; 2140/// <summary>Explicitly converts a <see cref="Half" /> value to a big integer.</summary> 2143public static explicit operator BigInteger(Half value) 4245else if (typeof(TOther) == typeof(Half)) 4247Half actualValue = (Half)(object)value; 4362else if (typeof(TOther) == typeof(Half)) 4364Half actualValue = (Half)(object)value; 4365result = Half.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 4479else if (typeof(TOther) == typeof(Half)) 4481Half actualValue = (Half)(object)value; 4482result = Half.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 4592else if (typeof(TOther) == typeof(Half)) 4594Half actualResult = (Half)value; 4734else if (typeof(TOther) == typeof(Half)) 4736Half actualResult = (Half)value; 4939else if (typeof(TOther) == typeof(Half)) 4941Half actualResult = (Half)value;
System\Numerics\Complex.cs (15)
827/// <summary>Implicitly converts a <see cref="Half" /> value to a double-precision complex number.</summary> 830public static implicit operator Complex(Half value) 1525else if (typeof(TOther) == typeof(Half)) 1527Half actualValue = (Half)(object)value; 1658else if (typeof(TOther) == typeof(Half)) 1660Half actualResult = (value.m_imaginary != 0) ? Half.NaN : (Half)value.m_real; 1851else if (typeof(TOther) == typeof(Half)) 1853Half actualResult = (Half)value.m_real; 1987else if (typeof(TOther) == typeof(Half)) 1989Half actualResult = (Half)value.m_real;
System.Text.Json (35)
System\Text\Json\Nodes\JsonValueOfT.cs (1)
102if (type == typeof(Half) || type == typeof(UInt128) || type == typeof(Int128))
System\Text\Json\Reader\JsonReaderHelper.cs (4)
201public static bool TryGetFloatingPointConstant(ReadOnlySpan<byte> span, out Half value) 207value = Half.NaN; 215value = Half.PositiveInfinity; 223value = Half.NegativeInfinity;
System\Text\Json\Serialization\Converters\Value\HalfConverter.cs (25)
12internal sealed class HalfConverter : JsonPrimitiveConverter<Half> 22public override Half Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 32public override void Write(Utf8JsonWriter writer, Half value, JsonSerializerOptions options) 37private static Half ReadCore(ref Utf8JsonReader reader) 39Half result; 62Debug.Assert(!Half.IsNaN(result) && !Half.IsInfinity(result)); 66private static void WriteCore(Utf8JsonWriter writer, Half value) 73internal override Half ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 79internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, Half value, JsonSerializerOptions options, bool isWritingExtensionDataProperty) 86internal override Half ReadNumberWithCustomHandling(ref Utf8JsonReader reader, JsonNumberHandling handling, JsonSerializerOptions options) 92if (TryGetFloatingPointConstant(ref reader, out Half value)) 101if (!TryGetFloatingPointConstant(ref reader, out Half value)) 113internal override void WriteNumberWithCustomHandling(Utf8JsonWriter writer, Half value, JsonNumberHandling handling) 139private static bool TryGetFloatingPointConstant(ref Utf8JsonReader reader, out Half value) 176private static void WriteFloatingPointConstant(Utf8JsonWriter writer, Half value) 178if (Half.IsNaN(value)) 182else if (Half.IsPositiveInfinity(value)) 186else if (Half.IsNegativeInfinity(value)) 196private static bool TryParse(ReadOnlySpan<byte> buffer, out Half result) 198bool success = Half.TryParse(buffer, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out result); 203(!Half.IsNaN(result) || buffer.SequenceEqual(JsonConstants.NaNValue)) && 204(!Half.IsPositiveInfinity(result) || buffer.SequenceEqual(JsonConstants.PositiveInfinityValue)) && 205(!Half.IsNegativeInfinity(result) || buffer.SequenceEqual(JsonConstants.NegativeInfinityValue)); 210Half value, out int written)
System\Text\Json\Serialization\Converters\Value\JsonPrimitiveConverter.cs (1)
38Debug.Assert(isIeeeFloatingPoint == (typeof(T) == typeof(double) || typeof(T) == typeof(float) || typeof(T) == typeof(Half)));
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
193/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="Half"/> values. 196public static JsonConverter<Half> HalfConverter => s_halfConverter ??= new HalfConverter(); 197private static JsonConverter<Half>? s_halfConverter;
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (1)
727potentialNumberType == typeof(Half) ||
Test.Utilities (17)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (17)
311|| typeof(T) == typeof(Half) 626if (typeof(T) == typeof(Half)) 627return (Half)(object)left < (Half)(object)right; 660if (typeof(T) == typeof(Half)) 661return (Half)(object)left > (Half)(object)right; 913|| typeof(TKey) == typeof(Half) 1177if (typeof(TKey) == typeof(Half)) 1178return (Half)(object)left < (Half)(object)right; 1211if (typeof(TKey) == typeof(Half)) 1212return (Half)(object)left > (Half)(object)right; 1244|| (typeof(TKey) == typeof(Half) && Half.IsNaN((Half)(object)keys[i]))