Average Error: 33.1 → 9.5
Time: 24.4s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -4.9529633933266 \cdot 10^{-08}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.432147794020809 \cdot 10^{-104}:\\ \;\;\;\;\frac{c \cdot a}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right)}\\ \mathbf{elif}\;b_2 \le -5.51185453096989 \cdot 10^{-127}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 8.046684077965657 \cdot 10^{+99}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -4.9529633933266e-08 or -1.432147794020809e-104 < b_2 < -5.51185453096989e-127

    1. Initial program 53.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 7.9

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]

    if -4.9529633933266e-08 < b_2 < -1.432147794020809e-104

    1. Initial program 34.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--34.9

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Applied associate-/l/38.7

      \[\leadsto \color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    5. Simplified21.5

      \[\leadsto \frac{\color{blue}{a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]

    if -5.51185453096989e-127 < b_2 < 8.046684077965657e+99

    1. Initial program 10.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]

    if 8.046684077965657e+99 < b_2

    1. Initial program 44.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity44.5

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    4. Applied *-un-lft-identity44.5

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b_2\right)} - 1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    5. Applied distribute-lft-out--44.5

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    6. Applied associate-/l*44.6

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    7. Using strategy rm
    8. Applied div-inv44.6

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    9. Applied associate-/r*44.6

      \[\leadsto \color{blue}{\frac{\frac{1}{a}}{\frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    10. Taylor expanded around 0 3.6

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.9529633933266 \cdot 10^{-08}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.432147794020809 \cdot 10^{-104}:\\ \;\;\;\;\frac{c \cdot a}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right)}\\ \mathbf{elif}\;b_2 \le -5.51185453096989 \cdot 10^{-127}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 8.046684077965657 \cdot 10^{+99}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019004 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 23.6s)Debug log

sample171.0ms

Algorithm
intervals

simplify58.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

57.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.9b

localize35.0ms

Local error

Found 4 expressions with local error:

22.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite43.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

19.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
11.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
7.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series179.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

60.0ms
(sqrt (- (* b_2 b_2) (* a c)))
58.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
40.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
21.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
32 → 73
Calls

32 calls. Slowest were:

304.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
244.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
242.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))

prune751.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 5.1b

localize13.0ms

Local error

Found 4 expressions with local error:

22.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.2b
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

11.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series265.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

101.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
71.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
59.0ms
(sqrt (- (* b_2 b_2) (* a c)))
33.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
33 → 74
Calls

33 calls. Slowest were:

425.0ms
(+ (* (- b_2) (- b_2)) (+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
297.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
232.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune754.0ms

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 5.1b

localize15.0ms

Local error

Found 4 expressions with local error:

22.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.3b
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

6.0ms
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
6.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
2.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series254.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

101.0ms
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
67.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
51.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify9.0s

Counts
85 → 103
Calls

85 calls. Slowest were:

1.6s
(/ (* (* (/ 1 a) (/ 1 a)) (/ 1 a)) (* (* (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
506.0ms
(/ (sqrt (/ 1 a)) (/ 1 (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))))
432.0ms
(/ (cbrt (/ 1 a)) (+ (* (- b_2) (- b_2)) (+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))

prune1.0s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 5.1b

localize38.0ms

Local error

Found 4 expressions with local error:

22.8b
(cbrt (- (* b_2 b_2) (* a c)))
22.8b
(cbrt (- (* b_2 b_2) (* a c)))
9.2b
(- (- b_2) (* (fabs (cbrt (- (* b_2 b_2) (* a c)))) (sqrt (cbrt (- (* b_2 b_2) (* a c))))))
0.8b
(- (* b_2 b_2) (* a c))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 51
Calls

4 calls. Slowest were:

7.0ms
(- (- b_2) (* (fabs (cbrt (- (* b_2 b_2) (* a c)))) (sqrt (cbrt (- (* b_2 b_2) (* a c))))))
4.0ms
(- (* b_2 b_2) (* a c))
3.0ms
(cbrt (- (* b_2 b_2) (* a c)))

series262.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

82.0ms
(cbrt (- (* b_2 b_2) (* a c)))
75.0ms
(cbrt (- (* b_2 b_2) (* a c)))
73.0ms
(- (- b_2) (* (fabs (cbrt (- (* b_2 b_2) (* a c)))) (sqrt (cbrt (- (* b_2 b_2) (* a c))))))
32.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
24 → 63
Calls

24 calls. Slowest were:

292.0ms
(cbrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
275.0ms
(cbrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
205.0ms
(cbrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune618.0ms

Pruning

9 alts after pruning (6 fresh and 3 done)

Merged error: 5.1b

regimes513.0ms

Accuracy

85.3% (4.1b remaining)

Error of 9.5b against oracle of 5.5b and baseline of 33.1b

bsearch483.0ms

end0.0ms

sample4.3s

Algorithm
intervals