Coder Social home page Coder Social logo

ufo's Introduction

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.

ufo's People

Contributors

dylan-dpc avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.