Skip to content

Commit d67c600

Browse files
committed
Clearer
1 parent 2a4b66c commit d67c600

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

main.rkt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@
400400
(and b! (bfzero? b))
401401
(and b! (bfinfinite? b) (not (= a-class 0))))))
402402

403+
(define (ival-copy-movability i1 i2)
404+
(ival (endpoint (ival-lo-val i1) (ival-lo-fixed? i2))
405+
(endpoint (ival-hi-val i1) (ival-hi-fixed? i2))
406+
(ival-err? i1)
407+
(ival-err i1)))
408+
403409
(define (ival-pow-pos x y)
404410
;; Assumes x is positive; code copied from ival-mult
405411
(match-define (ival xlo xhi xerr? xerr) x)
@@ -410,17 +416,10 @@
410416
(define (mk-pow a b c d)
411417
(match-define (endpoint lo lo!) (rnd 'down eppow a b x-class y-class))
412418
(match-define (endpoint hi hi!) (rnd 'up eppow c d x-class y-class))
419+
(define out (ival (endpoint lo lo!) (endpoint hi hi!) (or xerr? yerr?) (or xerr yerr)))
413420
(if (or (bfzero? lo) (bfinfinite? lo) (bfzero? hi) (bfinfinite? hi))
414-
;; Leverages ival-exp's overflow logic to sometimes set extra immovability flags
415-
(let ([v2 (ival-exp (ival-mult y (ival-log x)))])
416-
(ival (endpoint lo (ival-lo-fixed? v2))
417-
(endpoint hi (ival-hi-fixed? v2))
418-
(or xerr? yerr?)
419-
(or xerr yerr)))
420-
(ival (endpoint lo (or lo!))
421-
(endpoint hi (or hi!))
422-
(or xerr? yerr?)
423-
(or xerr yerr))))
421+
(ival-copy-movability out (ival-exp (ival-mult y (ival-log x))))
422+
out))
424423

425424
(match* (x-class y-class)
426425
[( 1 1) (mk-pow xlo ylo xhi yhi)]

0 commit comments

Comments
 (0)