426
you are viewing a single comment's thread
view the rest of the comments
[-] psud@aussie.zone 38 points 1 year ago

If working in currency, work in cents and divide by 100 and round to 2 decimals for output

[-] janAkali@lemmy.one 20 points 1 year ago* (last edited 1 year ago)

Most languages have decimal libraries to correctly handle floating point arithmetics, where precision is necessary.

[-] Slotos@feddit.nl 1 points 1 year ago

They are as incapable of handling one third of a dollar as binary positional notation is incapable of handling one fifth (0.2).

It’s not really a float problem. It’s a positional notation one. Some perfectly rational numbers refuse to squeeze into that mold.

[-] szczuroarturo@programming.dev 1 points 1 year ago

Also decimal system is not exatcly that much better since you also cant write 1/3 in decimal

load more comments (14 replies)
this post was submitted on 17 Sep 2023
426 points (96.5% liked)

Programmer Humor

19551 readers
592 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS