2 ms·
> Just do it with a fixed-precision decimal number, and represent it as a string. Why? If you are going to do that, might as well use an integer of cents. It's
by Supermancho 7y ago
> Just do it with a fixed-precision decimal number, and represent it as a string.
Why? If you are going to do that, might as well use an integer of cents. It's more compact and if you're worried about these calculations and storing this kind of information, it's likely you are storing lots of it (or it wouldn't be a problem).
- arcticbull 7y agoIt’d need to be integer cents plus a scale factor which determines the smallest unit of currency. Japan has a scale factor of 0 as compared to the US 2. A string incorporates this conveniently. Either is fine.