-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Copy link
Labels
Description
The BFloat16 implementation of TryWriteSignificandBigEndian and TryWriteSignificandLittleEndian write 16-bit integers, but report 4 as the number of bytes written (32-bit), even though only two bytes were written:
runtime/src/libraries/System.Private.CoreLib/src/System/Numerics/BFloat16.cs
Lines 1047 to 1051 in 0bb2889
| bool IFloatingPoint<BFloat16>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten) | |
| { | |
| if (BinaryPrimitives.TryWriteUInt16BigEndian(destination, Significand)) | |
| { | |
| bytesWritten = sizeof(uint); |
I'm not exactly a numerics person but should this be a ushort? (That is what Half does).
Copilot and EgorBo