{"id":28425078,"url":"https://github.com/ssloy/tinyfloat","last_synced_at":"2026-02-15T23:05:01.654Z","repository":{"id":282478804,"uuid":"948731077","full_name":"ssloy/tinyfloat","owner":"ssloy","description":"Soft floating point","archived":false,"fork":false,"pushed_at":"2025-11-19T09:44:03.000Z","size":73,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-19T11:22:55.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ssloy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-14T21:23:30.000Z","updated_at":"2025-11-19T09:44:06.000Z","dependencies_parsed_at":"2025-06-29T04:00:21.826Z","dependency_job_id":null,"html_url":"https://github.com/ssloy/tinyfloat","commit_stats":null,"previous_names":["ssloy/tinyfloat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ssloy/tinyfloat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssloy%2Ftinyfloat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssloy%2Ftinyfloat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssloy%2Ftinyfloat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssloy%2Ftinyfloat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssloy","download_url":"https://codeload.github.com/ssloy/tinyfloat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssloy%2Ftinyfloat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29491998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"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":[],"created_at":"2025-06-05T10:31:16.141Z","updated_at":"2026-02-15T23:05:01.648Z","avatar_url":"https://github.com/ssloy.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TinyFloat - the most unoptimized soft float library on the net\n\nThis is a software 32-bit floating point implementation.\nWhile there are plenty soft floating point libraries in the wild, I am not satisfied with either of those.\nAll of them are way too complex and pretty much undocumented.\n\n**Despite the focus on readability, there are very few comments in the code. An extensive writing is available here:**\n\n1. [Floating point myths and superstitions](https://haqr.eu/tinyfloat/)\n2. [Computers and numbers](https://haqr.eu/tinyfloat/computers-and-numbers/)\n3. [Printing floats](https://haqr.eu/tinyfloat/print/)\n4. [Summation and numerical errors](https://haqr.eu/tinyfloat/add/)\n5. [Division and multiplication (work in progress)](https://haqr.eu/tinyfloat/div/)\n\nThis is a tiny project, the goal is to make a **simple and understandable** implementation of single-precision floating point.\nI do not care about efficiency as long as the code is simple.\nThe goal is twofold:\n\n* first, educate on how floating point works\n* second, provdide the code that can be ported to platforms without floating point.\n  \nFor example, I used it to create an eyecandy raytracer for my [TinyCompiler project](https://haqr.eu/tinycompiler/).\n\n## Someone is wrong on the internet!\n\n![](https://haqr.eu/tinyfloat/home/bad-news.jpg)\n\nRecently, I needed to emulate floating point operations using only integer arithmetic, since floats were unavailable.\nI went online to look for a ready-made library and to my surprise, not only did I not find what I was looking for, but I also discovered that someone on the internet was wrong. :)\n\nIt turns out that forums are full of people who don't fully understand how computers manipulate numbers.\nFor example, I pulled the above meme from Reddit (it was me who crossed it out).\nSomeone was so scared of the terrible rounding errors of floating point numbers that he even made a funny picture.\nThe only problem is that **0.5 + 0.5 is exactly equal to 1.0**.\n\nSo, I decided to roll up my sleeves and reinvent the wheel.\nThat is, to write the most unoptimized C++ library for emulating IEEE754 32-bit floating-point numbers using only 32-bit integer arithmetic.\n\n## Compilation \u0026 testing\n\nThere are two kinds of tests in the project: [unit tests](https://github.com/ssloy/tinyfloat/tree/main/tests) where TinyFloat functions are tested against C++ native `float`.\nThere is also a [truncated version](https://github.com/ssloy/tinyfloat/blob/main/tests/paranoia.cpp) of PARANOIA,\na test suite written in Basic by William Kahan in 1983.\nParanoia is designed to discover obvious flaws in non-compliant floating point arithmetic and it is [still used today](https://dl.acm.org/doi/10.1145/1179622.1179682)!\n\n```sh\ngit clone https://github.com/ssloy/tinyfloat.git \u0026\u0026\ncd tinyfloat \u0026\u0026\ncmake -Bbuild \u0026\u0026\ncmake --build build -j \u0026\u0026\ncd build \u0026\u0026\nctest . \u0026\u0026\n./paranoia\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssloy%2Ftinyfloat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssloy%2Ftinyfloat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssloy%2Ftinyfloat/lists"}