Comment

Comment by sluukkonen

It’s easier just to use a proper decimal type than to remember all of the ways where using floats will bite you in the ass. The behavior is unintuitive even in trivial examples. Code like

  amount_due = 0.10 + 0.20
  amount_paid = 0.30
  
  if amount_paid >= amount_due:
      print("PAID")
  else:
      print("OUTSTANDING")
will print “OUTSTANDING”.
parent sluukkonen 1 month ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton