Cendyne on Nostr: APIs that encode monetary values as doubles (or specifically with a decimal point) ...
APIs that encode monetary values as doubles (or specifically with a decimal point) give me the heebie jeebies. Would you like to add 1.1 enough times to eventually get a number with a third decimal place?
Google does nano-dollars as a full number and it stays within the 2^53 limit of doubles. I can respect whole numbers over json.
Published at
2024-04-04 17:54:43Event JSON
{
"id": "6f6b09679e7cff173d3c87a26b73293a40a59dc2d8583f048f028c42b80e61c0",
"pubkey": "e8b16f3e88b718aaaee4413fccd86ad85dacfbc2c87ca5b2dcb23192d46a53f2",
"created_at": 1712253283,
"kind": 1,
"tags": [
[
"proxy",
"https://furry.engineer/users/cendyne/statuses/112214231205629902",
"activitypub"
]
],
"content": "APIs that encode monetary values as doubles (or specifically with a decimal point) give me the heebie jeebies. Would you like to add 1.1 enough times to eventually get a number with a third decimal place?\n\nGoogle does nano-dollars as a full number and it stays within the 2^53 limit of doubles. I can respect whole numbers over json.",
"sig": "758ea43899d15261e9a3113ac1771e629980c70bdf08f7aa4a19651621660bd6ed49d9272643c16a331af24b1b893242d963dca0f9ce33332312772d0d7eeb03"
}