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
This boxes the floating point constant into an object to then do a numeric comparison.
The idea is to remove expensive boxing and subsequent unboxing when not needed.
Fixed code ideally should create:
[Test]
public void TestFoatsAndDoubles()
{
float x = 0.0500000007f;
Assert.That(x, Is.EqualTo(0.05).Within(0.0000001));
}
The text was updated successfully, but these errors were encountered:
Given code:
This boxes the floating point constant into an
object
to then do a numeric comparison.The idea is to remove expensive boxing and subsequent unboxing when not needed.
Fixed code ideally should create:
The text was updated successfully, but these errors were encountered: