{"id":25932616,"url":"https://github.com/entonio/nuggle","last_synced_at":"2026-05-12T04:35:31.274Z","repository":{"id":235640743,"uuid":"784996733","full_name":"entonio/Nuggle","owner":"entonio","description":"Combine integer and floating point math without conversions","archived":false,"fork":false,"pushed_at":"2024-07-01T03:36:56.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T07:16:56.315Z","etag":null,"topics":["floating-point","integer-arithmetic"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/entonio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-04-11T01:24:37.000Z","updated_at":"2024-07-01T03:36:54.000Z","dependencies_parsed_at":"2024-04-24T04:52:16.413Z","dependency_job_id":"3f50ae7a-20f6-466f-9424-c55bbf5a41e1","html_url":"https://github.com/entonio/Nuggle","commit_stats":null,"previous_names":["entonio/nuggle"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entonio%2FNuggle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entonio%2FNuggle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entonio%2FNuggle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entonio%2FNuggle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/entonio","download_url":"https://codeload.github.com/entonio/Nuggle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241763764,"owners_count":20016161,"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":["floating-point","integer-arithmetic"],"created_at":"2025-03-04T00:38:34.356Z","updated_at":"2025-12-03T11:04:17.495Z","avatar_url":"https://github.com/entonio.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nuggle\n\nCommon compiled languages keep a visible separation between integer and floating point numbers. The purpose of this package is to allow performing mathematical operations without having to do type conversions:\n\n- where possible / reasonable, floating point numbers are converted to integers;\n- operations that require converting integers to floating point are deferred until a native numerical value is requested.\n\nNOTE: Support for radicals is very experimental.\n\nFor the reasons outlined at https://forums.swift.org/t/why-does-swift-not-support-rational-numbers/62725, this kind of abstraction isn't feasible in a general-purpose useful way. Noticeably, the performance penalty and the increased frequency of overflow issues make it applicable only in a subset of circumstances. You should kee that in mind if choosing this package for some specific use.\n\nGoals of this package:\n\n- ease of use\n- correctness\n- preserving integer math\n\nNot goals:\n\n- performance\n- completeness of mathematical API\n\n# Examples\n\n```swift\n    let m: Nuggle = 2.5\n    let n: Nuggle = 1.5\n    let p: Nuggle = 1\n\n    let ex: Nuggle = 2.5 + 1.5 + 1\n\n    XCTAssertEqual(m + n + p, ex)\n\n    XCTAssertEqual(m + n, 4)\n    XCTAssertEqual(m + n + p, 5)\n    XCTAssertEqual(m + n + p, 4 + 1.6/4.8 + 2/3)\n\n    XCTAssertEqual(m / n, 5 / 3)\n    XCTAssertEqual((m / n).description, \"5/3\")\n\n    XCTAssertEqual(ex.exactInt(), 5)\n\n    XCTAssertEqual((m * 3).double(), 7.5)\n```\n\n## License\n\nExcept where/if otherwise specified, all the files in this package are copyright of the package contributors mentioned in the `NOTICE` file and licensed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0), which is permissive for business use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentonio%2Fnuggle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fentonio%2Fnuggle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentonio%2Fnuggle/lists"}