{"id":1398,"url":"https://github.com/xwu/NumericAnnex","last_synced_at":"2025-08-02T04:31:03.003Z","repository":{"id":62449248,"uuid":"87027795","full_name":"xwu/NumericAnnex","owner":"xwu","description":"Numeric facilities for Swift","archived":false,"fork":false,"pushed_at":"2018-04-01T03:48:29.000Z","size":6793,"stargazers_count":69,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-05T13:19:10.839Z","etag":null,"topics":["math","numerics","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/xwu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-03T01:14:34.000Z","updated_at":"2024-04-02T17:40:31.000Z","dependencies_parsed_at":"2022-11-01T23:17:17.401Z","dependency_job_id":null,"html_url":"https://github.com/xwu/NumericAnnex","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/xwu/NumericAnnex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwu%2FNumericAnnex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwu%2FNumericAnnex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwu%2FNumericAnnex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwu%2FNumericAnnex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xwu","download_url":"https://codeload.github.com/xwu/NumericAnnex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwu%2FNumericAnnex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334610,"owners_count":24233793,"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-08-02T02:00:12.353Z","response_time":74,"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":["math","numerics","swift"],"created_at":"2024-01-05T20:15:45.529Z","updated_at":"2025-08-02T04:31:02.750Z","avatar_url":"https://github.com/xwu.png","language":"Swift","funding_links":[],"categories":["Math"],"sub_categories":["Other Hardware","Other free courses"],"readme":"# \u003cimg src=\"https://xwu.github.io/NumericAnnex/img/NumericAnnex-2017-09-02.svg\" alt=\"NumericAnnex\" height=\"72\"\u003e\u003cbr\u003eNumericAnnex\n\nNumericAnnex supplements the numeric facilities provided in the Swift standard\nlibrary.\n\n[![Build Status](https://travis-ci.org/xwu/NumericAnnex.svg?branch=master)](https://travis-ci.org/xwu/NumericAnnex)\n[![codecov](https://codecov.io/gh/xwu/NumericAnnex/branch/master/graph/badge.svg)](https://codecov.io/gh/xwu/NumericAnnex)\n\n\n## Features\n\n- The exponentiation operator `**` and the compound assignment operator `**=`.\n- Extension methods for `BinaryInteger` exponentiation, square root, cube root,\n  greatest common divisor, and least common multiple.\n- `Math`, a protocol for signed numeric types that support elementary functions.\n- `Real`, a protocol for floating-point types that support elementary functions\n  and a selection of special functions.\n- `PRNG`, a protocol for pseudo-random number generators.\n- `Rational`, a value type to represent rational values which supports division\n  by zero.\n- `Complex`, a value type to represent complex values in Cartesian form.\n- `Random` and `Random.Xoroshiro`, two reference types implementing efficient\n  pseudo-random number generators.\n\n\u003e Note: This project is in the early stages of development and is not\n\u003e production-ready at this time.\n\n\n## Requirements\n\nNumericAnnex requires Swift 4.1 (`swift-4.1-branch`) or Swift 4.2 (`master`). On\nApple platforms, it also requires the Security framework for cryptographically\nsecure random bytes.\n\n\n## Installation\n\nAfter NumericAnnex has been cloned or downloaded locally, build the library\nusing the command `swift build` (macOS) or `swift build -Xcc -D_GNU_SOURCE`\n(Linux). Run tests with the command `swift test` (macOS) or\n`swift test -Xcc -D_GNU_SOURCE` (Linux). An Xcode project can be generated with\nthe command `swift package generate-xcodeproj`.\n\nTo add the package as a dependency using [CocoaPods](https://cocoapods.org),\ninsert the following line in your `Podfile`:\n\n```ruby\npod 'NumericAnnex', '~\u003e 0.1.19'\n```\n\n[Swift Package Manager](https://swift.org/package-manager/) can also be used to\nadd the package as a dependency. See Swift documentation for details.\n\n\n## Basic Usage\n\n```swift\nimport NumericAnnex\n\nprint(2 ** 3)\n// Prints \"8\".\n\nprint(4.0 ** 5.0)\n// Prints \"1024.0\".\n\nprint(Int.cbrt(8))\n// Prints \"2\".\n\nprint(Double.cbrt(27.0))\n// Prints \"3.0\".\n\nvar x: Ratio = 1 / 4\n// Ratio is a type alias for Rational\u003cInt\u003e.\n\nprint(x.reciprocal())\n// Prints \"4\".\n\nx *= 8\nprint(x + x)\n// Prints \"4\".\n\nx = Ratio(Float.phi) // Golden ratio.\nprint(x)\n// Prints \"13573053/8388608\".\n\nvar z: Complex64 = 42 * .i\n// Complex64 is a type alias for Complex\u003cFloat\u003e.\n\nprint(Complex.sqrt(z))\n// Prints \"4.58258 + 4.58258i\".\n\nz = .pi + .i * .log(2 - .sqrt(3))\nprint(Complex.cos(z).real)\n// Prints \"-2.0\".\n```\n\n\n## Documentation\n\nAll public protocols, types, and functions have been carefully documented in the\ncode. See the [formatted reference](https://xwu.github.io/NumericAnnex/) for\ndetails.\n\nThe project adheres to many design patterns found in the Swift standard library.\nFor example, `Math` types provide methods such as `cubeRoot()` and `tangent()`\njust as `FloatingPoint` types provide methods such as `squareRoot()`.\n\nNo free functions are declared in this library unless they overload existing\nones in the Swift standard library. Instead, functions such as `cbrt(_:)` and\n`tan(_:)` are provided as static members. This avoids collisions with C standard\nlibrary functions that you may wish to use. It also promotes clarity at the call\nsite when the result of a complex operation differs from that of its real\ncounterpart (e.g., `Complex128.cbrt(-8) != -2`).\n\n\n## Future Directions\n\n- Add more tests, including performance tests\n- Design and implement additional methods on `PRNG`\n\n\n## License\n\nAll original work is released under the MIT license. See\n[LICENSE](https://github.com/xwu/NumericAnnex/blob/master/LICENSE) for details.\n\nPortions of the complex square root and elementary transcendental functions use\nchecks for special values adapted from libc++. Code in libc++ is dual-licensed\nunder the MIT and UIUC/NCSA licenses.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxwu%2FNumericAnnex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxwu%2FNumericAnnex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxwu%2FNumericAnnex/lists"}