3 ms·
Work in 1/100ths of cents? You will have to convert those strings to numbers at some point (or use a specialised library format).
by ricardobeat 14y ago
Work in 1/100ths of cents? You will have to convert those strings to numbers at some point (or use a specialised library format).
- fdr 14y agoThe latter. Such as big.js (not an endorsement, my understanding is too weak for that). Just about every practically used programming environment from every walk of life has such a thing in the standard library, and I suppose they are there for good reasons. However, the fact is that Javascript doesn't have one, so one will have to weigh dependencies into their decision. Go - math/big Java - BigDecimal Python - decimal Ruby - BigDecimal PostgreSQL - numeric Interesting mention: decimal in C#, deemed sufficient for monetary calculations at 128 bits of precision. Another interesting mention: Oracle, which in my understanding handles just about all its numbers this way, by default. This might tell you something about their early customer base.
- wukix 14y agoLisp - rationals http://wukix.com/lisp-decimals http://wukix.com/lisp-decimals
- dietrichepp 14y agoCS history lesson -- don't use rationals for money. You have no business messing with the denominator, so the extra freedom of using arbitrary rationals is just more rope to hang yourself with.
- dllthomas 14y agoIncidentally, 1/100th of a cent is a "milray", defined in A Connecticut Yankee In King Arthur's Court.