|
|
|
|
|
by zawaideh
299 days ago
|
|
There are so many odd decisions and/or bugs with it.. for example, logging the weight in Kilograms using shortcuts and asking it to read it back while sometimes run into float rounding 75.0000000000001... why not store in grams as an integer!! Sometimes time in bed is shorter than time asleep! |
|
Imagine you record length and your user enters 7.4 ft. You store an integer number of millimetres, and the nearest one is 2256. For a while it is fine, but at some point someone on GUI side makes conversion more precise and now from vantage point of the user the original 7.4 ft somehow retroactively became 7.401575 ft.
While a basic string could be the most reliable way to preserve data as entered, numbers with decimal point are formatted differently across countries, so it you want a 1,25 entered in Sweden to appear as 1.25 after your user moves to the US, it makes sense to record it using a decimal structure exactly as entered, along with a unit of measure. Another benefit of decimal structures is that you can store precision and thus distinguish a 7.4 ft that could have been 7.39 ft or 7.41 ft (the measuring device was not very accurate) from exactly 7.400 ft.