{"id":13812813,"url":"https://github.com/MikeLankamp/fpm","last_synced_at":"2025-05-14T22:31:08.812Z","repository":{"id":37695706,"uuid":"166103653","full_name":"MikeLankamp/fpm","owner":"MikeLankamp","description":"C++ header-only fixed-point math library","archived":false,"fork":false,"pushed_at":"2024-10-09T18:09:58.000Z","size":463,"stargazers_count":672,"open_issues_count":17,"forks_count":85,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-11-19T07:39:21.362Z","etag":null,"topics":["cxx11","deterministic","fixed-point","header-only","maths"],"latest_commit_sha":null,"homepage":"https://mikelankamp.github.io/fpm","language":"C++","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/MikeLankamp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-01-16T20:03:29.000Z","updated_at":"2024-11-15T17:59:02.000Z","dependencies_parsed_at":"2024-08-04T04:02:53.245Z","dependency_job_id":"cc7548f9-66ee-4ba7-ae49-806c6bf770df","html_url":"https://github.com/MikeLankamp/fpm","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeLankamp%2Ffpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeLankamp%2Ffpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeLankamp%2Ffpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeLankamp%2Ffpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeLankamp","download_url":"https://codeload.github.com/MikeLankamp/fpm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254239500,"owners_count":22037716,"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":["cxx11","deterministic","fixed-point","header-only","maths"],"created_at":"2024-08-04T04:00:55.787Z","updated_at":"2025-05-14T22:31:03.774Z","avatar_url":"https://github.com/MikeLankamp.png","language":"C++","funding_links":[],"categories":["8. Tutorials","Mathematics","C++","Data processing"],"sub_categories":["8.4 Optimization Techniques","Math"],"readme":"# fpm\nA C++ header-only fixed-point math library. \"fpm\" stands for \"fixed-point math\".\n\nIt is designed to serve as a drop-in replacement for floating-point types and aims to provide as much of the standard library's functionality as possible with exclusively integers. `fpm` requires C++11 or higher.\n\n[![Build Status](https://travis-ci.org/MikeLankamp/fpm.svg?branch=master)](https://travis-ci.org/MikeLankamp/fpm)\n[![Build status](https://ci.appveyor.com/api/projects/status/0velpwqk38spu412?svg=true)](https://ci.appveyor.com/project/MikeLankamp/fpm)\n\n`fpm` is designed to guard against accidental conversion to and from floats and supports many of the standard C++ maths functions, including trigonometry, power and logarithmic functions, with performance and accuracy generally comparable to alternative libraries.\n\n## Why use fixed-point math?\nThere are several reasons why you can not or choose not to use floating-point math, but still want a similar type:\n* Your target platform lacks an FPU, does not support floating-point operations or its floating-point operations are\n  considerably slower than fixed-point integer operations.\n* You require deterministic calculations.\n\nIf any of these reasons apply for you, and your problem domain has a clearly outlined range and required resolution,\nthen fixed-point numbers might be a solution for you.\n\n## Quick Start\nTo use `fpm`, include its header `\u003cfpm/fixed.hpp\u003e` and use the `fpm::fixed_16_16`, `fpm::fixed_24_8` or `fpm::fixed_8_24`\ntypes as if they were native floating-pointer types:\n```c++\n#include \u003cfpm/fixed.hpp\u003e  // For fpm::fixed_16_16\n#include \u003cfpm/math.hpp\u003e   // For fpm::cos\n#include \u003cfpm/ios.hpp\u003e    // For fpm::operator\u003c\u003c\n#include \u003ciostream\u003e       // For std::cin, std::cout\n\nint main() {\n    std::cout \u003c\u003c \"Please input a number: \";\n    fpm::fixed_16_16 x;\n    std::cin \u003e\u003e x;\n    std::cout \u003c\u003c \"The cosine of \" \u003c\u003c x \u003c\u003c \" radians is: \" \u003c\u003c cos(x) \u003c\u003c std::endl;\n    return 0;\n}\n```\n\nTo use the fixed-point equivalents of the `\u003cmath.h\u003e` functions such as `sqrt`, `sin` and `log`, include the header `\u003cfpm/math.hpp\u003e`.\nTo stream fixed-point values to or from streams, include the header `\u003cfpm/ios.hpp\u003e`.\n\n## Documentation\nPlease refer to the [documentation](docs/index.md) for detailed information how to use `fpm`, or skip straight to the [performance](docs/performance.md) or [accuracy](docs/accuracy.md) results.\n\n## Contributions\nThis library is a work-in-progress. We welcome any contributions that improve the functional coverage or the performance or accuracy of the mathematical functions.\n\n## License\nSee the [LICENSE](LICENSE) file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMikeLankamp%2Ffpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMikeLankamp%2Ffpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMikeLankamp%2Ffpm/lists"}