Skip to content

Dylan-DPC-zz/ufo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UFO (Unsigned Float Objects)

Latest Version

This crate provides unsigned floats by defining two wrappers - a UF32 and UF64. The type is equivalent to storing a positive number of the underlying type (f32 or f64) and no optimisations have been carried out to use the sign bit to store another bit of the data.

Installation

To use this as a dependency, add it to your Cargo.toml file:

ufo = "0.1"

If you need serialization, enable the serde feature

ufo = { version = "0.1", features = ["serde"] }

There is also a nightly feature that takes advantage of the TryFrom/TryInto traits

Usage

use ufo::Uf32;

fn main() {
    let a = Uf32::try_new(1.0).expect("invalid number");
    let b = Uf32::try_new(2.0).expect("invalid number");
    assert_eq!(a + b, Uf32::try_new(3.0).expect("invalid number"))
}

Contribution

If you want to suggest any new feature or report a bug, you can open an issue here or drop in a pull request directly.

Right now, I still need to tests for most of the functions, so you can test it locally by running:

cargo test 

When submitting a Pull request, run cargo fmt on the latest nightly before committing.

License

Licensed under either of

at your option.

About

Unsigned floats

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages