Rust Opis

Opis is an arithmetic library for integer numbers written in Rust.

Usage

In your Cargo.toml:

```

[dependencies] opis = "1.1.0"

```

In your Rust file:

```

use opis::Int;

```

Features

API

Conversion Functions

From Str:

```

let integer: Int = Int::from_str("6747", 10)?;

```

To Str:

```

let binarystr: String = integer.tostr(2);

```

Arithmetic Functions

Addition

```

let s = inta.add(&int2b);

```

Subtraction

```

let d = inta.sub(&intb).unwrap();

```

Multiplication

```

let p = inta.mul(&intb);

```

Division

```

let q = inta.div(&intb).unwrap();

```

Remainder

```

let r = inta.rem(&intb).unwrap();

```

Modulo

```

let m = inta.modulo(&intb).unwrap();

```

Exponentiation

```

let p = inta.pow(&inte);

```

Modular Inverse

```

let mi = inta.modinv(&int_m);

```

Comparison Functions

```

let ans1: bool = inta.isgreater(&intb);

let ans2: bool = inta.isless(&intb);

let ans3: bool = inta.isequal(&intb);

```

Bitwise Functions

NOT

```

let n = int_x.not();

```

AND

```

let a = intx.and(&inty);

```

OR

```

let o = intx.or(&inty);

```

XOR

```

let x = intx.xor(&inty);

```

Future

Contribution

Pull requests, bug reports and any kind of suggestion are welcome.

2021-12-12