Library/API/IoT binding
PAL?
Visual Studio version
No response
.NET nanoFramework extension version
No response
Target name(s)
No response
Firmware version
No response
Device capabilities
No response
Description
I noticed several unit tests in System.Math we failing (before I touched it, I swear ;-)). The root cause appears to be that IsNegativeInfinity returns false even though the parameter is negative infinity.
The code in System::Double::IsNegativeInfinity looks correct and I reproduced the logic in an online compiler https://godbolt.org/z/5PWKhhf81 (although not everything is the same)
Given that the code is correct, and the debugger shows the correct value before executing the method, I have to assume something is changing the parameter in between the caller and the callee 🤷
How to reproduce
Run the sample code (see screenshot below for results)
Expected behaviour
IsNegativeInfinity() returns true when value is negative infinity.
Screenshots

Sample project or code
double d_nan = 0.0 / 0.0;
double d_pos_inf = (3.0 / 0.0);
double d_neg_inf = (-3.0 / 0.0);
Console.WriteLine($"Expect d_nan={d_nan} - {double.IsNaN(d_nan)}, d_pos_inf={d_pos_inf} - {double.IsPositiveInfinity(d_pos_inf)}, d_neg_inf={d_neg_inf} - {double.IsNegativeInfinity(d_neg_inf)}");
float f_nan = 0.0f / 0.0f;
float f_pos_inf = (3.0f / 0.0f);
float f_neg_inf = (-3.0f / 0.0f);
Console.WriteLine($"Expect f_nan={f_nan} - {float.IsNaN(f_nan)}, f_pos_inf={f_pos_inf} - {float.IsPositiveInfinity(f_pos_inf)}, f_neg_inf={f_neg_inf} - {float.IsNegativeInfinity(f_neg_inf)}");
Aditional information
No response
Library/API/IoT binding
PAL?
Visual Studio version
No response
.NET nanoFramework extension version
No response
Target name(s)
No response
Firmware version
No response
Device capabilities
No response
Description
I noticed several unit tests in System.Math we failing (before I touched it, I swear ;-)). The root cause appears to be that IsNegativeInfinity returns false even though the parameter is negative infinity.
The code in System::Double::IsNegativeInfinity looks correct and I reproduced the logic in an online compiler https://godbolt.org/z/5PWKhhf81 (although not everything is the same)
Given that the code is correct, and the debugger shows the correct value before executing the method, I have to assume something is changing the parameter in between the caller and the callee 🤷
How to reproduce
Run the sample code (see screenshot below for results)
Expected behaviour
IsNegativeInfinity() returns true when value is negative infinity.
Screenshots
Sample project or code
Aditional information
No response