{"id":28731570,"url":"https://github.com/pocketpy/dmath","last_synced_at":"2025-06-15T18:15:23.779Z","repository":{"id":294998485,"uuid":"988528360","full_name":"pocketpy/dmath","owner":"pocketpy","description":"Deterministic Math Library for C11 Based on Musl","archived":false,"fork":false,"pushed_at":"2025-05-23T03:34:09.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-23T04:28:52.462Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pocketpy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":"blueloveTH","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2025-05-22T17:19:45.000Z","updated_at":"2025-05-23T04:25:21.000Z","dependencies_parsed_at":"2025-05-26T06:15:19.970Z","dependency_job_id":null,"html_url":"https://github.com/pocketpy/dmath","commit_stats":null,"previous_names":["pocketpy/dmath"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pocketpy/dmath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketpy%2Fdmath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketpy%2Fdmath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketpy%2Fdmath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketpy%2Fdmath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pocketpy","download_url":"https://codeload.github.com/pocketpy/dmath/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketpy%2Fdmath/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260027138,"owners_count":22947789,"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":[],"created_at":"2025-06-15T18:15:18.094Z","updated_at":"2025-06-15T18:15:23.771Z","avatar_url":"https://github.com/pocketpy.png","language":"C","funding_links":["https://github.com/sponsors/blueloveTH"],"categories":[],"sub_categories":[],"readme":"# dmath\n\n\u003cp\u003e\n\u003c!-- Build --\u003e\n\u003ca title=\"Build\" href=\"https://github.com/pocketpy/dmath/actions/workflows\" \u003e\n\u003cimg src=\"https://github.com/pocketpy/dmath/actions/workflows/main.yml/badge.svg\" /\u003e\u003c/a\u003e\n\u003c!-- C11 --\u003e\n\u003ca href=\"https://en.wikipedia.org/wiki/C11_(C_standard_revision)\"\u003e\n\u003cimg alt=\"Python\" src=\"https://img.shields.io/badge/C-11-blue.svg\"\u003e\u003c/a\u003e\n\u003c!-- License --\u003e\n\u003ca href=\"https://github.com/pocketpy/dmath/blob/main/LICENSE\"\u003e\n\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/pocketpy/dmath.svg?color=blue\"\u003e\u003c/a\u003e\n\u003c!-- Github Release --\u003e\n\u003ca href=\"https://github.com/pocketpy/dmath/releases\"\u003e\n\u003cimg alt=\"GitHub release\" src=\"https://img.shields.io/github/release/pocketpy/dmath.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n`dmath` is a deterministic math library for game projects that running on standard mobile (Android/iOS) and desktop platforms (Windows/Linux/MacOS).\n\n`dmath` is a drop-in replacement for the math library in C11, based on [musl-libc v1.2.5](https://musl.libc.org/) with modifications to ensure that all floating-point operations are deterministic across different platforms and compilers. Although musl-libc is primarily designed for Linux, `dmath` can be used on Windows and MacOS.\n[pocketpy](https://github.com/pocketpy/dmath) uses `dmath` as its math library when compiled with `-DPK_ENABLE_DETERMINISM=ON`.\n\n\u003e `dmath` is not designed for embedded systems.\n\n## Installation\n\nFirst clone this repo recursively:\n\n```bash\ngit clone --recursive https://github.com/pocketpy/dmath\n```\n\nThen add the following line to your `CMakeLists.txt`:\n\n```cmake\nadd_subdirectory(\u003cpath_to_dmath_repo\u003e)\n\ntarget_link_libraries(\u003cyour_target\u003e dmath)\n\nif(MSVC)\n    # Force multiple definitions to be allowed in MSVC.\n    target_link_options(\u003cyour_target\u003e PRIVATE /FORCE:MULTIPLE)\nendif()\n```\n\n## Usage\n\n```c\n// CMakeLists.txt will redirect \u003cmath.h\u003e to \"dmath/include/public/math.h\".\n// You don't need to modify your existing code.\n#include \u003cmath.h\u003e\n\n#include \u003cstdio.h\u003e\n\nint main(){\n\n// You can check this macro to ensure that `dmath` is used.\n#ifndef _DMATH_H\n    abort();\n#endif\n\n    double x = log(10);\n    printf(\"log(10) = %f\\n\", x);\n    return 0;\n}\n```\n\n## Tested Platforms\n\nWe have tested `dmath` on the following platforms and configurations.\n\n| Job                    | OS           | Arch    | Compiler |\n| ---------------------- | ------------ | ------- | -------- |\n| build_ubuntu           | Ubuntu 22.04 | x86_64  | gcc      |\n|                        |              |         | clang    |\n| build_ubuntu_multiarch | Ubuntu 22.04 | x86     | gcc      |\n|                        |              |         | clang    |\n|                        |              | aarch64 | gcc      |\n|                        |              |         | clang    |\n|                        |              | armv7   | gcc      |\n|                        |              |         | clang    |\n| build_macos            | MacOS 14     | x86_64  | clang    |\n| build_win32            | Windows 2022 | x86_64  | cl       |\n\n## References\n\nhttps://box2d.org/posts/2024/08/determinism/\n\n## License\n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocketpy%2Fdmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpocketpy%2Fdmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocketpy%2Fdmath/lists"}