break_infinity

Crates.iobreak_infinity
lib.rsbreak_infinity
version0.3.0
sourcesrc
created_at2020-12-19 13:54:04.167625
updated_at2021-10-05 13:38:24.312261
descriptionA library for larger numbers up to 1e1.79e308 in Rust for Incremental Games
homepagehttps://github.com/Redfire75369/break-infinity.rs#readme
repositoryhttps://github.com/Redfire75369/break-infinity.rs
max_upload_size
id324562
size58,157
Redfire (Redfire75369)

documentation

https://docs.rs/break_infinity

README

break-infinity.rs

A port of Patashu's break_infinity.js to Rust. It has the Decimal struct which is able to reach a maximum value of 1e1.79e308 instead of f64's maximum of 1.79e308.

Installation

You can install this package via Cargo by adding these lines to your Cargo.toml.

[dependencies]
break_infinity="0.3.0"
# ...

Usage

This library allows simple creation of Decimal's through many different methods.

use break_infinity as bi;

fn main() {
	let x = bi::new(123.4567);
	let y = bi::from_string(&String::from("123456.7e-3"));
	let z = bi::from_decimal(x);
}

Methods that return a Decimal can also be chained

use break_infinity as bi;

fn main() {
	let short = ((x / &y + &z) * &bi::new(9.0)).floor();
	let long = x.ceil()
		.exp()
		.log10();
}

For a complete list of functions and methods, refer to the docs.

Acknowledgements

Patashu and Razenpok for creating the original break_infinity.js that this is based off of.

Commit count: 15

cargo fmt