3 ms·
To store dollars with a precision of 1 cent, you store into your integers cents instead of dollars. No need to mess with anything more complicated.
by hortense 3y ago
To store dollars with a precision of 1 cent, you store into your integers cents instead of dollars. No need to mess with anything more complicated.
- pests 3y agoGas is sold in 9/10th of a cent fraction. What now?
- hortense 3y agoTo store dollars with a precision of 1/10 cent, you store into your integers 1/10 cents instead of dollars.
- John23832 3y ago>To store dollars with a precision of 1 cent, you store into your integers cents instead of dollars. No need to mess with anything more complicated. As someone who does it, financial math is often done at a precision of more than 1 cent. This is the reason that most (high-latency) financial libraries use strings underneath. This al doesn't address the high order floating point arithmetic of geo-spacial, which was the Patriot issue.
- hortense 3y agoTo store dollars with a precision of 1 billionth of a cent, you store into your integers 1 billionth of cents instead of dollars.