Decimal vs Double Speed

Floating point arithmetic will almost always be significantly faster because it is supported directly by the hardware. So far almost no widely used hardware supports decimal arithmetic (although this is changing, see comments). Financial applications should always use decimal numbers, the number of horror stories stemming from using floating point in financial applications is endless, … Read more

Precise Financial Calculation in JavaScript. What Are the Gotchas?

You should probably scale your decimal values by 100, and represent all the monetary values in whole cents. This is to avoid problems with floating-point logic and arithmetic. There is no decimal data type in JavaScript – the only numeric data type is floating-point. Therefore it is generally recommended to handle money as 2550 cents … Read more

tech