Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RealFrac Seconds instance #89

Merged
merged 3 commits into from
Aug 9, 2023
Merged

Conversation

amesgen
Copy link
Contributor

@amesgen amesgen commented Aug 8, 2023

Closes #87, see #87 (comment) for an analysis.

Consider the law of 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.

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.

With this change, we correctly get:

 Λ properFraction (-1 :: Seconds)
(-1,Seconds {toTimeSpec = TimeSpec {sec = 0, nsec = 0}})

@CetinSert CetinSert merged commit 1b41f50 into corsis:master Aug 9, 2023
35 checks passed
@amesgen amesgen deleted the fix-tests branch August 9, 2023 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure with QuickCheck 2.14.3
2 participants