4 ms·
Time is a number. At least, it makes sense to subtract them (I guess you can say that time is a one dimensional affine space).
by snicker7 5y ago
Time is a number. At least, it makes sense to subtract them (I guess you can say that time is a one dimensional affine space).
- kzrdude 5y agojust like pointers, it makes sense to subtract them and add offsets but to straight up add them makes no sense.
- pjc50 5y agoTime is a number and a location. If you normalize everything to a reference time such as the UNIX epoch, you can usually do subtraction. Even then you may have got the times from a non-monotonic clock ...
- bsza 5y agoTime is a number, but a date is not. 211231 + 1 != 211232.
- karpierz 5y agoTo be specific, that representation of date does not implement integer addition. To be fair, neither do most "number" types (uint, int, float, etc). For uint, you actually have x + y = (x + y) mod MAX_UINT. For float, sometimes x + 1 = x. The issue is not that date is not a number, but that people poorly reason about common cases of date arithmetic. Similar stuff comes up for floats and ints but they're just easier to reason about.
- gkop 5y ago> For float, sometimes x + 1 = x Would you spell this out for us?
- eska 5y agoIf x is a huge number, then elimination can happen. Floating point numbers store a mantissa and an exponent, m^e. When you have a huge number the exponent will be large. So the mantissa can not express the tiny number anymore.
- cmeacham98 5y agoFloats effectively work by specifying a level of precision and a multiplier against that. For big numbers, you need a lower precision (larger gap) between the representable values. Eventually the precision gets so low that adding 1 doesn't reach the next possible value and rounds back down to your current value.
- kaba0 5y agoBit of a nitpick, but due to relativity, time is not simply a number though.