Skip to content

Commit 675a883

Browse files
committed
expt
1 parent 91466d4 commit 675a883

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/core/explain.rkt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,9 @@
478478
(define cond-x (abs yfl))
479479
(define cond-y (abs (* yfl (log xfl))))
480480

481+
(define cond-x.l (logabs ylog))
482+
(define cond-y.l (logabs (log* ylog (logln xlog))))
483+
481484
(cond
482485
;; Hallucination:
483486
;; x has a large exponent and y is 1. The ylogx is large but there is
@@ -517,10 +520,10 @@
517520

518521
[(and (overflow? xlog) (<= se MAX-EXP)) (mark-erroneous! subexpr 'oflow-rescue)]
519522

520-
[(and (or (> cond-x 100) (> cond-y 100)) (not (constant? y-ex)))
523+
[(and (or (log> cond-x.l 100.l) (log> cond-y.l 100.l)) (not (constant? y-ex)))
521524
(mark-erroneous! subexpr 'sensitivity)]
522525

523-
[(and (or (> cond-x 32) (> cond-y 32)) (not (constant? y-ex)))
526+
[(and (or (log> cond-x.l 32.l) (log> cond-y.l 32.l)) (not (constant? y-ex)))
524527
(mark-maybe! subexpr 'sensitivity)]
525528

526529
[else #f])]

src/core/logspace.rkt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@
123123
#true
124124
(* a (fllog2 euler.0))))
125125

126+
(define (logexpt A B)
127+
(match-define (logfl a sa ea) A)
128+
(match-define (logfl b sb eb) B)
129+
(logfl (exp a)
130+
(>= (expt a b) 0.0)
131+
(* a (fllog2 b))))
132+
126133
(define (logsqrt A)
127134
(match-define (logfl a sa ea) A)
128135
(logfl (sqrt a)
@@ -193,7 +200,7 @@
193200
['log/ log/]
194201
['logln logln]
195202
['logexp logexp]
196-
; ['logexpt logexpt]
203+
['logexpt logexpt]
197204
['logsin logsin]
198205
['logcos logcos]
199206
['logtan logtan]

0 commit comments

Comments
 (0)