{"id":37156787,"url":"https://github.com/erinpentecost/fltcmp","last_synced_at":"2026-01-14T18:36:38.210Z","repository":{"id":57540411,"uuid":"161065776","full_name":"erinpentecost/fltcmp","owner":"erinpentecost","description":"Go float comparison using ULPs","archived":false,"fork":false,"pushed_at":"2018-12-18T05:15:24.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T05:26:04.280Z","etag":null,"topics":["equality","float","floating-point","ulp"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/erinpentecost.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}},"created_at":"2018-12-09T17:49:52.000Z","updated_at":"2018-12-18T05:15:26.000Z","dependencies_parsed_at":"2022-09-26T18:30:36.165Z","dependency_job_id":null,"html_url":"https://github.com/erinpentecost/fltcmp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/erinpentecost/fltcmp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinpentecost%2Ffltcmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinpentecost%2Ffltcmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinpentecost%2Ffltcmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinpentecost%2Ffltcmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erinpentecost","download_url":"https://codeload.github.com/erinpentecost/fltcmp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinpentecost%2Ffltcmp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28430863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["equality","float","floating-point","ulp"],"created_at":"2026-01-14T18:36:37.320Z","updated_at":"2026-01-14T18:36:38.205Z","avatar_url":"https://github.com/erinpentecost.png","language":"Go","readme":"# fltcmp\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/erinpentecost/fltcmp)](https://goreportcard.com/report/github.com/erinpentecost/fltcmp)\n[![Travis CI](https://travis-ci.org/erinpentecost/fltcmp.svg?branch=master)](https://travis-ci.org/erinpentecost/fltcmp.svg?branch=master)\n[![GoDoc](https://godoc.org/github.com/erinpentecost/fltcmp?status.svg)](https://godoc.org/github.com/erinpentecost/fltcmp)\n\nGo float comparison using Units in the Last Place (ULPs). You can find a good write up of the method [here](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).\n\nWhen you test for float equality, you typically aren't looking for an *exact* match. What you might end up doing is testing for equality with some constant error threshold. The problem with that is the behaviour is way different when comparing very small floats and very large floats. ULP testing is an alternative.\n\n## Benchmark\n\nIt's slow.\n\n```sh\nBenchmarkAlmostEqualDifferent-8         300000000                4.11 ns/op\nBenchmarkAlmostEqualSame-8              300000000                3.98 ns/op\nBenchmarkEpsilonSame-8                  2000000000               0.30 ns/op\nBenchmarkEpsilonDifferent-8             2000000000               0.30 ns/op\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferinpentecost%2Ffltcmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferinpentecost%2Ffltcmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferinpentecost%2Ffltcmp/lists"}