Douglas Crockford, for JavaScript: The Good Parts(sayyouresorryforwhatyouvedone.blogspot.com) |
Douglas Crockford, for JavaScript: The Good Parts(sayyouresorryforwhatyouvedone.blogspot.com) |
> I say we have a reasonable expectation that people writing code that does financial calculations have a fucking clue as to how their math will work on a computer.
No we don't.
> He goes on to suggest that the right way to handle this is by scaling your values to be in cents (or whatever quanta you happen to care about). It's interesting to see DSP-world fixed point evangelism suddenly materialize in JavaScript. Be warned: unless you heavily wrap this scaled approach in objects, you will make a mistake somewhere.
What? It's more likely you'll make a mistake dealing in whole cents than doing floating point math? Really?