|
25 | 25 | (values out (or (and a! b! exact?) (and a! (bfinfinite? a)) (and b! (bfinfinite? b))))) |
26 | 26 |
|
27 | 27 | (define (ival-add! out x y) |
28 | | - (define-values (lo-val lo-imm?) (eplinear! (ival-lo-val out) mpfr-add! (ival-lo-val x) (ival-lo-fixed? x) (ival-lo-val y) (ival-lo-fixed? y) 'down)) |
29 | | - (define-values (hi-val hi-imm?) (eplinear! (ival-hi-val out) mpfr-add! (ival-hi-val x) (ival-hi-fixed? x) (ival-hi-val y) (ival-hi-fixed? y) 'up)) |
| 28 | + (define-values (lo-val lo-imm?) |
| 29 | + (eplinear! (ival-lo-val out) |
| 30 | + mpfr-add! |
| 31 | + (ival-lo-val x) |
| 32 | + (ival-lo-fixed? x) |
| 33 | + (ival-lo-val y) |
| 34 | + (ival-lo-fixed? y) |
| 35 | + 'down)) |
| 36 | + (define-values (hi-val hi-imm?) |
| 37 | + (eplinear! (ival-hi-val out) |
| 38 | + mpfr-add! |
| 39 | + (ival-hi-val x) |
| 40 | + (ival-hi-fixed? x) |
| 41 | + (ival-hi-val y) |
| 42 | + (ival-hi-fixed? y) |
| 43 | + 'up)) |
30 | 44 | (ival (endpoint lo-val lo-imm?) |
31 | 45 | (endpoint hi-val hi-imm?) |
32 | 46 | (or (ival-err? x) (ival-err? y)) |
|
36 | 50 | (ival-add! (new-ival) x y)) |
37 | 51 |
|
38 | 52 | (define (ival-sub! out x y) |
39 | | - (define-values (lo-val lo-imm?) (eplinear! (ival-lo-val out) mpfr-sub! (ival-lo-val x) (ival-lo-fixed? x) (ival-hi-val y) (ival-hi-fixed? y) 'down)) |
40 | | - (define-values (hi-val hi-imm?) (eplinear! (ival-hi-val out) mpfr-sub! (ival-hi-val x) (ival-hi-fixed? x) (ival-lo-val y) (ival-lo-fixed? y) 'up)) |
| 53 | + (define-values (lo-val lo-imm?) |
| 54 | + (eplinear! (ival-lo-val out) |
| 55 | + mpfr-sub! |
| 56 | + (ival-lo-val x) |
| 57 | + (ival-lo-fixed? x) |
| 58 | + (ival-hi-val y) |
| 59 | + (ival-hi-fixed? y) |
| 60 | + 'down)) |
| 61 | + (define-values (hi-val hi-imm?) |
| 62 | + (eplinear! (ival-hi-val out) |
| 63 | + mpfr-sub! |
| 64 | + (ival-hi-val x) |
| 65 | + (ival-hi-fixed? x) |
| 66 | + (ival-lo-val y) |
| 67 | + (ival-lo-fixed? y) |
| 68 | + 'up)) |
41 | 69 | (ival (endpoint lo-val lo-imm?) |
42 | 70 | (endpoint hi-val hi-imm?) |
43 | 71 | (or (ival-err? x) (ival-err? y)) |
|
158 | 186 | (define err (or (ival-err x) (ival-err y))) |
159 | 187 | (define x* (ival-exact-fabs x)) |
160 | 188 | (define y* (ival-exact-fabs y)) |
161 | | - (define-values (lo-val lo-imm?) (rnd 'down eplinear bfhypot (ival-lo-val x*) (ival-lo-fixed? x*) (ival-lo-val y*) (ival-lo-fixed? y*))) |
162 | | - (define-values (hi-val hi-imm?) (rnd 'up eplinear bfhypot (ival-hi-val x*) (ival-hi-fixed? x*) (ival-hi-val y*) (ival-hi-fixed? y*))) |
163 | | - (ival (endpoint lo-val lo-imm?) |
164 | | - (endpoint hi-val hi-imm?) |
165 | | - err? |
166 | | - err)) |
| 189 | + (define-values (lo-val lo-imm?) |
| 190 | + (rnd 'down |
| 191 | + eplinear |
| 192 | + bfhypot |
| 193 | + (ival-lo-val x*) |
| 194 | + (ival-lo-fixed? x*) |
| 195 | + (ival-lo-val y*) |
| 196 | + (ival-lo-fixed? y*))) |
| 197 | + (define-values (hi-val hi-imm?) |
| 198 | + (rnd 'up |
| 199 | + eplinear |
| 200 | + bfhypot |
| 201 | + (ival-hi-val x*) |
| 202 | + (ival-hi-fixed? x*) |
| 203 | + (ival-hi-val y*) |
| 204 | + (ival-hi-fixed? y*))) |
| 205 | + (ival (endpoint lo-val lo-imm?) (endpoint hi-val hi-imm?) err? err)) |
0 commit comments