You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library provides the floating-point numeric types Quarter, Half and BFloat16.
All types provided by this library are not hardware-accelerated and are implemented programmatically, so their performance is significantly lower than that of the native float and double types.
API reference
System
Quarter
Epsilon -> Quarterstatic readonlyRepresents the smallest positive System.Quarter value greater than zero.
MaxValue -> Quarterstatic readonlyRepresents the largest possible value of System.Quarter.
MinValue -> Quarterstatic readonlyRepresents the smallest possible value of System.Quarter.
NaN -> Quarterstatic readonlyRepresents not a number (NaN).
Quarter(float value) -> new QuarterInitializes a new instance of System.Quarter to the value of the specified single-precision floating-point number.
Quarter(int value) -> new QuarterInitializes a new instance of System.Quarter to the value of the specified 32-bit signed integer.
Quarter(long value) -> new QuarterInitializes a new instance of System.Quarter to the value of the specified 64-bit signed integer.
Quarter(double value) -> new QuarterInitializes a new instance of System.Quarter to the value of the specified double-precision floating-point number.
Quarter(decimal value) -> new QuarterInitializes a new instance of System.Quarter to the value of the specified decimal number.
Quarter(uint value) -> new QuarterInitializes a new instance of System.Quarter to the value of the specified 32-bit unsigned integer.
Quarter(ulong value) -> new QuarterInitializes a new instance of System.Quarter to the value of the specified 64-bit unsigned integer.
Negate(Quarter quarter) -> QuarterstaticReturns the result of multiplying the specified System.Quarter value by negative one.
Add(Quarter quarter1, Quarter quarter2) -> QuarterstaticAdds two specified System.Quarter values.
Substract(Quarter quarter1, Quarter quarter2) -> QuarterstaticSubtracts one specified System.Quarter value from another.
Multiply(Quarter quarter1, Quarter quarter2) -> QuarterstaticMultiplies two specified System.Quarter values.
Divide(Quarter quarter1, Quarter quarter2) -> QuarterstaticDivides two specified System.Quarter values.
+(Quarter quarter) -> QuarterReturns the value of the System.Quarter operand (the sign of the operand is unchanged).
-(Quarter quarter) -> QuarterNegates the value of the specified System.Quarter operand.
++(Quarter quarter) -> QuarterIncrements the System.Quarter operand by 1.
--(Quarter quarter) -> QuarterDecrements the System.Quarter operand by one.
+(Quarter quarter1, Quarter quarter2) -> QuarterAdds two specified System.Quarter values.
-(Quarter quarter1, Quarter quarter2) -> QuarterSubtracts two specified System.Quarter values.
*(Quarter quarter1, Quarter quarter2) -> QuarterMultiplies two specified System.Quarter values.
/(Quarter quarter1, Quarter quarter2) -> QuarterDivides two specified System.Quarter values.
==(Quarter quarter1, Quarter quarter2) -> boolReturns a value indicating whether two instances of System.Quarter are equal.
!=(Quarter quarter1, Quarter quarter2) -> boolReturns a value indicating whether two instances of System.Quarter are not equal.
<(Quarter quarter1, Quarter quarter2) -> boolReturns a value indicating whether a specified System.Quarter is less than another specified System.Quarter.
>(Quarter quarter1, Quarter quarter2) -> boolReturns a value indicating whether a specified System.Quarter is greater than another specified System.Quarter.
<=(Quarter quarter1, Quarter quarter2) -> boolReturns a value indicating whether a specified System.Quarter is less than or equal to another specified System.Quarter.
>=(Quarter quarter1, Quarter quarter2) -> boolReturns a value indicating whether a specified System.Quarter is greater than or equal to another specified System.Quarter.
implicit(byte value) -> QuarterConverts an 8-bit unsigned integer to a System.Quarter.
implicit(short value) -> QuarterConverts a 16-bit signed integer to a System.Quarter.
implicit(char value) -> QuarterConverts a Unicode character to a System.Quarter.
implicit(int value) -> QuarterConverts a 32-bit signed integer to a System.Quarter.
implicit(long value) -> QuarterConverts a 64-bit signed integer to a System.Quarter.
explicit(Half value) -> QuarterConverts a half-precision floating-point number to a System.Quarter.
explicit(BFloat16 value) -> QuarterConverts a 16-bit google brain floating-point number to a System.Quarter.
explicit(float value) -> QuarterConverts a single-precision floating-point number to a System.Quarter.
explicit(double value) -> QuarterConverts a double-precision floating-point number to a System.Quarter.
explicit(decimal value) -> QuarterConverts a decimal number to a System.Quarter.
explicit(Quarter value) -> byteConverts a System.Quarter to an 8-bit unsigned integer.
explicit(Quarter value) -> charConverts a System.Quarter to a Unicode character.
explicit(Quarter value) -> shortConverts a System.Quarter to a 16-bit signed integer.
explicit(Quarter value) -> intConverts a System.Quarter to a 32-bit signed integer.
explicit(Quarter value) -> longConverts a System.Quarter to a 64-bit signed integer.
implicit(Quarter value) -> floatConverts a System.Quarter to a single-precision floating-point number.
implicit(Quarter value) -> doubleConverts a System.Quarter to a double-precision floating-point number.
explicit(Quarter value) -> decimalConverts a System.Quarter to a decimal number.
implicit(sbyte value) -> QuarterConverts an 8-bit signed integer to a System.Quarter.
implicit(ushort value) -> QuarterConverts a 16-bit unsigned integer to a System.Quarter.
implicit(uint value) -> QuarterConverts a 32-bit unsigned integer to a System.Quarter.
implicit(ulong value) -> QuarterConverts a 64-bit unsigned integer to a System.Quarter.
explicit(Quarter value) -> sbyteConverts a System.Quarter to an 8-bit signed integer.
explicit(Quarter value) -> ushortConverts a System.Quarter to a 16-bit unsigned integer.
explicit(Quarter value) -> uintConverts a System.Quarter to a 32-bit unsigned integer.
explicit(Quarter value) -> ulongConverts a System.Quarter to a 64-bit unsigned integer.
CompareTo(Quarter other) -> intCompares this instance to a specified System.Quarter object.
CompareTo(object obj) -> intCompares this instance to a specified System.Object.
Equals(Quarter other) -> boolReturns a value indicating whether this instance and a specified System.Quarter object represent the same value.
Equals(object obj) -> booloverrideReturns a value indicating whether this instance and a specified System.Object represent the same type and value.
GetHashCode() -> intoverrideReturns the hash code for this instance.
GetTypeCode() -> TypeCodeReturns the System.TypeCode for value type System.Quarter.
GetBytes(Quarter value) -> byte[]staticReturns the specified quarter-precision floating point value as an array of bytes.
GetBits(Quarter value) -> bytestaticConverts the value of a specified instance of System.Quarter to its equivalent binary representation.
ToQuarter(byte[] value, int startIndex) -> QuarterstaticReturns a quarter-precision floating point number converted from one byte at a specified position in a byte array.
ToQuarter(byte bits) -> QuarterstaticReturns a quarter-precision floating point number converted from its binary representation.
Sign(Quarter value) -> intstaticReturns a value indicating the sign of a quarter-precision floating-point number.
Abs(Quarter value) -> QuarterstaticReturns the absolute value of a quarter-precision floating-point number.
Max(Quarter value1, Quarter value2) -> QuarterstaticReturns the larger of two quarter-precision floating-point numbers.
Min(Quarter value1, Quarter value2) -> QuarterstaticReturns the smaller of two quarter-precision floating-point numbers.
IsNaN(Quarter quarter) -> boolstaticReturns a value indicating whether the specified number evaluates to not a number (System.Quarter.NaN).
IsInfinity(Quarter quarter) -> boolstaticReturns a value indicating whether the specified number evaluates to negative or positive infinity.
IsNegativeInfinity(Quarter quarter) -> boolstaticReturns a value indicating whether the specified number evaluates to negative infinity.
IsPositiveInfinity(Quarter quarter) -> boostaticReturns a value indicating whether the specified number evaluates to positive infinity.
Parse(string value) -> QuarterstaticConverts the string representation of a number to its System.Quarter equivalent.
Parse(string value, IFormatProvider provider) -> QuarterstaticConverts the string representation of a number to its System.Quarter equivalent using the specified culture-specific format information.
Parse(string value, NumberStyles style) -> QuarterstaticConverts the string representation of a number in a specified style to its System.Quarter equivalent.
Parse(string value, NumberStyles style, IFormatProvider provider) -> QuarterstaticConverts the string representation of a number to its System.Quarter equivalent using the specified style and culture-specific format.
TryParse(string value, out Quarter result) -> boolstaticConverts the string representation of a number to its System.Quarter equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(string value, NumberStyles style, IFormatProvider provider, out Quarter result) -> boolstaticConverts the string representation of a number to its System.Quarter equivalent using the specified style and culture-specific format. A return value indicates whether the conversion succeeded or failed.
ToString() -> stringoverrideConverts the numeric value of this instance to its equivalent string representation.
ToString(IFormatProvider formatProvider) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
ToString(string format) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation, using the specified format.
ToString(string format, IFormatProvider formatProvider) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
Half(float value) -> new HalfInitializes a new instance of System.Half to the value of the specified single-precision floating-point number.
Half(int value) -> new HalfInitializes a new instance of System.Half to the value of the specified 32-bit signed integer.
Half(long value) -> new HalfInitializes a new instance of System.Half to the value of the specified 64-bit signed integer.
Half(double value) -> new HalfInitializes a new instance of System.Half to the value of the specified double-precision floating-point number.
Half(decimal value) -> new HalfInitializes a new instance of System.Half to the value of the specified decimal number.
Half(uint value) -> new HalfInitializes a new instance of System.Half to the value of the specified 32-bit unsigned integer.
Half(ulong value) -> new HalfInitializes a new instance of System.Half to the value of the specified 64-bit unsigned integer.
Negate(Half half) -> HalfstaticReturns the result of multiplying the specified System.Half value by negative one.
Add(Half half1, Half half2) -> HalfstaticAdds two specified System.Half values.
Substract(Half half1, Half half2) -> HalfstaticSubtracts one specified System.Half value from another.
Multiply(Half half1, Half half2) -> HalfstaticMultiplies two specified System.Half values.
Divide(Half half1, Half half2) -> HalfstaticDivides two specified System.Half values.
+(Half half) -> HalfReturns the value of the System.Half operand (the sign of the operand is unchanged).
-(Half half) -> HalfNegates the value of the specified System.Half operand.
++(Half half) -> HalfIncrements the System.Half operand by 1.
--(Half half) -> HalfDecrements the System.Half operand by one.
+(Half half1, Half half2) -> HalfAdds two specified System.Half values.
-(Half half1, Half half2) -> HalfSubtracts two specified System.Half values.
*(Half half1, Half half2) -> HalfMultiplies two specified System.Half values.
/(Half half1, Half half2) -> HalfDivides two specified System.Half values.
==(Half half1, Half half2) -> boolReturns a value indicating whether two instances of System.Half are equal.
!=(Half half1, Half half2) -> boolReturns a value indicating whether two instances of System.Half are not equal.
<(Half half1, Half half2) -> boolReturns a value indicating whether a specified System.Half is less than another specified System.Half.
>(Half half1, Half half2) -> boolReturns a value indicating whether a specified System.Half is greater than another specified System.Half.
<=(Half half1, Half half2) -> boolReturns a value indicating whether a specified System.Half is less than or equal to another specified System.Half.
>=(Half half1, Half half2) -> boolReturns a value indicating whether a specified System.Half is greater than or equal to another specified System.Half.
implicit(byte value) -> HalfConverts an 8-bit unsigned integer to a System.Half.
implicit(short value) -> HalfConverts a 16-bit signed integer to a System.Half.
implicit(char value) -> HalfConverts a Unicode character to a System.Half.
implicit(int value) -> HalfConverts a 32-bit signed integer to a System.Half.
implicit(long value) -> HalfConverts a 64-bit signed integer to a System.Half.
implicit(Quarter value) -> HalfConverts a quarter-precision floating-point number to a System.Half.
explicit(BFloat16 value) -> HalfConverts a 16-bit google brain floating-point number to a System.Half.
explicit(float value) -> HalfConverts a single-precision floating-point number to a System.Half.
explicit(double value) -> HalfConverts a double-precision floating-point number to a System.Half.
explicit(decimal value) -> HalfConverts a decimal number to a System.Half.
explicit(Half value) -> byteConverts a System.Half to an 8-bit unsigned integer.
explicit(Half value) -> charConverts a System.Half to a Unicode character.
explicit(Half value) -> shortConverts a System.Half to a 16-bit signed integer.
explicit(Half value) -> intConverts a System.Half to a 32-bit signed integer.
explicit(Half value) -> longConverts a System.Half to a 64-bit signed integer.
implicit(Half value) -> floatConverts a System.Half to a single-precision floating-point number.
implicit(Half value) -> doubleConverts a System.Half to a double-precision floating-point number.
explicit(Half value) -> decimalConverts a System.Half to a decimal number.
implicit(sbyte value) -> HalfConverts an 8-bit signed integer to a System.Half.
implicit(ushort value) -> HalfConverts a 16-bit unsigned integer to a System.Half.
implicit(uint value) -> HalfConverts a 32-bit unsigned integer to a System.Half.
implicit(ulong value) -> HalfConverts a 64-bit unsigned integer to a System.Half.
explicit(Half value) -> sbyteConverts a System.Half to an 8-bit signed integer.
explicit(Half value) -> ushortConverts a System.Half to a 16-bit unsigned integer.
explicit(Half value) -> uintConverts a System.Half to a 32-bit unsigned integer.
explicit(Half value) -> ulongConverts a System.Half to a 64-bit unsigned integer.
CompareTo(Half other) -> intCompares this instance to a specified System.Half object.
CompareTo(object obj) -> intCompares this instance to a specified System.Object.
Equals(Half other) -> boolReturns a value indicating whether this instance and a specified System.Half object represent the same value.
Equals(object obj) -> booloverrideReturns a value indicating whether this instance and a specified System.Object represent the same type and value.
GetHashCode() -> intoverrideReturns the hash code for this instance.
GetTypeCode() -> TypeCodeReturns the System.TypeCode for value type System.Half.
GetBytes(Half value) -> byte[]staticReturns the specified half-precision floating point value as an array of bytes.
GetBits(Half value) -> ushortstaticConverts the value of a specified instance of System.Half to its equivalent binary representation.
ToHalf(byte[] value, int startIndex) -> HalfstaticReturns a half-precision floating point number converted from two bytes at a specified position in a byte array.
ToHalf(ushort bits) -> HalfstaticReturns a half-precision floating point number converted from its binary representation.
Sign(Half value) -> intstaticReturns a value indicating the sign of a half-precision floating-point number.
Abs(Half value) -> HalfstaticReturns the absolute value of a half-precision floating-point number.
Max(Half value1, Half value2) -> HalfstaticReturns the larger of two half-precision floating-point numbers.
Min(Half value1, Half value2) -> HalfstaticReturns the smaller of two half-precision floating-point numbers.
IsNaN(Half half) -> boolstaticReturns a value indicating whether the specified number evaluates to not a number (System.Half.NaN).
IsInfinity(Half half) -> boolstaticReturns a value indicating whether the specified number evaluates to negative or positive infinity.
IsNegativeInfinity(Half half) -> boolstaticReturns a value indicating whether the specified number evaluates to negative infinity.
IsPositiveInfinity(Half half) -> boostaticReturns a value indicating whether the specified number evaluates to positive infinity.
Parse(string value) -> HalfstaticConverts the string representation of a number to its System.Half equivalent.
Parse(string value, IFormatProvider provider) -> HalfstaticConverts the string representation of a number to its System.Half equivalent using the specified culture-specific format information.
Parse(string value, NumberStyles style) -> HalfstaticConverts the string representation of a number in a specified style to its System.Half equivalent.
Parse(string value, NumberStyles style, IFormatProvider provider) -> HalfstaticConverts the string representation of a number to its System.Half equivalent using the specified style and culture-specific format.
TryParse(string value, out Half result) -> boolstaticConverts the string representation of a number to its System.Half equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(string value, NumberStyles style, IFormatProvider provider, out Half result) -> boolstaticConverts the string representation of a number to its System.Half equivalent using the specified style and culture-specific format. A return value indicates whether the conversion succeeded or failed.
ToString() -> stringoverrideConverts the numeric value of this instance to its equivalent string representation.
ToString(IFormatProvider formatProvider) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
ToString(string format) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation, using the specified format.
ToString(string format, IFormatProvider formatProvider) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
BFloat16(float value) -> new BFloat16Initializes a new instance of System.BFloat16 to the value of the specified single-precision floating-point number.
BFloat16(int value) -> new BFloat16Initializes a new instance of System.BFloat16 to the value of the specified 32-bit signed integer.
BFloat16(long value) -> new BFloat16Initializes a new instance of System.BFloat16 to the value of the specified 64-bit signed integer.
BFloat16(double value) -> new BFloat16Initializes a new instance of System.BFloat16 to the value of the specified double-precision floating-point number.
BFloat16(decimal value) -> new BFloat16Initializes a new instance of System.BFloat16 to the value of the specified decimal number.
BFloat16(uint value) -> new BFloat16Initializes a new instance of System.BFloat16 to the value of the specified 32-bit unsigned integer.
BFloat16(ulong value) -> new BFloat16Initializes a new instance of System.BFloat16 to the value of the specified 64-bit unsigned integer.
Negate(BFloat16 bfloat16) -> BFloat16staticReturns the result of multiplying the specified System.BFloat16 value by negative one.
Add(BFloat16 bfloat161, BFloat16 bfloat162) -> BFloat16staticAdds two specified System.BFloat16 values.
Substract(BFloat16 bfloat161, BFloat16 bfloat162) -> BFloat16staticSubtracts one specified System.BFloat16 value from another.
Multiply(BFloat16 bfloat161, BFloat16 bfloat162) -> BFloat16staticMultiplies two specified System.BFloat16 values.
Divide(BFloat16 bfloat161, BFloat16 bfloat162) -> BFloat16staticDivides two specified System.BFloat16 values.
+(BFloat16 bfloat16) -> BFloat16Returns the value of the System.BFloat16 operand (the sign of the operand is unchanged).
-(BFloat16 bfloat16) -> BFloat16Negates the value of the specified System.BFloat16 operand.
++(BFloat16 bfloat16) -> BFloat16Increments the System.BFloat16 operand by 1.
--(BFloat16 bfloat16) -> BFloat16Decrements the System.BFloat16 operand by one.
+(BFloat16 bfloat161, BFloat16 bfloat162) -> BFloat16Adds two specified System.BFloat16 values.
-(BFloat16 bfloat161, BFloat16 bfloat162) -> BFloat16Subtracts two specified System.BFloat16 values.
*(BFloat16 bfloat161, BFloat16 bfloat162) -> BFloat16Multiplies two specified System.BFloat16 values.
/(BFloat16 bfloat161, BFloat16 bfloat162) -> BFloat16Divides two specified System.BFloat16 values.
==(BFloat16 bfloat161, BFloat16 bfloat162) -> boolReturns a value indicating whether two instances of System.BFloat16 are equal.
!=(BFloat16 bfloat161, BFloat16 bfloat162) -> boolReturns a value indicating whether two instances of System.BFloat16 are not equal.
<(BFloat16 bfloat161, BFloat16 bfloat162) -> boolReturns a value indicating whether a specified System.BFloat16 is less than another specified System.BFloat16.
>(BFloat16 bfloat161, BFloat16 bfloat162) -> boolReturns a value indicating whether a specified System.BFloat16 is greater than another specified System.BFloat16.
<=(BFloat16 bfloat161, BFloat16 bfloat162) -> boolReturns a value indicating whether a specified System.BFloat16 is less than or equal to another specified System.BFloat16.
>=(BFloat16 bfloat161, BFloat16 bfloat162) -> boolReturns a value indicating whether a specified System.BFloat16 is greater than or equal to another specified System.BFloat16.
implicit(byte value) -> BFloat16Converts an 8-bit unsigned integer to a System.BFloat16.
implicit(short value) -> BFloat16Converts a 16-bit signed integer to a System.BFloat16.
implicit(char value) -> BFloat16Converts a Unicode character to a System.BFloat16.
implicit(int value) -> BFloat16Converts a 32-bit signed integer to a System.BFloat16.
implicit(long value) -> BFloat16Converts a 64-bit signed integer to a System.BFloat16.
implicit(Quarter value) -> BFloat16Converts a quarter-precision floating-point number to a System.BFloat16.
implicit(Half value) -> BFloat16Converts a half-precision floating-point number to a System.BFloat16.
explicit(float value) -> BFloat16Converts a single-precision floating-point number to a System.BFloat16.
explicit(double value) -> BFloat16Converts a double-precision floating-point number to a System.BFloat16.
explicit(decimal value) -> BFloat16Converts a decimal number to a System.BFloat16.
explicit(BFloat16 value) -> byteConverts a System.BFloat16 to an 8-bit unsigned integer.
explicit(BFloat16 value) -> charConverts a System.BFloat16 to a Unicode character.
explicit(BFloat16 value) -> shortConverts a System.BFloat16 to a 16-bit signed integer.
explicit(BFloat16 value) -> intConverts a System.BFloat16 to a 32-bit signed integer.
explicit(BFloat16 value) -> longConverts a System.BFloat16 to a 64-bit signed integer.
implicit(BFloat16 value) -> floatConverts a System.BFloat16 to a single-precision floating-point number.
implicit(BFloat16 value) -> doubleConverts a System.BFloat16 to a double-precision floating-point number.
explicit(BFloat16 value) -> decimalConverts a System.BFloat16 to a decimal number.
implicit(sbyte value) -> BFloat16Converts an 8-bit signed integer to a System.BFloat16.
implicit(ushort value) -> BFloat16Converts a 16-bit unsigned integer to a System.BFloat16.
implicit(uint value) -> BFloat16Converts a 32-bit unsigned integer to a System.BFloat16.
implicit(ulong value) -> BFloat16Converts a 64-bit unsigned integer to a System.BFloat16.
explicit(BFloat16 value) -> sbyteConverts a System.BFloat16 to an 8-bit signed integer.
explicit(BFloat16 value) -> ushortConverts a System.BFloat16 to a 16-bit unsigned integer.
explicit(BFloat16 value) -> uintConverts a System.BFloat16 to a 32-bit unsigned integer.
explicit(BFloat16 value) -> ulongConverts a System.BFloat16 to a 64-bit unsigned integer.
CompareTo(BFloat16 other) -> intCompares this instance to a specified System.BFloat16 object.
CompareTo(object obj) -> intCompares this instance to a specified System.Object.
Equals(BFloat16 other) -> boolReturns a value indicating whether this instance and a specified System.BFloat16 object represent the same value.
Equals(object obj) -> booloverrideReturns a value indicating whether this instance and a specified System.Object represent the same type and value.
GetHashCode() -> intoverrideReturns the hash code for this instance.
GetTypeCode() -> TypeCodeReturns the System.TypeCode for value type System.BFloat16.
GetBytes(BFloat16 value) -> byte[]staticReturns the specified 16-bit google brain floating point value as an array of bytes.
GetBits(BFloat16 value) -> bytestaticConverts the value of a specified instance of System.BFloat16 to its equivalent binary representation.
ToBFloat16(byte[] value, int startIndex) -> BFloat16staticReturns a 16-bit google brain floating point number converted from one byte at a specified position in a byte array.
ToBFloat16(byte bits) -> BFloat16staticReturns a 16-bit google brain floating point number converted from its binary representation.
Sign(BFloat16 value) -> intstaticReturns a value indicating the sign of a 16-bit google brain floating-point number.
Abs(BFloat16 value) -> BFloat16staticReturns the absolute value of a 16-bit google brain floating-point number.
Max(BFloat16 value1, BFloat16 value2) -> BFloat16staticReturns the larger of two 16-bit google brain floating-point numbers.
Min(BFloat16 value1, BFloat16 value2) -> BFloat16staticReturns the smaller of two 16-bit google brain floating-point numbers.
IsNaN(BFloat16 bfloat16) -> boolstaticReturns a value indicating whether the specified number evaluates to not a number (System.BFloat16.NaN).
IsInfinity(BFloat16 bfloat16) -> boolstaticReturns a value indicating whether the specified number evaluates to negative or positive infinity.
IsNegativeInfinity(BFloat16 bfloat16) -> boolstaticReturns a value indicating whether the specified number evaluates to negative infinity.
IsPositiveInfinity(BFloat16 bfloat16) -> boostaticReturns a value indicating whether the specified number evaluates to positive infinity.
Parse(string value) -> BFloat16staticConverts the string representation of a number to its System.BFloat16 equivalent.
Parse(string value, IFormatProvider provider) -> BFloat16staticConverts the string representation of a number to its System.BFloat16 equivalent using the specified culture-specific format information.
Parse(string value, NumberStyles style) -> BFloat16staticConverts the string representation of a number in a specified style to its System.BFloat16 equivalent.
Parse(string value, NumberStyles style, IFormatProvider provider) -> BFloat16staticConverts the string representation of a number to its System.BFloat16 equivalent using the specified style and culture-specific format.
TryParse(string value, out BFloat16 result) -> boolstaticConverts the string representation of a number to its System.BFloat16 equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(string value, NumberStyles style, IFormatProvider provider, out BFloat16 result) -> boolstaticConverts the string representation of a number to its System.BFloat16 equivalent using the specified style and culture-specific format. A return value indicates whether the conversion succeeded or failed.
ToString() -> stringoverrideConverts the numeric value of this instance to its equivalent string representation.
ToString(IFormatProvider formatProvider) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
ToString(string format) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation, using the specified format.
ToString(string format, IFormatProvider formatProvider) -> stringoverrideConverts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
//reference System.FloatingPoint.dll or System.AI.dllusingSystem;namespaceFloatMatrixExample{publicstaticclassProgram{publicstaticBFloat16[,]MatMul(BFloat16[,]a,BFloat16[,]b){varm=a.GetLength(0);varn=b.GetLength(1);vark=b.GetLength(0);varc=newBFloat16[m,n];for(inti=0;i<m;++i){for(intz=0;z<k;++z){varav=a[i,z];for(intj=0;j<n;++j){c[i,j]+=av*b[z,j];}}}returnc;}publicstaticBFloat16[,]RandomMatrix(intm,intn){varmatrix=newBFloat16[m,n];varrand=newRandom();for(inti=0;i<m;++i){for(intj=0;j<n;++j){matrix[i,j]=(BFloat16)rand.NextDouble();}}returnmatrix;}publicstaticvoidPrintMatrix(BFloat16[,]m){varh=m.GetLength(0);varw=m.GetLength(1);for(inti=0;i<h;++i){for(intj=0;j<w;++j){if((j+1)<w){Console.Write(string.Format("{0:f4}, ",m[i,j]));}else{Console.WriteLine(string.Format("{0:f4}",m[i,j]));}}}}publicstaticvoidMain(){constintm=4;constintn=7;constintk=3;vara=RandomMatrix(m,n);Console.WriteLine("a=");PrintMatrix(a);varb=RandomMatrix(n,k);Console.WriteLine("\nb=");PrintMatrix(b);varc=MatMul(a,b);Console.WriteLine("\nc=");PrintMatrix(c);Console.ReadKey(true);}}}
In accordance with the license of the original System.Half code, the source code was refactored and included in the System.AI stack as an integral part.