Closed amesgen closed 1 year ago
Closes #87, see https://github.com/corsis/clock/issues/87#issuecomment-1576119653 for an analysis.
Consider the law of properFraction:
properFraction
The function properFraction takes a real fractional number x and returns a pair (n,f) such that x = n+f, and: n is an integral number with the same sign as x; and f is a fraction with the same type and sign as x, and with absolute value less than 1.
The function properFraction takes a real fractional number x and returns a pair (n,f) such that x = n+f, and:
x
(n,f)
x = n+f
n
f
1
Before this change, we had
Λ properFraction (-1 :: Seconds) (0,Seconds {toTimeSpec = TimeSpec {sec = -1, nsec = 0}})
which violates the second property above, as f = Seconds {toTimeSpec = TimeSpec {sec = -1, nsec = 0}} has absolute value 1, which is not less than 1.
f = Seconds {toTimeSpec = TimeSpec {sec = -1, nsec = 0}}
With this change, we correctly get:
Λ properFraction (-1 :: Seconds) (-1,Seconds {toTimeSpec = TimeSpec {sec = 0, nsec = 0}})
Closes #87, see https://github.com/corsis/clock/issues/87#issuecomment-1576119653 for an analysis.
Consider the law of
properFraction
:Before this change, we had
which violates the second property above, as
f = Seconds {toTimeSpec = TimeSpec {sec = -1, nsec = 0}}
has absolute value1
, which is not less than1
.With this change, we correctly get: