tidepool-org/tideline — pull request #8 by jebeck (2014-02-18 23:01:41+00:00)
Title: for discussion of strategy surrounding floating point numbers

Opening this for comment: my initial strategy here is to keep the imprecise floating point numbers. I'll use `d3.format()` to keep such things from ever being displayed.

The only issue then is creating tests that will pass even when an expected result such as `1.2` comes out as `1.20000000000002`. To solve this problem, I'm using chai's `.closeTo(value, delta)` with the delta set at `.00001`.

The two obvious alternatives (and reason why I rejected them) are:
- use JavaScript's `toPrecision()` to round the imprecise floating point numbers...problem here is that `toPrecision(3)` will give you `12.3` but `1.23`, so it doesn't control number of decimal places, it controls total digits.
- use the JavaScript port of Java's `BigDecimal` class. Cons here are just that's in an extra dependency and perhaps unnecessary. The port doesn't appear to be in npm or bower, only available [on GitHub](https://github.com/dtrebbien/BigDecimal.js).

Thoughts?