you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 1 year ago (4 children)

That doesn't make any sense. As you say, in that case you have to "spread leftovers", but that isn't really any more difficult with floats than integers.

It's better to use integers, sure. But you're waaaay over-blowing the downsides of floats here. For 99% of uses f64 will be perfectly fine. Obviously don't run a stock exchange with them, but think about something like a shopping cart calculation or a personal finance app. Floats would be perfectly fine there.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 2 points 1 year ago

    As someone who has implemented shopping carts, invoicing solutions and banking transactions I can assure you floats will be extremely painful for you.

    A huge benefit of big decimals is that they don't allow you to make a mistake (as easily) as floats where imprecision just "creeps in".

  • source
  • parent
  • [–] 2 points 1 year ago (2 children)

    As you said, better use integers. And that's exactly what is done at this point.

  • source
  • parent
  • hideshow 2 child comments