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
{{ message }}
Repository navigation
Mono: Min/MinNumber lowering does not preserve the sign of zero #131130
Mono (observed on the LLVM AOT configuration) does not preserve the sign of zero when lowering Min / MinNumber for floating-point types. Per the BCL contract, double.Min(+0.0, -0.0) (and the float/MinNumber variants) must return -0.0, treating -0.0 as less than +0.0. Mono instead returns +0.0.
Reproduction
usingSystem;usingSystem.Runtime.CompilerServices;[MethodImpl(MethodImplOptions.NoInlining|MethodImplOptions.AggressiveOptimization)]staticdoubleMinNegZeroConst(doublevalue)=>double.Min(value,-0.0);// Expected: -9223372036854775808 (bits of -0.0)// Mono LLVM AOT actual: 0 (bits of +0.0)Console.WriteLine(BitConverter.DoubleToInt64Bits(MinNegZeroConst(+0.0)));
The same divergence affects float.Min, double.MinNumber, and float.MinNumber.
Analysis
This surfaced in the CI for #130832: the regression test Runtime_130831 (added to validate a CoreCLR JIT constant-folding fix) fails on the AllSubsets_Mono_LLVMAot_RuntimeTests leg with:
Expected: -9223372036854775808
Actual: 0
The test has been marked [SkipOnMono] referencing this issue so it continues to validate the CoreCLR fix while the Mono divergence is tracked here.
Activity
Skip Runtime_130831 on Mono for signed-zero Min divergence
dotnet-policy-service commentedon Jul 21, 2026
Tagging subscribers to this area: @steveisok, @vitek-karas
See info in area-owners.md if you want to be subscribed.
vitek-karas commentedon Jul 21, 2026
This reproes on .NET 10 as well. Since it's a long standing issue I would vote for closing it. @steveisok what do you think?
steveisok commentedon Jul 21, 2026
Fine by me
tannergooding commentedon Jul 21, 2026
@vitek-karas, just noting this is a correctness and IEEE 754 compliance bug. I'm fine with not fixing it, but did want to call that out.
vitek-karas commentedon Jul 21, 2026
@tannergooding I do understand... and I don't have a problem if we get a PR to accept it...
tannergooding commentedon Jul 21, 2026
@vitek-karas, I have such a PR here: #131172
Fix Mono LLVM lowering of MinNumber/MaxNumber to preserve the sign of…