3 ms·
> A physical value is two things: I would argue it is actually three things: a scalar, a unit, and an indication of error – which is at least another scalar, b
by skissane 5y ago
> A physical value is two things:
I would argue it is actually three things: a scalar, a unit, and an indication of error – which is at least another scalar, but there are multiple ways of expressing error, so it might require more than just a single scalar (such as an interval and the probability the actual value lies within that interval.)
> If the type system of your programming language does not allow you to define units, this should at least be a structure with a scalar and an enum
Ideally more than just an enum – Newton = kg*m*s^-2 (equivalently kg^1*m^1*s^-2) – which suggests a set of pairs (unit and exponent).
- linkdd 5y agoYes, thank you for the precisions, this just make my point stronger: int64/float are very ill-suited to represent such values. And it's especially true for time units. For example, "how many seconds is one month?" does not make sense, but "how many seconds is january/february/march?" does make sense. The unit "month" does not really exist, each calendar month is its own unit. And "february" is not even a "stable" unit because sometimes it's 28 days, sometimes it's 29 days. Even a minute can some rare times be 61 seconds. This is why in physics, we use seconds multiplied by powers of 10 and nothing else. To my knowledge, there is not a single programming language that differentiate a "scalar" and a "quantity" (scalar, unit, error).