The call to _To_Bits yields the result containing the same bytes, but not the same value. This value was then stored as-is into the parameter, which causes a conversion on how the value is stored, ultimately causing the wrong value to be written to the stream.
ReadSingle previously returned a double, and this never failed unit tests since float -> double is a widening conversion, with values being comparable.
Some of these directives were incorrectly written as #if NET6_0, when ThrowIfNull is available in all future versions too. The macro has been fixed to #if NET6_0_OR_GREATER.
For other methods, the branch has been introduced where it didn't exist before.
This isn't actually a "fix", the method may be slow by design if the source is lazily enumerated. SonarCloud, however, did not like this method not having an explicit timeout. If SonarCloud continues to complain, we'll just shut its mouth masking tape and throw it in the broom closet.
No integers >3 satisfy the condition of being odd AND not being a multiple of 3 (as checked above) AND not being in the form 6k ± 1. This condition never evaluates to true, and so the return is never reached and was preventing this method from hitting 100% code coverage.
This check was a defensive manoeuvrer in the event that the input is 0, but this condition has already been verified to be false with the switch guard clause.
This changes bumps coverage to 100% for Sqrt.
NB: While using a higher C# version with lower framework version is possible, it's generally advised against because C# syntax may map to .NET types not available in older versions such as .NET Standard 2.1.
This change does not invite the codebase to upgrade to newer types, but rather take advantage of syntax sugar (such as file-scoped namespaces, when this project was updated to C# 10) that does not effect the compiled result.
However, this change does open up the possibilities to add extension methods for the "generic math" interfaces (made possible by static interface members), and these upcoming methods will be targeted to .NET 7 or greater **ONLY**.