Skip to content

Commit 6465024

Browse files
committed
Also rewrite hypot to look good
1 parent 7992b57 commit 6465024

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

ops/arith.rkt

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,8 @@
154154
(define (ival-hypot x y)
155155
(define err? (or (ival-err? x) (ival-err? y)))
156156
(define err (or (ival-err x) (ival-err y)))
157-
(define x* (ival-exact-fabs x))
158-
(define y* (ival-exact-fabs y))
159-
(define-values (lo-val lo-imm?)
160-
(rnd 'down
161-
eplinear
162-
bfhypot
163-
(ival-lo-val x*)
164-
(ival-lo-fixed? x*)
165-
(ival-lo-val y*)
166-
(ival-lo-fixed? y*)))
167-
(define-values (hi-val hi-imm?)
168-
(rnd 'up
169-
eplinear
170-
bfhypot
171-
(ival-hi-val x*)
172-
(ival-hi-fixed? x*)
173-
(ival-hi-val y*)
174-
(ival-hi-fixed? y*)))
157+
(match-define (ival (endpoint xlo xlo!) (endpoint xhi xhi!) _ _) (ival-exact-fabs x))
158+
(match-define (ival (endpoint ylo ylo!) (endpoint yhi yhi!) _ _) (ival-exact-fabs y))
159+
(define-values (lo-val lo-imm?) (rnd 'down eplinear bfhypot xlo xlo! ylo xlo!))
160+
(define-values (hi-val hi-imm?) (rnd 'up eplinear bfhypot xhi xhi! yhi yhi!))
175161
(ival (endpoint lo-val lo-imm?) (endpoint hi-val hi-imm?) err? err))

0 commit comments

Comments
 (0)