58 ms·
The name cent shouldn't throw you off here as applying only to US currency. Many other currencies have a notional 1/100th unit of the basic one, that usually al
by rys 14y ago
The name cent shouldn't throw you off here as applying only to US currency. Many other currencies have a notional 1/100th unit of the basic one, that usually also exists as a cash value.
- xnxn 14y agoSo s/cent/atomic subunit/, because "for money, work in cents" is meaningless for yen and ambiguous for Bitcoin ("bitcents" or "satoshis"?)
- mikeash 14y agoIf only people reading my comment had some sort of brain with which to interpret it instead of being doomed to apply only the exact literal meaning.
- alecperkins 14y agoI'm afraid you ask too much of the Internet.
- pretoriusB 14y agoYes, he clearly should have taken into account any possible subunit denomination, including exotic native tribe money units like sea shells, because international programmers reading HN are not expected to think of that of their own.
- xnxn 14y agoSuch vitriol! Can your currency code handle sea shells? It should! :) I only mention it because the yen thing surprised me once as a newbie programmer. (A tip: "%0.2f" is no substitute for actual i18n.) It never hurts to be aware of the edge cases.
- pretoriusB 14y ago>Can your currency code handle sea shells? I'm afraid it mine can only handle sea shells! >I only mention it because the yen thing surprised me once as a newbie programmer. So what's the yen thing? How does it differ?
- xnxn 14y agoThe yen has no fractional units (anymore), so when I added support for that currency but continued to use the same format string as all the others, prices like ¥1000.00 looked unnatural.
- snogglethorpe 14y agoThe historical subunit of the yen is the "sen" (銭), which you often seen mentioned in prewar books. Postwar inflation made sen-denominated currency obsolete, but... [A bit of googling also turns up the "rin" (厘), which is a thousandth of a yen...]