Giter Club home page Giter Club logo

ieee754's Introduction

ieee754

Build Status codecov

Low-level manipulations of IEEE754 floating-point numbers.

This library includes:

  • no_std support by default,
  • ulp computation (units in the last place, representing the resolution of a float),
  • miscellaneous functions like nextafter (next and prev), copysign (copy_sign), abs, sign,
  • the IEEE-754 totalOrder predicate for doing Ord::cmp-like comparisons on floats,
  • an iterator over every floating point value in a range,
  • a parallel iterator over every floating point value in a range (optional: activate with the rayon feature),
  • relative error computation.

Documentation, crates.io.

ieee754's People

Contributors

clarfonthey avatar huonw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ieee754's Issues

Fails on latest nightly

The from_bits method has been added to nightly but requires the float_bits_conv feature flag.

SemVer backwards incompatible change in 0.2.6

Hi there! Version 0.2.6 contains a SemVer backwards incompatible change and should have been made 0.3. The problem is the addition of a public item (method abs()) to a trait (Ieee754). In my crate accurate I do not implement the Ieee754 trait as such, but I have it in scope together with the Float trait from num-traits which also has a method abs(). x.abs() where x: T and T: Float + Ieee754 used to be unambiguous, but with ieee754 0.2.6 it is not. I can work around this by using Float::abs(x). Just wanted to let you know.

Consider simplifying the API and using free functions more

Much of the API can probably be implemented in terms of a much more minimal Ieee754 trait, that basically just describes the bit layout. Everything could then be implemented as (generic) free functions, like ieee754::ulp(1.0), or ieee754::iter(0.0..1.0)

Have Iter support the rayon parallel iteration traits

x.upto(y) is (at least by me) used a lot for exhaustive testing of floating point algorithms. This sort of task is often embarassingly parallel, and the iteration should break-up-able in O(1) time (and fairly, simply, I think).

I think this should be a conditional feature, though, and not on by default, since I imagine it breaks no-std.

Ieee754::next() yields NaN for -0.0

Looking at the code, it looks like it is supposed to handle that case, but somehow it is not working. Calling .next() on -0.0 yields NaN.

Switch iteration to manipulating bits directly

The current Iter<T> stores two Ts for the start and end, and then requires jumping back and forth between the raw bits and the floating-point, including doing unnecessary computation/checks by using the public next API, especially with the fix for #1. This can probably be significantly optimized by either storing the raw bits and only converting to a float as the last step of Iter::next, or at least splitting next into a public and a private API.

Add "float" to crates.io keywords

This crate should really appear close to the top of search results for "float" in crates.io, without having to remember the exact number of the IEEE standard :)

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.