https://github.com/rustpython/pymath
https://github.com/rustpython/pymath
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rustpython/pymath
- Owner: RustPython
- License: other
- Created: 2025-02-27T08:00:56.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-04-24T05:50:29.000Z (9 months ago)
- Last Synced: 2025-06-13T06:36:23.467Z (7 months ago)
- Language: Rust
- Size: 24.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pymath
======
A binary representation compatible Rust implementation of Python's math library.
## Overview
`pymath` is a line-by-line port of the CPython math library to Rust. This library aims to provide mathematical functions that produce identical results to Python's standard math library at the bit level.
## Implementation
Each function has been carefully translated from CPython's C implementation to Rust, preserving the same algorithms, constants, and corner case handling. The code maintains the same numerical properties, but in Rust!
## Usage
```rust
use pymath::{gamma, lgamma};
fn main() {
// Get the same results as Python's math.gamma and math.lgamma
let gamma_result = gamma(4.5).unwrap();
let lgamma_result = lgamma(4.5).unwrap();
}
```