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.
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.
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.
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.