logoalt Hacker News

ivanmontillamyesterday at 1:01 PM1 replyview on HN

For JSON serialization, which doesn't support fixed-point precision it does.

Floating-point precision has too many gotchas for being suitable to store Decimal types, especially for the Currency use case.


Replies

notpushkinyesterday at 1:22 PM

Surely it does:

  {
    "price": {
      "amount": 1000,
      "decimal_places": 2,
      "currency": "USD"
    }
  }
show 1 reply