{"id":13699724,"url":"https://github.com/samhocevar/lolremez","last_synced_at":"2025-10-07T07:36:07.189Z","repository":{"id":22641457,"uuid":"96780328","full_name":"samhocevar/lolremez","owner":"samhocevar","description":"📈 Polynomial Approximations using the Remez Algorithm","archived":false,"fork":false,"pushed_at":"2023-08-13T21:38:04.000Z","size":138,"stargazers_count":424,"open_issues_count":7,"forks_count":37,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-09-10T09:18:03.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/samhocevar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2017-07-10T13:25:27.000Z","updated_at":"2025-09-03T14:21:32.000Z","dependencies_parsed_at":"2024-10-29T19:38:18.911Z","dependency_job_id":null,"html_url":"https://github.com/samhocevar/lolremez","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/samhocevar/lolremez","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samhocevar%2Flolremez","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samhocevar%2Flolremez/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samhocevar%2Flolremez/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samhocevar%2Flolremez/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samhocevar","download_url":"https://codeload.github.com/samhocevar/lolremez/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samhocevar%2Flolremez/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278740789,"owners_count":26037480,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"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":[],"created_at":"2024-08-02T20:00:42.464Z","updated_at":"2025-10-07T07:36:07.157Z","avatar_url":"https://github.com/samhocevar.png","language":"C++","funding_links":[],"categories":["Maths","C++"],"sub_categories":[],"readme":"# LolRemez\n\nA Remez algorithm implementation to approximate functions using polynomials.\n\nA tutorial is available [in the wiki section](https://github.com/samhocevar/lolremez/wiki).\n\nBuild instructions are available below.\n\n## Example\n\nApproximate `atan(sqrt(3+x³)-exp(1+x))` over the range `[sqrt(2),pi²]` with a 5th degree polynomial for `double` floats:\n\n```sh\nlolremez --double -d 5 -r \"sqrt(2):pi²\" \"atan(sqrt(3+x³)-exp(1+x))\"\n```\n\nResult:\n\n```c++\n/* Approximation of f(x) = atan(sqrt(3+x³)-exp(1+x))\n * on interval [ sqrt(2), pi² ]\n * with a polynomial of degree 5. */\ndouble f(double x)\n{\n    double u = -3.9557569330471555e-5;\n    u = u * x + 1.2947712130833294e-3;\n    u = u * x + -1.6541397035559147e-2;\n    u = u * x + 1.0351664953941214e-1;\n    u = u * x + -3.2051562487328135e-1;\n    return u * x + -1.1703528319321961;\n}\n```\n\n## Available functions\n\nBinary functions/operators:\n\n - \\+ \\- \\* / %\n - *atan2(y, x)*, *pow(x, y)*\n - *min(x, y)*, *max(x, y)*\n - *fmod(x, y)*\n\nExponent shortcuts:\n\n - *x²*, *x³*…\n\nConstants:\n\n - *e*,\n - *pi*, *π*\n - *tau*, *τ* (Tau is [great for trolling](https://tauday.com/tau-manifesto))\n\nMath functions:\n\n - *abs()* (absolute value)\n - *sqrt()* (square root), *cbrt()* (cubic root)\n - *exp()*, *exp2()*, *expm1()*, *erf()*, *erfc()*, *erfcx()*,\n - *log()*, *log2()*, *log10()*, *log1p()*\n - *sin()*, *cos()*, *tan()*\n - *asin()*, *acos()*, *atan()*\n - *sinh()*, *cosh()*, *tanh()*\n\nParsing rules:\n\n - *-a^b* is *-(a^b)*\n - *a^b^c* is *(a^b)^c*\n\n## Limitations\n\nAs of now, the `erf()` family of function is inaccurate in the [7,19] range.\nSee [this issue](https://github.com/lolengine/lol/issues/2)\n\n## Build LolRemez\n\n### Setup\n\nIf you got the source code from Git, make sure the submodules are properly initialised:\n\n    git submodule update --init --recursive\n\nOn Windows, just open `lolremez.sln` in Visual Studio.\n\nOn Linux, make sure the following packages are installed:\n\n    automake autoconf libtool pkg-config\n\n### Compile\n\nOn Windows, just build the solution in Visual Studio.\n\nOn Linux, bootstrap the project and configure it:\n\n    ./bootstrap\n    ./configure\n\nFinally, build the project:\n\n    make\n\nThe resulting executable is `lolremez`. You can manually copy it to any\ninstallation location, or run the following:\n\n    sudo make install\n\n## Docker\n\nA docker image can easily be built using the provided [Dockerfile](./Dockerfile)\n\n```bash\ndocker build -t lolremez .\n```\nThis command will create a local Docker image \"lolremez\", you can the invoke `lolremez` as follows:\n\n```\ndocker run --rm lolremez --double -d 5 -r \"sqrt(2):pi²\" \"atan(sqrt(3+x³)-exp(1+x))\"\n// Approximation of f(x) = atan(sqrt(3+x³)-exp(1+x))\n// on interval [ sqrt(2), pi² ]\n// with a polynomial of degree 5.\n// p(x)=((((-3.9557569330471555e-5*x+1.2947712130833294e-3)*x-1.6541397035559147e-2)*x+1.0351664953941214e-1)*x-3.2051562487328135e-1)*x-1.1703528319321961\ndouble f(double x)\n{\n    double u = -3.9557569330471555e-5;\n    u = u * x + 1.2947712130833294e-3;\n    u = u * x + -1.6541397035559147e-2;\n    u = u * x + 1.0351664953941214e-1;\n    u = u * x + -3.2051562487328135e-1;\n    return u * x + -1.1703528319321961;\n}\n```\n\n## Changes\n\n### News for LolRemez 0.7:\n\n - Fix a problem making hyperbolic functions unavailable.\n - A Windows build is provided with the release.\n\n### News for LolRemez 0.6:\n\n - Fix a grave problem with extrema finding when using a weight function;\n   results were suboptimal.\n - Switch to a header-only big float implementation that tremendously\n   improves build times.\n - Print gnuplot-friendly formulas.\n\n### News for LolRemez 0.5:\n\n - Fix a severe bug in *cbrt()*.\n - Implement *erf()*.\n - Implement *%* and *fmod()*.\n - Make the executable size even smaller.\n - lolremez can now also act as a simple command line calculator.\n\n### News for LolRemez 0.4:\n\n - Allow expressions in the range specification: `-r -pi/4:pi/4` is now valid.\n - Allow using “pi” and “e” in expressions, as well as “π”.\n - Bugfixes in the expression parser.\n - Support for hexadecimal floats, *e.g.* `0x1.999999999999999ap-4`.\n - New `--float`, `--double` and `--long-double` options to choose precision.\n - Trim down DLL dependencies to allow for lighter binaries.\n\n### News for LolRemez 0.3:\n\n - implemented an expression parser so that the user does not have to\n   recompile the software before each use.\n - C/C++ function output.\n - use threading to find zeros and extrema.\n - use successive parabolic interpolation to find extrema.\n\n### News for LolRemez 0.2:\n\n - significant performance and accuracy improvements thanks to various\n   bugfixes and a better extrema finder for the error function.\n - user can now define accuracy of the final result.\n - exp(), sin(), cos() and tan() are now about 20% faster.\n - multiplying a real number by an integer power of two is now a virtually\n   free operation.\n - fixed a rounding bug in the real number printing routine.\n\n### Initial release: LolRemez 0.1\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamhocevar%2Flolremez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamhocevar%2Flolremez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamhocevar%2Flolremez/lists"}