



Bits error versus a




Bits error versus b




Bits error versus c
| Original | 32.7 |
|---|---|
| Target | 20.4 |
| Herbie | 12.9 |
if b < -1.02993411605426e-308Initial program 20.8
Simplified20.8
rmApplied div-sub20.8
if -1.02993411605426e-308 < b < 4.873574385931286e+105Initial program 31.6
Simplified31.6
rmApplied flip--31.7
Applied associate-/l/35.7
Simplified19.3
rmApplied times-frac8.7
Simplified8.7
rmApplied associate-*r/8.7
if 4.873574385931286e+105 < b Initial program 58.9
Simplified58.9
rmApplied flip--58.9
Applied associate-/l/59.1
Simplified32.1
rmApplied times-frac30.6
Simplified30.6
Taylor expanded around 0 2.6
Final simplification12.9
herbie shell --seed 2019002 +o rules:numerics
(FPCore (a b c)
:name "The quadratic formula (r1)"
:herbie-target
(if (< b 0) (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))
Time bar (total: 17.4s)Debug log
1 calls. Slowest were:
| 66.0ms | (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) |
1 alts after pruning (1 fresh and 0 done)
Merged error: 37.0b
Found 3 expressions with local error:
| 23.6b | (sqrt (fma (* a -4) c (* b b))) |
| 1.3b | (- (sqrt (fma (* a -4) c (* b b))) b) |
| 0.1b | (/ (- (sqrt (fma (* a -4) c (* b b))) b) (* 2 a)) |
3 calls. Slowest were:
| 10.0ms | (/ (- (sqrt (fma (* a -4) c (* b b))) b) (* 2 a)) |
| 5.0ms | (- (sqrt (fma (* a -4) c (* b b))) b) |
| 1.0ms | (sqrt (fma (* a -4) c (* b b))) |
3 calls. Slowest were:
| 115.0ms | (/ (- (sqrt (fma (* a -4) c (* b b))) b) (* 2 a)) |
| 72.0ms | (- (sqrt (fma (* a -4) c (* b b))) b) |
| 55.0ms | (sqrt (fma (* a -4) c (* b b))) |
31 calls. Slowest were:
| 706.0ms | (- (* (sqrt (fma (* a -4) c (* b b))) (sqrt (fma (* a -4) c (* b b)))) (* b b)) |
| 143.0ms | (- (pow (sqrt (fma (* a -4) c (* b b))) 3) (pow b 3)) |
| 119.0ms | (/ (* (* (- (sqrt (fma (* a -4) c (* b b))) b) (- (sqrt (fma (* a -4) c (* b b))) b)) (- (sqrt (fma (* a -4) c (* b b))) b)) (* (* (* 2 a) (* 2 a)) (* 2 a))) |
9 alts after pruning (9 fresh and 0 done)
Merged error: 22.1b
Found 4 expressions with local error:
| 23.6b | (sqrt (fma (* a -4) c (* b b))) |
| 14.2b | (/ (* (* a -4) c) (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b))) |
| 1.7b | (+ (sqrt (fma (* a -4) c (* b b))) b) |
| 0.1b | (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b)) |
4 calls. Slowest were:
| 10.0ms | (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b)) |
| 9.0ms | (/ (* (* a -4) c) (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b))) |
| 4.0ms | (+ (sqrt (fma (* a -4) c (* b b))) b) |
4 calls. Slowest were:
| 110.0ms | (/ (* (* a -4) c) (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b))) |
| 109.0ms | (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b)) |
| 67.0ms | (+ (sqrt (fma (* a -4) c (* b b))) b) |
| 51.0ms | (sqrt (fma (* a -4) c (* b b))) |
41 calls. Slowest were:
| 669.0ms | (- (log (* (* a -4) c)) (+ (log (* 2 a)) (log (+ (sqrt (fma (* a -4) c (* b b))) b)))) |
| 651.0ms | (/ (* (* (* (* a -4) c) (* (* a -4) c)) (* (* a -4) c)) (* (* (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b)) (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b))) (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b)))) |
| 629.0ms | (/ (* (* (* (* a -4) c) (* (* a -4) c)) (* (* a -4) c)) (* (* (* (* 2 a) (* 2 a)) (* 2 a)) (* (* (+ (sqrt (fma (* a -4) c (* b b))) b) (+ (sqrt (fma (* a -4) c (* b b))) b)) (+ (sqrt (fma (* a -4) c (* b b))) b)))) |
8 alts after pruning (8 fresh and 0 done)
Merged error: 13.3b
Found 4 expressions with local error:
| 23.6b | (sqrt (fma (* a -4) c (* b b))) |
| 1.7b | (+ (sqrt (fma (* a -4) c (* b b))) b) |
| 0.0b | (/ c (+ (sqrt (fma (* a -4) c (* b b))) b)) |
| 0.0b | (* -2 (/ c (+ (sqrt (fma (* a -4) c (* b b))) b))) |
4 calls. Slowest were:
| 4.0ms | (+ (sqrt (fma (* a -4) c (* b b))) b) |
| 2.0ms | (/ c (+ (sqrt (fma (* a -4) c (* b b))) b)) |
| 2.0ms | (* -2 (/ c (+ (sqrt (fma (* a -4) c (* b b))) b))) |
4 calls. Slowest were:
| 138.0ms | (* -2 (/ c (+ (sqrt (fma (* a -4) c (* b b))) b))) |
| 135.0ms | (/ c (+ (sqrt (fma (* a -4) c (* b b))) b)) |
| 75.0ms | (+ (sqrt (fma (* a -4) c (* b b))) b) |
| 49.0ms | (sqrt (fma (* a -4) c (* b b))) |
33 calls. Slowest were:
| 309.0ms | (+ (* (sqrt (fma (* a -4) c (* b b))) (sqrt (fma (* a -4) c (* b b)))) (- (* b b) (* (sqrt (fma (* a -4) c (* b b))) b))) |
| 270.0ms | (+ (* (sqrt (fma (* a -4) c (* b b))) (sqrt (fma (* a -4) c (* b b)))) (- (* b b) (* (sqrt (fma (* a -4) c (* b b))) b))) |
| 31.0ms | (/ 1 (+ (sqrt (fma (* a -4) c (* b b))) b)) |
7 alts after pruning (7 fresh and 0 done)
Merged error: 11.4b
Found 4 expressions with local error:
| 23.6b | (sqrt (fma (* a -4) c (* b b))) |
| 23.6b | (sqrt (fma (* a -4) c (* b b))) |
| 15.3b | (fma (sqrt (sqrt (fma (* a -4) c (* b b)))) (sqrt (sqrt (fma (* a -4) c (* b b)))) b) |
| 0.1b | (sqrt (sqrt (fma (* a -4) c (* b b)))) |
4 calls. Slowest were:
| 2.0ms | (sqrt (sqrt (fma (* a -4) c (* b b)))) |
| 2.0ms | (sqrt (fma (* a -4) c (* b b))) |
| 2.0ms | (sqrt (fma (* a -4) c (* b b))) |
4 calls. Slowest were:
| 354.0ms | (fma (sqrt (sqrt (fma (* a -4) c (* b b)))) (sqrt (sqrt (fma (* a -4) c (* b b)))) b) |
| 197.0ms | (sqrt (sqrt (fma (* a -4) c (* b b)))) |
| 68.0ms | (sqrt (fma (* a -4) c (* b b))) |
| 40.0ms | (sqrt (fma (* a -4) c (* b b))) |
28 calls. Slowest were:
| 282.0ms | (+ (pow (exp (* 1/4 (- (log -4) (+ (log (/ 1 a)) (log (/ 1 c)))))) 2) b) |
| 183.0ms | (exp (* 1/4 (- (log -4) (+ (log (/ 1 a)) (log (/ 1 c)))))) |
| 152.0ms | (+ (pow (exp (* 1/4 (- (log -4) (+ (log (/ -1 c)) (log (/ -1 a)))))) 2) b) |
7 alts after pruning (6 fresh and 1 done)
Merged error: 11.4b
96.7% (0.6b remaining)
Error of 12.9b against oracle of 12.3b and baseline of 29.3b