#float #error

efloat

Error-bounded Floating Point

1 unstable release

Uses old Rust 2015

0.2.0 May 4, 2018

#48 in #float

MIT license

11KB
258 lines

efloat

MIT licensed

Documentation is available at https://docs.rs/efloag

efloat is a component within the Siege Engine MMO game engine, but should be generally useful outside of that context.

The Siege Engine is an MMO game engine on the Vulkan API written in the Rust language.

efloat provides floating a point type that remembers how far off it might be from the actual precise value, based upon its history. It keeps and upper and lower error bound internally, and you can check those with function calls.


lib.rs:

efloat

licensed under the MIT License (MIT) Copyright (c) 2018 Michael Dilger

This is a floating point type that remembers how far off it might be from the actual precise value, based on it's history. It keeps and upper and lower error bound internally, and you can check those with function calls.

Here are a few tips:

  • Multiplication and division don't cause too much error.
  • Addition is ok, but subtraction (or addition of differing signs) has a terrible error bound.
  • Operate on small numbers first, working up, so that the larger errors don't propogate and grow as much.

Logic taken from pbrt-v3: https://github.com/mmp/pbrt-v3 (efloat.h class) by Matt Pharr, Greg Humphreys, and Wenzel Jakob.

No runtime deps