



Bits error versus re




Bits error versus im
| Original | 43.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.8 |
Initial program 43.8
Taylor expanded around 0 0.8
Simplified0.8
rmApplied log1p-expm1-u0.8
Final simplification0.8
herbie shell --seed 2019016 +o rules:numerics
(FPCore (re im)
:name "math.cos on complex, imaginary part"
:herbie-target
(if (< (fabs im) 1) (- (* (sin re) (+ (+ im (* (* (* 1/6 im) im) im)) (* (* (* (* (* 1/120 im) im) im) im) im)))) (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
Time bar (total: 33.0s)Debug log
| 520× | (pre true 80) |
| 166× | (body real 1280) |
| 149× | (body real 80) |
| 118× | (body real 640) |
| 55× | (body real 320) |
| 32× | (body real 160) |
| 238.0ms | (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))) |
1 alts after pruning (1 fresh and 0 done)
Merged error: 44.5b
Found 2 expressions with local error:
| 4.2b | (- (exp (- im)) (exp im)) |
| 0.0b | (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))) |
| 27× | prod-diff |
| 26× | *-un-lft-identity |
| 26× | add-sqr-sqrt |
| 22× | add-cube-cbrt |
| 11× | distribute-lft-in |
| 11× | distribute-rgt-in |
| 5× | associate-*r* |
| 4× | add-log-exp |
| 4× | add-exp-log |
| 4× | add-cbrt-cube |
| 4× | pow1 |
| 3× | fma-neg |
| 3× | sub-neg |
| 2× | difference-of-squares |
| 2× | distribute-lft-out-- |
| 2× | flip-- |
| 2× | log1p-expm1-u |
| 2× | associate-*r/ |
| 2× | flip3-- |
| 2× | expm1-log1p-u |
| 1× | cbrt-unprod |
| 1× | *-commutative |
| 1× | prod-exp |
| 1× | pow-prod-down |
| 1× | associate-*l* |
| 1× | diff-log |
| 15.0ms | (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))) |
| 8.0ms | (- (exp (- im)) (exp im)) |
| 90.0ms | (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))) |
| 40.0ms | (- (exp (- im)) (exp im)) |
| 349.0ms | (* (* 0.5 (sin re)) (fma (- (exp im)) 1 (* (exp im) 1))) |
| 337.0ms | (* (* 0.5 (sin re)) (fma (- (cbrt (exp im))) (* (cbrt (exp im)) (cbrt (exp im))) (* (cbrt (exp im)) (* (cbrt (exp im)) (cbrt (exp im)))))) |
| 330.0ms | (* (* 0.5 (sin re)) (fma (- (cbrt (exp im))) (* (cbrt (exp im)) (cbrt (exp im))) (* (cbrt (exp im)) (* (cbrt (exp im)) (cbrt (exp im)))))) |
| 326.0ms | (- (+ (* 1/3 (pow im 3)) (+ (* 1/60 (pow im 5)) (* 2 im)))) |
| 296.0ms | (* (* 0.5 (sin re)) (fma (- (exp im)) 1 (* (exp im) 1))) |
4 alts after pruning (4 fresh and 0 done)
Merged error: 0.1b
Found 4 expressions with local error:
| 0.1b | (* (* 0.5 (sin re)) (fma im (fma -1/3 (* im im) -2) (* (pow im 5) -1/60))) |
| 0.1b | (* (pow im 5) -1/60) |
| 0.0b | (fma im (fma -1/3 (* im im) -2) (* (pow im 5) -1/60)) |
| 0.0b | (fma -1/3 (* im im) -2) |
| 6× | add-cube-cbrt |
| 6× | add-exp-log |
| 6× | add-cbrt-cube |
| 6× | *-un-lft-identity |
| 6× | pow1 |
| 6× | add-sqr-sqrt |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | fma-udef |
| 4× | associate-*l* |
| 4× | expm1-log1p-u |
| 3× | associate-*r* |
| 2× | *-commutative |
| 1× | cbrt-unprod |
| 1× | prod-exp |
| 1× | pow-prod-down |
| 1× | distribute-lft-in |
| 1× | distribute-rgt-in |
| 10.0ms | (* (* 0.5 (sin re)) (fma im (fma -1/3 (* im im) -2) (* (pow im 5) -1/60))) |
| 4.0ms | (* (pow im 5) -1/60) |
| 0.0ms | (fma im (fma -1/3 (* im im) -2) (* (pow im 5) -1/60)) |
| 0.0ms | (fma -1/3 (* im im) -2) |
| 133.0ms | (* (* 0.5 (sin re)) (fma im (fma -1/3 (* im im) -2) (* (pow im 5) -1/60))) |
| 40.0ms | (fma im (fma -1/3 (* im im) -2) (* (pow im 5) -1/60)) |
| 37.0ms | (* (pow im 5) -1/60) |
| 23.0ms | (fma -1/3 (* im im) -2) |
| 515.0ms | (* (* 0.5 (sin re)) (fma im (fma -1/3 (* im im) -2) (* (pow im 5) -1/60))) |
| 289.0ms | (- (+ (* 1/3 (pow im 3)) (+ (* 1/60 (pow im 5)) (* 2 im)))) |
| 272.0ms | (- (+ (* 0.16666666666666666 (* (sin re) (pow im 3))) (+ (* 1.0 (* (sin re) im)) (* 0.008333333333333333 (* (sin re) (pow im 5)))))) |
| 261.0ms | (- (+ (* 1/3 (pow im 3)) (+ (* 1/60 (pow im 5)) (* 2 im)))) |
| 248.0ms | (- (+ (* 0.16666666666666666 (* (sin re) (pow im 3))) (+ (* 1.0 (* (sin re) im)) (* 0.008333333333333333 (* (sin re) (pow im 5)))))) |
10 alts after pruning (10 fresh and 0 done)
Merged error: 0.1b
Found 4 expressions with local error:
| 0.1b | (* (- (sin re)) (fma (* im im) (* im 0.16666666666666666) (* 1.0 im))) |
| 0.1b | (* (- (sin re)) (pow im 5)) |
| 0.0b | (fma (* (- (sin re)) (pow im 5)) 0.008333333333333333 (* (- (sin re)) (fma (* im im) (* im 0.16666666666666666) (* 1.0 im)))) |
| 0.0b | (fma (* im im) (* im 0.16666666666666666) (* 1.0 im)) |
| 20× | associate-*l* |
| 12× | add-cube-cbrt |
| 12× | *-un-lft-identity |
| 12× | add-sqr-sqrt |
| 9× | add-exp-log |
| 8× | add-cbrt-cube |
| 6× | associate-*r* |
| 6× | distribute-rgt-neg-in |
| 6× | pow1 |
| 6× | distribute-lft-neg-in |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | fma-udef |
| 4× | expm1-log1p-u |
| 3× | prod-exp |
| 2× | cbrt-unprod |
| 2× | *-commutative |
| 2× | neg-mul-1 |
| 2× | distribute-lft-neg-out |
| 1× | pow-prod-down |
| 1× | distribute-lft-in |
| 1× | pow-to-exp |
| 1× | distribute-rgt-in |
| 9.0ms | (* (- (sin re)) (fma (* im im) (* im 0.16666666666666666) (* 1.0 im))) |
| 9.0ms | (* (- (sin re)) (pow im 5)) |
| 0.0ms | (fma (* (- (sin re)) (pow im 5)) 0.008333333333333333 (* (- (sin re)) (fma (* im im) (* im 0.16666666666666666) (* 1.0 im)))) |
| 0.0ms | (fma (* im im) (* im 0.16666666666666666) (* 1.0 im)) |
| 151.0ms | (* (- (sin re)) (fma (* im im) (* im 0.16666666666666666) (* 1.0 im))) |
| 150.0ms | (fma (* (- (sin re)) (pow im 5)) 0.008333333333333333 (* (- (sin re)) (fma (* im im) (* im 0.16666666666666666) (* 1.0 im)))) |
| 110.0ms | (* (- (sin re)) (pow im 5)) |
| 66.0ms | (fma (* im im) (* im 0.16666666666666666) (* 1.0 im)) |
| 347.0ms | (- (+ (* 0.16666666666666666 (* (sin re) (pow im 3))) (* 1.0 (* (sin re) im)))) |
| 317.0ms | (- (+ (* 0.16666666666666666 (* (sin re) (pow im 3))) (+ (* 1.0 (* (sin re) im)) (* 0.008333333333333333 (* (sin re) (pow im 5)))))) |
| 289.0ms | (* (- (sin re)) (fma (* im im) (* im 0.16666666666666666) (* 1.0 im))) |
| 285.0ms | (- (+ (* 0.16666666666666666 (* (sin re) (pow im 3))) (* 1.0 (* (sin re) im)))) |
| 264.0ms | (- (+ (* 0.16666666666666666 (* (sin re) (pow im 3))) (+ (* 1.0 (* (sin re) im)) (* 0.008333333333333333 (* (sin re) (pow im 5)))))) |
13 alts after pruning (13 fresh and 0 done)
Merged error: 0.0b
Found 4 expressions with local error:
| 0.1b | (* (* 0.5 (sin re)) (fma im (log1p (expm1 (fma -1/3 (* im im) -2))) (* (pow im 5) -1/60))) |
| 0.1b | (* (pow im 5) -1/60) |
| 0.0b | (fma im (log1p (expm1 (fma -1/3 (* im im) -2))) (* (pow im 5) -1/60)) |
| 0.0b | (log1p (expm1 (fma -1/3 (* im im) -2))) |
| 6× | add-cube-cbrt |
| 6× | add-exp-log |
| 6× | add-cbrt-cube |
| 6× | *-un-lft-identity |
| 6× | pow1 |
| 6× | add-sqr-sqrt |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | associate-*l* |
| 4× | expm1-log1p-u |
| 3× | fma-udef |
| 3× | associate-*r* |
| 2× | *-commutative |
| 1× | cbrt-unprod |
| 1× | log1p-expm1 |
| 1× | prod-exp |
| 1× | pow-prod-down |
| 1× | distribute-lft-in |
| 1× | log1p-udef |
| 1× | distribute-rgt-in |
| 10.0ms | (* (* 0.5 (sin re)) (fma im (log1p (expm1 (fma -1/3 (* im im) -2))) (* (pow im 5) -1/60))) |
| 4.0ms | (* (pow im 5) -1/60) |
| 0.0ms | (fma im (log1p (expm1 (fma -1/3 (* im im) -2))) (* (pow im 5) -1/60)) |
| 0.0ms | (log1p (expm1 (fma -1/3 (* im im) -2))) |
| 393.0ms | (log1p (expm1 (fma -1/3 (* im im) -2))) |
| 390.0ms | (* (pow im 5) -1/60) |
| 243.0ms | (* (* 0.5 (sin re)) (fma im (log1p (expm1 (fma -1/3 (* im im) -2))) (* (pow im 5) -1/60))) |
| 202.0ms | (fma im (log1p (expm1 (fma -1/3 (* im im) -2))) (* (pow im 5) -1/60)) |
| 406.0ms | (* (* 0.5 (sin re)) (fma im (log1p (expm1 (fma -1/3 (* im im) -2))) (* (pow im 5) -1/60))) |
| 262.0ms | (- (+ (* 1/3 (pow im 3)) (+ (* 1/60 (pow im 5)) (* 2 im)))) |
| 249.0ms | (- (+ (* 0.16666666666666666 (* (sin re) (pow im 3))) (+ (* 1.0 (* (sin re) im)) (* 0.008333333333333333 (* (sin re) (pow im 5)))))) |
| 247.0ms | (- (+ (* 0.16666666666666666 (* (sin re) (pow im 3))) (+ (* 1.0 (* (sin re) im)) (* 0.008333333333333333 (* (sin re) (pow im 5)))))) |
| 97.0ms | (+ (log (* 0.5 (sin re))) (log (fma im (log1p (expm1 (fma -1/3 (* im im) -2))) (* (pow im 5) -1/60)))) |
13 alts after pruning (12 fresh and 1 done)
Merged error: 0.0b
0% (0.8b remaining)
Error of 0.8b against oracle of 0.1b and baseline of 0.8b
| 15926× | (pre true 80) |
| 4769× | (body real 1280) |
| 4531× | (body real 80) |
| 3865× | (body real 640) |
| 1858× | (body real 320) |
| 903× | (body real 160) |