improve remainder and modulo exact---inexact combinations#1010
improve remainder and modulo exact---inexact combinations#1010mflatt merged 1 commit intocisco:mainfrom
remainder and modulo exact---inexact combinations#1010Conversation
|
For the case of remainder with exact 1 or -1, why would the answer be inexact? The remainder of any real number and exact 1 is exactly 0. The update to the exact/inexact case produces the closest correctly rounded double, which makes a lot of sense to me. |
I don't think that's the way remainder and modulo are usually generalized to rationals. For example, We're not generalizing to rationals, but an exact 0 result still seems right to me on the grounds that something like |
|
Thanks, I now understand the rationale for making the remainder of an inexact integer with 1 or -1 to be inexact 0.0. That makes sense. |
When the second argument is `1` or `-1` and the first argument is ineact, return inexact `0`. When the first argument is exact and the second argument is inexact, compute as exact and then convert to inexact.
Intended to fix #1008:
When the second argument is
1or-1and the first argument is inexact, return inexact0.0.When the first argument is exact and the second argument is inexact, compute as exact and then convert to inexact.
A calculation like
(remainder #e1e1000 3.0)is about 10 times slower. Interestingly,(remainder #e1e100 3.0)is about 10 times faster, and(remainder #e1e10 3.0)is about twice as fast.