



Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.5 |
|---|---|
| Target | 20.6 |
| Herbie | 10.5 |
if b < -2.3604286795685533e-29Initial program 54.6
Simplified54.7
Taylor expanded around -inf 6.8
Simplified6.8
if -2.3604286795685533e-29 < b < 3.328175344273382e+63Initial program 15.3
Simplified15.3
rmApplied add-cube-cbrt15.5
Applied fma-neg15.5
if 3.328175344273382e+63 < b Initial program 37.3
Simplified37.3
Taylor expanded around inf 5.0
Final simplification10.5
herbie shell --seed 2019016 +o rules:numerics
(FPCore (a b c)
:name "quadm (p42, negative)"
:herbie-target
(if (< b 0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))
Time bar (total: 26.2s)Debug log
| 368× | (pre true 80) |
| 182× | (body real 80) |
| 91× | (body nan 80) |
| 35× | (body real 1280) |
| 32× | (body real 2560) |
| 13× | (body real 640) |
| 6× | (body real 320) |
| 5× | (body real 160) |
| 4× | (body real 5120) |
| 78.0ms | (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)) |
2 alts after pruning (2 fresh and 0 done)
Merged error: 35.2b
Found 4 expressions with local error:
| 24.0b | (sqrt (fma (* -4 a) c (* b b))) |
| 1.2b | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 0.1b | (/ (- (- b) (sqrt (fma (* -4 a) c (* b b)))) (* 2 a)) |
| 0.0b | (fma (* -4 a) c (* b b)) |
| 35× | add-sqr-sqrt |
| 28× | *-un-lft-identity |
| 24× | prod-diff |
| 22× | add-cube-cbrt |
| 18× | sqrt-prod |
| 7× | neg-mul-1 |
| 6× | difference-of-squares |
| 6× | add-log-exp |
| 6× | associate-/l* |
| 6× | add-exp-log |
| 6× | add-cbrt-cube |
| 6× | times-frac |
| 4× | log1p-expm1-u |
| 4× | fma-neg |
| 4× | pow1 |
| 4× | expm1-log1p-u |
| 3× | distribute-lft-out-- |
| 2× | associate-/l/ |
| 2× | flip-- |
| 2× | flip3-- |
| 1× | div-inv |
| 1× | fma-udef |
| 1× | div-exp |
| 1× | div-sub |
| 1× | diff-log |
| 1× | pow1/2 |
| 1× | frac-2neg |
| 1× | sub-neg |
| 1× | associate-/r* |
| 1× | clear-num |
| 1× | rem-sqrt-square |
| 1× | cbrt-undiv |
| 1× | neg-sub0 |
| 1× | associate--l- |
| 17.0ms | (/ (- (- b) (sqrt (fma (* -4 a) c (* b b)))) (* 2 a)) |
| 8.0ms | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 2.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 0.0ms | (fma (* -4 a) c (* b b)) |
| 64.0ms | (/ (- (- b) (sqrt (fma (* -4 a) c (* b b)))) (* 2 a)) |
| 42.0ms | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 42.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 31.0ms | (fma (* -4 a) c (* b b)) |
| 247.0ms | (- (* (- b) (- b)) (* (sqrt (fma (* -4 a) c (* b b))) (sqrt (fma (* -4 a) c (* b b))))) |
| 175.0ms | (- (pow (- b) 3) (pow (sqrt (fma (* -4 a) c (* b b))) 3)) |
| 76.0ms | (fma 1 (- b) (- (* (sqrt (cbrt (fma (* -4 a) c (* b b)))) (sqrt (* (cbrt (fma (* -4 a) c (* b b))) (cbrt (fma (* -4 a) c (* b b)))))))) |
| 66.0ms | (fma (sqrt (- b)) (sqrt (- b)) (- (* (sqrt (sqrt (fma (* -4 a) c (* b b)))) (sqrt (sqrt (fma (* -4 a) c (* b b))))))) |
| 64.0ms | (fma (* (cbrt (- b)) (cbrt (- b))) (cbrt (- b)) (- (* (sqrt (fma (* -4 a) c (* b b))) 1))) |
8 alts after pruning (8 fresh and 0 done)
Merged error: 4.9b
Found 4 expressions with local error:
| 24.0b | (sqrt (fma (* -4 a) c (* b b))) |
| 1.2b | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 0.2b | (/ 1 (/ (* 2 a) (- (- b) (sqrt (fma (* -4 a) c (* b b)))))) |
| 0.1b | (/ (* 2 a) (- (- b) (sqrt (fma (* -4 a) c (* b b))))) |
| 41× | add-sqr-sqrt |
| 32× | *-un-lft-identity |
| 24× | add-cube-cbrt |
| 24× | prod-diff |
| 19× | sqrt-prod |
| 18× | associate-/r* |
| 12× | times-frac |
| 9× | add-exp-log |
| 8× | difference-of-squares |
| 7× | neg-mul-1 |
| 6× | add-log-exp |
| 6× | add-cbrt-cube |
| 5× | associate-/r/ |
| 5× | pow1 |
| 4× | distribute-lft-out-- |
| 4× | log1p-expm1-u |
| 4× | fma-neg |
| 4× | expm1-log1p-u |
| 3× | flip-- |
| 3× | div-inv |
| 3× | flip3-- |
| 2× | div-exp |
| 2× | frac-2neg |
| 2× | clear-num |
| 2× | rec-exp |
| 1× | inv-pow |
| 1× | associate-/l* |
| 1× | pow-flip |
| 1× | diff-log |
| 1× | pow1/2 |
| 1× | sub-neg |
| 1× | rem-sqrt-square |
| 1× | cbrt-undiv |
| 1× | neg-sub0 |
| 1× | associate--l- |
| 7.0ms | (/ (* 2 a) (- (- b) (sqrt (fma (* -4 a) c (* b b))))) |
| 5.0ms | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 4.0ms | (/ 1 (/ (* 2 a) (- (- b) (sqrt (fma (* -4 a) c (* b b)))))) |
| 1.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 151.0ms | (/ (* 2 a) (- (- b) (sqrt (fma (* -4 a) c (* b b))))) |
| 89.0ms | (/ 1 (/ (* 2 a) (- (- b) (sqrt (fma (* -4 a) c (* b b)))))) |
| 73.0ms | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 59.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 506.0ms | (+ (* (- b) (- b)) (+ (* (sqrt (fma (* -4 a) c (* b b))) (sqrt (fma (* -4 a) c (* b b)))) (* (- b) (sqrt (fma (* -4 a) c (* b b)))))) |
| 487.0ms | (+ (* (- b) (- b)) (+ (* (sqrt (fma (* -4 a) c (* b b))) (sqrt (fma (* -4 a) c (* b b)))) (* (- b) (sqrt (fma (* -4 a) c (* b b)))))) |
| 102.0ms | (- (* 2 (/ (* a c) b)) (* 2 b)) |
| 81.0ms | (/ (* (* (* 2 a) (* 2 a)) (* 2 a)) (* (* (- (- b) (sqrt (fma (* -4 a) c (* b b)))) (- (- b) (sqrt (fma (* -4 a) c (* b b))))) (- (- b) (sqrt (fma (* -4 a) c (* b b)))))) |
| 78.0ms | (fma 1 (- b) (- (* (sqrt (fma (* -4 a) c (* b b))) 1))) |
8 alts after pruning (7 fresh and 1 done)
Merged error: 4.9b
Found 4 expressions with local error:
| 24.0b | (sqrt (fma (* -4 a) c (* b b))) |
| 24.0b | (sqrt (fma (* -4 a) c (* b b))) |
| 24.0b | (sqrt (fma (* -4 a) c (* b b))) |
| 1.2b | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 29× | add-sqr-sqrt |
| 24× | prod-diff |
| 24× | *-un-lft-identity |
| 22× | sqrt-prod |
| 22× | add-cube-cbrt |
| 7× | neg-mul-1 |
| 6× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | add-exp-log |
| 4× | fma-neg |
| 4× | add-cbrt-cube |
| 4× | pow1 |
| 4× | expm1-log1p-u |
| 3× | pow1/2 |
| 3× | rem-sqrt-square |
| 2× | difference-of-squares |
| 1× | distribute-lft-out-- |
| 1× | flip-- |
| 1× | diff-log |
| 1× | flip3-- |
| 1× | sub-neg |
| 1× | neg-sub0 |
| 1× | associate--l- |
| 9.0ms | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 2.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 2.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 2.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 71.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 71.0ms | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 66.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 65.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 68.0ms | (fma 1 (- b) (- (* (sqrt (fma (* -4 a) c (* b b))) 1))) |
| 64.0ms | (fma 1 (- b) (- (* (sqrt (cbrt (fma (* -4 a) c (* b b)))) (sqrt (* (cbrt (fma (* -4 a) c (* b b))) (cbrt (fma (* -4 a) c (* b b)))))))) |
| 61.0ms | (fma -1 b (- (* (sqrt (fma (* -4 a) c (* b b))) (sqrt 1)))) |
| 60.0ms | (fma (sqrt (- b)) (sqrt (- b)) (- (* (sqrt (sqrt (fma (* -4 a) c (* b b)))) (sqrt (sqrt (fma (* -4 a) c (* b b))))))) |
| 58.0ms | (fma (* (cbrt (- b)) (cbrt (- b))) (cbrt (- b)) (- (* (sqrt (cbrt (fma (* -4 a) c (* b b)))) (sqrt (* (cbrt (fma (* -4 a) c (* b b))) (cbrt (fma (* -4 a) c (* b b)))))))) |
8 alts after pruning (7 fresh and 1 done)
Merged error: 4.9b
Found 4 expressions with local error:
| 24.0b | (sqrt (fma (* -4 a) c (* b b))) |
| 24.0b | (sqrt (fma (* -4 a) c (* b b))) |
| 24.0b | (sqrt (fma -4 (* c a) (* b b))) |
| 1.2b | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 29× | add-sqr-sqrt |
| 24× | prod-diff |
| 24× | *-un-lft-identity |
| 22× | sqrt-prod |
| 22× | add-cube-cbrt |
| 7× | neg-mul-1 |
| 6× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | add-exp-log |
| 4× | fma-neg |
| 4× | add-cbrt-cube |
| 4× | pow1 |
| 4× | expm1-log1p-u |
| 3× | pow1/2 |
| 3× | rem-sqrt-square |
| 2× | difference-of-squares |
| 1× | distribute-lft-out-- |
| 1× | flip-- |
| 1× | diff-log |
| 1× | flip3-- |
| 1× | sub-neg |
| 1× | neg-sub0 |
| 1× | associate--l- |
| 5.0ms | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 1.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 1.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 1.0ms | (sqrt (fma -4 (* c a) (* b b))) |
| 67.0ms | (- (- b) (sqrt (fma (* -4 a) c (* b b)))) |
| 62.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 62.0ms | (sqrt (fma (* -4 a) c (* b b))) |
| 44.0ms | (sqrt (fma -4 (* c a) (* b b))) |
| 87.0ms | (- (* 2 (/ (* a c) b)) (* 2 b)) |
| 73.0ms | (fma 1 (- b) (- (* (sqrt (cbrt (fma (* -4 a) c (* b b)))) (sqrt (* (cbrt (fma (* -4 a) c (* b b))) (cbrt (fma (* -4 a) c (* b b)))))))) |
| 70.0ms | (fma 1 (- b) (- (* (sqrt (fma (* -4 a) c (* b b))) 1))) |
| 66.0ms | (* -2 (/ (* a c) b)) |
| 63.0ms | (fma (* (cbrt (- b)) (cbrt (- b))) (cbrt (- b)) (- (* (sqrt (cbrt (fma (* -4 a) c (* b b)))) (sqrt (* (cbrt (fma (* -4 a) c (* b b))) (cbrt (fma (* -4 a) c (* b b)))))))) |
9 alts after pruning (7 fresh and 2 done)
Merged error: 4.9b
82.9% (4.8b remaining)
Error of 10.5b against oracle of 5.7b and baseline of 33.6b
| 11455× | (pre true 80) |
| 5803× | (body real 80) |
| 2738× | (body nan 80) |
| 1107× | (body real 2560) |
| 947× | (body real 1280) |
| 433× | (body real 640) |
| 217× | (body real 320) |
| 109× | (body real 5120) |
| 101× | (body real 160) |