Skip to content

Commit

Permalink
debugged formula of pow
Browse files Browse the repository at this point in the history
  • Loading branch information
AYadrov committed Oct 17, 2024
1 parent 5dc53ca commit 4b34092
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions eval/adjust.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@

; Intro and ampl propogation for each tail instruction
(define ampl-bounds (get-bounds op output srcs)) ; ampl bounds for children instructions

(for ([x (in-list tail-registers)]
[bound (in-list ampl-bounds)]
#:when (>= x varc)) ; when tail register is not a variable
Expand Down
13 changes: 10 additions & 3 deletions eval/tricks.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,20 @@

; when output crosses zero and x is negative - means that y was fractional and not fixed (specific of Rival)
; solution - add more slack for y to converge
(define slack
(define y-slack
(if (and (crosses-zero? z) (bfnegative? (ival-lo x)))
(get-slack)
0))

(list (list (+ (maxlog y) (logspan x) (logspan z)) (minlog y #:underestimate #t)) ; bounds per x
(list (+ (maxlog y) (max (abs (maxlog x)) (abs (minlog x))) (logspan z) slack)
; when output is (ival 0.bf 1.bf) - it means that x was close to 1 or 0 but not narrow enough
(define x-slack
(if (and (bfzero? (ival-lo z)) (bfinteger? (ival-hi z)))
(get-slack)
0))

(list (list (+ (maxlog y) (logspan x) (logspan z) x-slack)
(minlog y #:underestimate #t)) ; bounds per x
(list (+ (maxlog y) (max (abs (maxlog x)) (abs (minlog x))) (logspan z) y-slack)
(minlog y #:underestimate #t)))] ; bounds per y

[(ival-exp ival-exp2)
Expand Down
9 changes: 7 additions & 2 deletions time.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
(for/list ([pt (in-list (hash-ref rec 'points))])
; Rival execution
(define rival-start-apply (current-inexact-milliseconds))

(match-define (list rival-status rival-exs)
(parameterize ([*rival-max-precision* 32256])
(with-handlers ([exn:rival:invalid? (λ (e) (list 'invalid #f))]
Expand Down Expand Up @@ -151,7 +152,10 @@

; Count differences where baseline is better than rival
(define rival-baseline-difference
(if (and (equal? rival-status 'unsamplable) (equal? baseline-status 'valid)) 1 0))
(if (and (or (equal? rival-status 'unsamplable) (equal? rival-status 'invalid))
(equal? baseline-status 'valid))
1
0))

(cons rival-status (cons rival-apply-time rival-baseline-difference))))

Expand Down Expand Up @@ -313,7 +317,8 @@
(define (html-write-row port row)
(when port
(fprintf port "<tr>")
(for ([cell (in-list row)] [heading (in-list current-heading)])
(for ([cell (in-list row)]
[heading (in-list current-heading)])
(define unit
(match heading
[(list _ s) s]
Expand Down

0 comments on commit 4b34092

Please sign in to comment.