Skip to content

Commit 0a03c43

Browse files
committed
fmt
1 parent f252dff commit 0a03c43

File tree

2 files changed

+67
-12
lines changed

2 files changed

+67
-12
lines changed

ops/arith.rkt

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,22 @@
2525
(values out (or (and a! b! exact?) (and a! (bfinfinite? a)) (and b! (bfinfinite? b)))))
2626

2727
(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))
3044
(ival (endpoint lo-val lo-imm?)
3145
(endpoint hi-val hi-imm?)
3246
(or (ival-err? x) (ival-err? y))
@@ -36,8 +50,22 @@
3650
(ival-add! (new-ival) x y))
3751

3852
(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))
4169
(ival (endpoint lo-val lo-imm?)
4270
(endpoint hi-val hi-imm?)
4371
(or (ival-err? x) (ival-err? y))
@@ -158,9 +186,20 @@
158186
(define err (or (ival-err x) (ival-err y)))
159187
(define x* (ival-exact-fabs x))
160188
(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))

ops/pow.rkt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,24 @@
3939
(define y-class (classify-ival y))
4040

4141
(define (mk-pow a b c d)
42-
(define-values (lo lo!) (rnd 'down eppow (endpoint-val a) (endpoint-immovable? a) (endpoint-val b) (endpoint-immovable? b) x-class y-class))
43-
(define-values (hi hi!) (rnd 'up eppow (endpoint-val c) (endpoint-immovable? c) (endpoint-val d) (endpoint-immovable? d) x-class y-class))
42+
(define-values (lo lo!)
43+
(rnd 'down
44+
eppow
45+
(endpoint-val a)
46+
(endpoint-immovable? a)
47+
(endpoint-val b)
48+
(endpoint-immovable? b)
49+
x-class
50+
y-class))
51+
(define-values (hi hi!)
52+
(rnd 'up
53+
eppow
54+
(endpoint-val c)
55+
(endpoint-immovable? c)
56+
(endpoint-val d)
57+
(endpoint-immovable? d)
58+
x-class
59+
y-class))
4460

4561
(define-values (real-lo! real-hi!)
4662
(cond

0 commit comments

Comments
 (0)