In what follows python
is an alias for python3.8
or pypy3.8
or any later version (python3.9
, pypy3.9
and so on).
Install the latest pip
& setuptools
packages versions
bash
python -m pip install --upgrade pip setuptools
Download and install the latest stable version from PyPI
repository
bash
python -m pip install --upgrade rithm
Download the latest version from GitHub
repository
bash
git clone https://github.com/lycantropos/rithm.git
cd rithm
Install dependencies
bash
python -m pip install -r requirements.txt
Install
bash
python setup.py install
With setup ```python
from rithm.integer import Int
we can:
- construct
python
Int() Int(0) Int(9) Int(9) Int('9') Int(9) Int('0b1001', 2) Int(9) Int('0o11', 8) Int(9) Int('0x9', 16) Int(9) Int('1001', 2) Int(9) Int('0o11', 8) Int(9) Int('9', 16) Int(9) Int(9.99) Int(9)
- compare
python
Int(9) == Int(9) True Int(9) >= Int(9) True Int(9) > Int(8) True Int(9) <= Int(9) True Int(9) < Int(10) True
- calculate
python
abs(Int(-9)) Int(9) Int(4) + Int(5) Int(9) Int(9) & Int(11) Int(9) Int(19) // Int(2) Int(9) ~Int(-10) Int(9) Int(19) % Int(10) Int(9) Int(3) * Int(3) Int(9) -Int(-9) Int(9) Int(1) | Int(8) Int(9) Int(3) ** Int(2) Int(9) Int(5) << Int(1) Int(10) Int(5) >> Int(1) Int(2) Int(25) - Int(16) Int(9) Int(18) / Int(2) Fraction(Int(9), Int(1)) Int(2) ^ Int(11) Int(9)
```
With setup ```python
from rithm.fraction import Fraction
we can:
- construct
python
Fraction() Fraction(Int(0), Int(1)) Fraction(1) Fraction(Int(1), Int(1)) Fraction(1, 2) Fraction(Int(1), Int(2)) Fraction(50, 100) Fraction(Int(1), Int(2)) Fraction(0.5) Fraction(Int(1), Int(2))
- compare
python
Fraction(1, 2) == Fraction(1, 2) True Fraction(1, 2) >= Fraction(1, 2) True Fraction(1, 2) > Fraction(1, 3) True Fraction(1, 2) < Fraction(2, 3) True Fraction(1, 2) != Fraction(1, 3) True
- calculate
python
abs(Fraction(-1, 2)) Fraction(Int(1), Int(2)) Fraction(1, 3) + Fraction(1, 6) Fraction(Int(1), Int(2)) Fraction(3, 2) // Fraction(1) Int(1) Fraction(3, 2) % Fraction(1) Fraction(Int(1), Int(2)) Fraction(1, 3) * Fraction(3, 2) Fraction(Int(1), Int(2)) -Fraction(-1, 2) Fraction(Int(1), Int(2)) Fraction(1, 2) ** 2 Fraction(Int(1), Int(4)) Fraction(3, 2) - Fraction(1) Fraction(Int(1), Int(2)) Fraction(1, 3) / Fraction(2, 3) Fraction(Int(1), Int(2))
```
```rust /// With setup use std::convert::TryFrom; use traiter::numbers::{ Abs, DivEuclid, FromStrRadix, Pow, RemEuclid, Zero }; use rithm::big_int;
type Digit = u16;
type Digit = u32;
const DIGITBITNESS: usize = (Digit::BITS - 1) as usize;
const _: () = assert!(bigint::isvaliddigitbitness::
```rust /// With setup use std::convert::TryFrom; use traiter::numbers::{Abs, DivEuclid, One, Pow, RemEuclid, Zero}; use rithm::fraction;
type Fraction = fraction::Fraction
Install bump2version.
Choose which version number category to bump following semver specification.
Test bumping version
bash
bump2version --dry-run --verbose $CATEGORY
where $CATEGORY
is the target version number category name, possible
values are patch
/minor
/major
.
Bump version
bash
bump2version --verbose $CATEGORY
This will set version to major.minor.patch-alpha
.
Test bumping version
bash
bump2version --dry-run --verbose release
Bump version
bash
bump2version --verbose release
This will set version to major.minor.patch
.
Install dependencies
bash
python -m pip install -r requirements-tests.txt
Plain
bash
pytest
Inside Docker
container:
- with CPython
bash
docker-compose --file docker-compose.cpython.yml up
- with PyPy
bash
docker-compose --file docker-compose.pypy.yml up
Bash
script:
- with CPython
bash
./run-tests.sh
or
bash
./run-tests.sh cpython
PyPy
bash
./run-tests.sh pypy
PowerShell
script:
- with CPython
powershell
.\run-tests.ps1
or
powershell
.\run-tests.ps1 cpython
- with PyPy
powershell
.\run-tests.ps1 pypy