Created
April 25, 2020 20:35
-
-
Save gm50x/4b0a78987712ec453e797d3a4fe6c22b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Demonstrates Imprecision in C# floats running on top of .NET Core 3.1 | |
**/ | |
using System; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
float n = 1.00f; | |
while (n > 0) { | |
float m = n; | |
n = n - 0.01f; | |
Console.WriteLine($"{m} - {0.01f} = {n}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment