



Bits error versus x
| Original | 59.9 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
Initial program 59.9
Taylor expanded around 0 0.3
Simplified0.3
rmApplied fma-udef0.3
Final simplification0.3
herbie shell --seed 2019016 +o rules:numerics
(FPCore (x)
:name "invcot (example 3.9)"
:pre (and (< -0.026 x) (< x 0.026))
:herbie-target
(if (< (fabs x) 0.026) (* (/ x 3) (+ 1 (/ (* x x) 15))) (- (/ 1 x) (/ 1 (tan x))))
(- (/ 1 x) (/ 1 (tan x))))
Time bar (total: 32.4s)Debug log
| 256× | (pre true 80) |
| 99× | (body real 2560) |
| 79× | (body real 1280) |
| 35× | (body real 640) |
| 28× | (body real 320) |
| 12× | (body real 160) |
| 3× | (body real 80) |
| 9.0ms | (- (/ 1 x) (/ 1 (tan x))) |
1 alts after pruning (1 fresh and 0 done)
Merged error: 59.7b
Found 2 expressions with local error:
| 3.7b | (- (/ 1 x) (/ 1 (tan x))) |
| 0.0b | (/ 1 (tan x)) |
| 20× | prod-diff |
| 17× | *-un-lft-identity |
| 15× | div-inv |
| 15× | add-sqr-sqrt |
| 13× | add-cube-cbrt |
| 5× | associate-/r/ |
| 5× | tan-quot |
| 4× | add-log-exp |
| 4× | distribute-lft-out-- |
| 4× | fma-neg |
| 3× | add-exp-log |
| 3× | associate-/r* |
| 3× | pow1 |
| 2× | log1p-expm1-u |
| 2× | add-cbrt-cube |
| 2× | expm1-log1p-u |
| 1× | difference-of-squares |
| 1× | inv-pow |
| 1× | flip-- |
| 1× | pow-flip |
| 1× | frac-sub |
| 1× | diff-log |
| 1× | flip3-- |
| 1× | frac-2neg |
| 1× | sub-neg |
| 1× | clear-num |
| 1× | rec-exp |
| 9.0ms | (- (/ 1 x) (/ 1 (tan x))) |
| 1.0ms | (/ 1 (tan x)) |
| 88.0ms | (- (/ 1 x) (/ 1 (tan x))) |
| 43.0ms | (/ 1 (tan x)) |
| 205.0ms | (- (/ 1 x) (+ (* 1/3 x) (* 1/45 (pow x 3)))) |
| 120.0ms | (fma (- (cos x)) (/ 1 (sin x)) (* (cos x) (/ 1 (sin x)))) |
| 106.0ms | (fma 1 (/ 1 x) (- (* (cos x) (/ 1 (sin x))))) |
| 99.0ms | (fma (* (cbrt (/ 1 x)) (cbrt (/ 1 x))) (cbrt (/ 1 x)) (- (* (cos x) (/ 1 (sin x))))) |
| 99.0ms | (fma (- (cos x)) (/ 1 (sin x)) (* (cos x) (/ 1 (sin x)))) |
1 alts after pruning (1 fresh and 0 done)
Merged error: 0.3b
Found 3 expressions with local error:
| 0.3b | (fma (fma 1/45 (* x x) 1/3) x (* (pow x 5) 2/945)) |
| 0.1b | (* (pow x 5) 2/945) |
| 0.0b | (fma 1/45 (* x x) 1/3) |
| 4× | add-cube-cbrt |
| 4× | *-un-lft-identity |
| 4× | add-sqr-sqrt |
| 3× | add-log-exp |
| 3× | log1p-expm1-u |
| 3× | add-exp-log |
| 3× | associate-*l* |
| 3× | add-cbrt-cube |
| 3× | pow1 |
| 3× | expm1-log1p-u |
| 2× | fma-udef |
| 1× | *-commutative |
| 4.0ms | (* (pow x 5) 2/945) |
| 0.0ms | (fma (fma 1/45 (* x x) 1/3) x (* (pow x 5) 2/945)) |
| 0.0ms | (fma 1/45 (* x x) 1/3) |
| 45.0ms | (fma (fma 1/45 (* x x) 1/3) x (* (pow x 5) 2/945)) |
| 37.0ms | (fma 1/45 (* x x) 1/3) |
| 36.0ms | (* (pow x 5) 2/945) |
| 83.0ms | (+ (* 1/3 x) (+ (* 1/45 (pow x 3)) (* 2/945 (pow x 5)))) |
| 65.0ms | (+ (* 1/3 x) (+ (* 1/45 (pow x 3)) (* 2/945 (pow x 5)))) |
| 51.0ms | (+ (* 1/3 x) (+ (* 1/45 (pow x 3)) (* 2/945 (pow x 5)))) |
| 16.0ms | (+ (* 1/45 (pow x 2)) 1/3) |
| 14.0ms | (+ (* 1/45 (pow x 2)) 1/3) |
5 alts after pruning (5 fresh and 0 done)
Merged error: 0.2b
Found 4 expressions with local error:
| 0.3b | (* (fma 1/45 (* x x) 1/3) x) |
| 0.1b | (* (pow x 5) 2/945) |
| 0.0b | (fma 1/45 (* x x) 1/3) |
| 0.0b | (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945)) |
| 6× | add-log-exp |
| 6× | add-cube-cbrt |
| 6× | associate-*l* |
| 6× | *-un-lft-identity |
| 6× | add-sqr-sqrt |
| 4× | log1p-expm1-u |
| 4× | add-exp-log |
| 4× | add-cbrt-cube |
| 4× | pow1 |
| 4× | expm1-log1p-u |
| 2× | *-commutative |
| 1× | fma-udef |
| 1× | flip-+ |
| 1× | flip3-+ |
| 1× | fma-def |
| 1× | sum-log |
| 1× | +-commutative |
| 5.0ms | (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945)) |
| 3.0ms | (* (fma 1/45 (* x x) 1/3) x) |
| 2.0ms | (* (pow x 5) 2/945) |
| 0.0ms | (fma 1/45 (* x x) 1/3) |
| 38.0ms | (* (fma 1/45 (* x x) 1/3) x) |
| 29.0ms | (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945)) |
| 27.0ms | (fma 1/45 (* x x) 1/3) |
| 20.0ms | (* (pow x 5) 2/945) |
| 95.0ms | (* (exp (* (fma 1/45 (* x x) 1/3) x)) (exp (* (pow x 5) 2/945))) |
| 89.0ms | (+ (* 1/3 x) (+ (* 1/45 (pow x 3)) (* 2/945 (pow x 5)))) |
| 77.0ms | (+ (* 1/3 x) (+ (* 1/45 (pow x 3)) (* 2/945 (pow x 5)))) |
| 73.0ms | (+ (* 1/3 x) (+ (* 1/45 (pow x 3)) (* 2/945 (pow x 5)))) |
| 39.0ms | (+ (* 1/3 x) (* 1/45 (pow x 3))) |
5 alts after pruning (4 fresh and 1 done)
Merged error: 0.2b
Found 4 expressions with local error:
| 0.6b | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 0.6b | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 0.6b | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 0.5b | (* (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945)))) |
| 18× | cbrt-div |
| 15× | cbrt-prod |
| 11× | add-cube-cbrt |
| 11× | *-un-lft-identity |
| 11× | add-sqr-sqrt |
| 9× | flip-+ |
| 9× | flip3-+ |
| 9× | pow1 |
| 7× | pow1/3 |
| 6× | add-exp-log |
| 6× | associate-*l* |
| 6× | associate-*r* |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | add-cbrt-cube |
| 4× | frac-times |
| 4× | expm1-log1p-u |
| 2× | pow-prod-up |
| 2× | associate-*r/ |
| 2× | associate-*l/ |
| 2× | pow-prod-down |
| 1× | cbrt-unprod |
| 1× | *-commutative |
| 1× | prod-exp |
| 1× | pow-plus |
| 1× | pow2 |
| 29.0ms | (* (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945)))) |
| 4.0ms | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 4.0ms | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 4.0ms | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 175.0ms | (* (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945)))) |
| 168.0ms | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 131.0ms | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 126.0ms | (cbrt (+ (* (fma 1/45 (* x x) 1/3) x) (* (pow x 5) 2/945))) |
| 536.0ms | (* (cbrt (- (* (* (fma 1/45 (* x x) 1/3) x) (* (fma 1/45 (* x x) 1/3) x)) (* (* (pow x 5) 2/945) (* (pow x 5) 2/945)))) (cbrt (+ (pow (* (fma 1/45 (* x x) 1/3) x) 3) (pow (* (pow x 5) 2/945) 3)))) |
| 525.0ms | (cbrt (- (* (* (fma 1/45 (* x x) 1/3) x) (* (fma 1/45 (* x x) 1/3) x)) (* (* (pow x 5) 2/945) (* (pow x 5) 2/945)))) |
| 517.0ms | (* (cbrt (+ (pow (* (fma 1/45 (* x x) 1/3) x) 3) (pow (* (pow x 5) 2/945) 3))) (cbrt (- (* (* (fma 1/45 (* x x) 1/3) x) (* (fma 1/45 (* x x) 1/3) x)) (* (* (pow x 5) 2/945) (* (pow x 5) 2/945))))) |
| 491.0ms | (+ (* 7/2 (/ (exp (* 1/3 (- (log 2/945) (* 5 (log (/ 1 x)))))) (pow x 2))) (+ (exp (* 1/3 (- (log 2/945) (* 5 (log (/ 1 x)))))) (* 161/4 (/ (exp (* 1/3 (- (log 2/945) (* 5 (log (/ 1 x)))))) (pow x 4))))) |
| 459.0ms | (+ (* 7/2 (/ (exp (* 1/3 (- (log 2/945) (* 5 (log (/ 1 x)))))) (pow x 2))) (+ (exp (* 1/3 (- (log 2/945) (* 5 (log (/ 1 x)))))) (* 161/4 (/ (exp (* 1/3 (- (log 2/945) (* 5 (log (/ 1 x)))))) (pow x 4))))) |
14 alts after pruning (12 fresh and 2 done)
Merged error: 0.1b
0% (0.2b remaining)
Error of 0.3b against oracle of 0.2b and baseline of 0.3b
| 8000× | (pre true 80) |
| 3231× | (body real 2560) |
| 2519× | (body real 1280) |
| 1261× | (body real 640) |
| 604× | (body real 320) |
| 342× | (body real 160) |
| 43× | (body real 80) |