{"id":15394787,"url":"https://github.com/mhmd-azeez/floatequality","last_synced_at":"2026-05-06T07:33:12.441Z","repository":{"id":111220895,"uuid":"138514537","full_name":"mhmd-azeez/FloatEquality","owner":"mhmd-azeez","description":"A simple Visual Studio analyzer to prevent you from directly checking two floats for equality.","archived":false,"fork":false,"pushed_at":"2018-06-24T21:44:30.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T16:15:56.405Z","etag":null,"topics":["csharp","visual-studio"],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mhmd-azeez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-24T20:51:57.000Z","updated_at":"2018-06-24T21:44:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0e7e68a-3861-4d75-8088-f84427c40185","html_url":"https://github.com/mhmd-azeez/FloatEquality","commit_stats":{"total_commits":3,"total_committers":2,"mean_commits":1.5,"dds":"0.33333333333333337","last_synced_commit":"5c667893e801b090981e5a556b1b8ccfff20e8be"},"previous_names":["encrypt0r/floatequality"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmd-azeez%2FFloatEquality","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmd-azeez%2FFloatEquality/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmd-azeez%2FFloatEquality/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmd-azeez%2FFloatEquality/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhmd-azeez","download_url":"https://codeload.github.com/mhmd-azeez/FloatEquality/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245944062,"owners_count":20697948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","visual-studio"],"created_at":"2024-10-01T15:24:33.073Z","updated_at":"2026-05-06T07:33:12.410Z","avatar_url":"https://github.com/mhmd-azeez.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"This analyzer makes sure you will never compare two `Double` or `Float` numbers directly for equality as it could lead to errors because floating-point numbers can have imperceivable rounding errors. Currently it doesn't provide any fixes because I am not sure if it's a good idea, as the implementation usually depends on the context.\n\n## Example\nThe analyzer will warn you about cases like this:\n```csharp\nfloat x = 0.3f;\nfloat y = 0.3f;\n\nif (x == y)\n    Console.WriteLine(\"They are equal!\");\nelse\n    Console.WriteLine(\"They are NOT equal!\");\n```\n\n## How to use\n\nAdd the [nuget package](https://www.nuget.org/packages/FloatEquality) to your project and the analyzer will be enabled automatically. I'll try to create a Visual Studio extention as well.\n\n## More Info\n - [Comparing floating point numbers - StackOverFlow](https://stackoverflow.com/questions/3874627/floating-point-comparison-functions-for-c-sharp)\n - [Binary floating point and .NET - Jon Skeet](http://csharpindepth.com/Articles/General/FloatingPoint.aspx)\n - [Decimal floating point - Jon Skeet](http://csharpindepth.com/Articles/General/Decimal.aspx)\n - [What Every Computer Scientist Should Know About Floating-Point Arithmetic - David Goldberg](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhmd-azeez%2Ffloatequality","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhmd-azeez%2Ffloatequality","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhmd-azeez%2Ffloatequality/lists"}