



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: 15.6s)Debug log
1 calls. Slowest were:
| 77.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:
| 14.0ms | (/ (- (sqrt (fma (* a -4) c (* b b))) b) (* 2 a)) |
| 10.0ms | (- (sqrt (fma (* a -4) c (* b b))) b) |
| 2.0ms | (sqrt (fma (* a -4) c (* b b))) |
3 calls. Slowest were:
| 77.0ms | (/ (- (sqrt (fma (* a -4) c (* b b))) b) (* 2 a)) |
| 73.0ms | (- (sqrt (fma (* a -4) c (* b b))) b) |
| 46.0ms | (sqrt (fma (* a -4) c (* b b))) |
31 calls. Slowest were:
| 1.1s | (- (* (sqrt (fma (* a -4) c (* b b))) (sqrt (fma (* a -4) c (* b b)))) (* b b)) |
| 122.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))) |
| 107.0ms | (- (pow (sqrt (fma (* a -4) c (* b b))) 3) (pow b 3)) |
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:
| 14.0ms | (/ (* (* a -4) c) (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b))) |
| 8.0ms | (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b)) |
| 4.0ms | (+ (sqrt (fma (* a -4) c (* b b))) b) |
4 calls. Slowest were:
| 120.0ms | (/ (* (* a -4) c) (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b))) |
| 73.0ms | (* (* 2 a) (+ (sqrt (fma (* a -4) c (* b b))) b)) |
| 56.0ms | (+ (sqrt (fma (* a -4) c (* b b))) b) |
| 45.0ms | (sqrt (fma (* a -4) c (* b b))) |
41 calls. Slowest were:
| 605.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)))) |
| 588.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)))) |
| 549.0ms | (- (log (* (* a -4) c)) (+ (log (* 2 a)) (log (+ (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 | (* -2 (/ c (+ (sqrt (fma (* a -4) c (* b b))) b))) |
| 4.0ms | (+ (sqrt (fma (* a -4) c (* b b))) b) |
| 2.0ms | (/ c (+ (sqrt (fma (* a -4) c (* b b))) b)) |
4 calls. Slowest were:
| 154.0ms | (/ c (+ (sqrt (fma (* a -4) c (* b b))) b)) |
| 127.0ms | (* -2 (/ c (+ (sqrt (fma (* a -4) c (* b b))) b))) |
| 48.0ms | (+ (sqrt (fma (* a -4) c (* b b))) b) |
| 45.0ms | (sqrt (fma (* a -4) c (* b b))) |
33 calls. Slowest were:
| 213.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))) |
| 194.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))) |
| 29.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:
| 1.0ms | (sqrt (sqrt (fma (* a -4) c (* b b)))) |
| 1.0ms | (sqrt (fma (* a -4) c (* b b))) |
| 1.0ms | (sqrt (fma (* a -4) c (* b b))) |
4 calls. Slowest were:
| 286.0ms | (fma (sqrt (sqrt (fma (* a -4) c (* b b)))) (sqrt (sqrt (fma (* a -4) c (* b b)))) b) |
| 171.0ms | (sqrt (sqrt (fma (* a -4) c (* b b)))) |
| 47.0ms | (sqrt (fma (* a -4) c (* b b))) |
| 42.0ms | (sqrt (fma (* a -4) c (* b b))) |
28 calls. Slowest were:
| 336.0ms | (+ (pow (exp (* 1/4 (- (log -4) (+ (log (/ 1 a)) (log (/ 1 c)))))) 2) b) |
| 145.0ms | (exp (* 1/4 (- (log -4) (+ (log (/ 1 a)) (log (/ 1 c)))))) |
| 99.0ms | (exp (* 1/4 (- (log -4) (+ (log (/ -1 c)) (log (/ -1 a)))))) |
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