this post was submitted on 28 Oct 2025
874 points (99.0% liked)

Programmer Humor

27248 readers
872 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 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] applebusch@lemmy.blahaj.zone 8 points 1 week ago (1 children)

This is why, in any competent software dealing with physics in any way, it is always metric under the hood. Someone wants to see a quantity in some stupid freedom units? Fine sure convert it for them, but internally everything should be metric. Physics is hard enough, there's no reason to make it worse with an inconsistent unit system with built in footguns somehow.

[–] moseschrute@lemmy.world 2 points 1 week ago

I agree, storing in a consistent unit is the way. That doesn’t solve conversion/rounding issues, but it does simplify things.

Though you can run into floating point errors when editing in one unit vs storing in another. For example, maybe the user entered 2 in unit A, then it’s converted to unit B and stored in the db. However, when it’s converted back to unit A, it’s 1.999999. Fortunately rounding fixes this. We say unit A and B get 2 decimals of precision, and 1.999999 becomes 2.00.