{"id":20196329,"url":"https://github.com/gpavanb1/fine","last_synced_at":"2026-02-12T08:02:37.993Z","repository":{"id":60883789,"uuid":"546252551","full_name":"gpavanb1/FINE","owner":"gpavanb1","description":"Fast (Inverse) n-th Exponents - Based on the Quake 3 Algorithm","archived":false,"fork":false,"pushed_at":"2024-12-09T17:11:52.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T05:26:16.900Z","etag":null,"topics":["cpp","fast-exponentiation","numerical-methods","quake3"],"latest_commit_sha":null,"homepage":"","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/gpavanb1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-10-05T19:39:48.000Z","updated_at":"2024-12-09T17:11:56.000Z","dependencies_parsed_at":"2025-01-13T19:35:25.030Z","dependency_job_id":"ac62ff5c-88e2-4d69-a18e-1eb8faefa9f1","html_url":"https://github.com/gpavanb1/FINE","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gpavanb1/FINE","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FFINE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FFINE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FFINE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FFINE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gpavanb1","download_url":"https://codeload.github.com/gpavanb1/FINE/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FFINE/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29361810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cpp","fast-exponentiation","numerical-methods","quake3"],"created_at":"2024-11-14T04:23:19.501Z","updated_at":"2026-02-12T08:02:37.943Z","avatar_url":"https://github.com/gpavanb1.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FINE\n\n**F**ast **IN**verse **E**xponentiation\n\nCompute `x^(1/n)` and `x^n` faster than standard methods\n\n\n## How to install and execute?\n\nThis library uses the [Bazel](https://bazel.build) build system for compilation\n\nThe tests can be executed using\n```\nbazel test //:test\n```\n\nThe following program illustrates a basic example\n```cpp\n#include \"FINE.h\"\n#include \"FINEd.h\"\n#include \u003ccmath\u003e\n#include \u003ccstdio\u003e\n\nint main(int argc, char *argv[]) {\n\n    float a = 19.2f;\n    int n = 2;\n\n    printf(\"FINE Value: %f\\n\", Q_exp(a, n));\n    printf(\"FINEd Value: %f\\n\", Q_exp_double(a, n));\n    printf(\"C value: %f\\n\", pow(a, n));\n    printf(\"\\n\");\n    printf(\"FINE Value: %f\\n\", Q_nroot(a, n));\n    printf(\"FINEd Value: %f\\n\", Q_nroot_double(a, n));\n    printf(\"Quake 3 Value: %f\\n\", Quake(a));\n    printf(\"C value: %f\\n\", pow(a, -1./n));\n    \n    return 0;\n}\n```\n\n## Results\n\n\nAn example file `benchmark.cpp` is provided that compares between various methods.\n\nThis can be executed using\n```\nbazel run //:benchmark\n```\n\nThe output is as follows:\n\n```\nExponent\nFINE Value: 369.421783\nFINEd Value: 369.421772\nC value: 368.640029\n\n\nInverse-Root\nFINE Value: 0.226177\nFINEd Value: 0.226177\nQuake 3 Value: 0.228213\nC value: 0.228218\n```\n\nWhen the computations were repeated with different values for N=50,000 times (in microseconds)\n\n```\nExponent\nTimes (float, double, C): 390, 387, 2306\n\nInverse-Root\nTimes (float, double, Quake, C): 1291, 1629, 658, 2069\n```\n\nThe `Quake` method supports only inverse square roots\n\n## How does this work?\n\nThis work takes inspiration from the [Fast Inverse Square Root](https://en.wikipedia.org/wiki/Fast_inverse_square_root) from the [Quake 3 Engine](https://en.wikipedia.org/wiki/Quake_III_Arena) (although sources mention it is older) and generalizes it to both `32-bit` and `64-bit` floating-point values.\n\nNote that fast computation of inverse n-th root requires fast exponentiation (`x^n`) as well and is included.\n\n\n## Whom to contact?\n\nPlease direct your queries to [gpavanb1](http://github.com/gpavanb1)\nfor any questions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpavanb1%2Ffine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgpavanb1%2Ffine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpavanb1%2Ffine/lists"}