Average Error: 33.2 → 9.4
Time: 19.0s
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 -1.248052338324558 \cdot 10^{+85}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.2946614796208325 \cdot 10^{-116}:\\ \;\;\;\;\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 3.945589219663718 \cdot 10^{+109}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \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 < -1.248052338324558e+85

    1. Initial program 57.6

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

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

    if -1.248052338324558e+85 < b_2 < -3.2946614796208325e-116

    1. Initial program 40.3

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

      \[\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/43.5

      \[\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. Simplified18.2

      \[\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 -3.2946614796208325e-116 < b_2 < 3.945589219663718e+109

    1. Initial program 11.7

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

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

    if 3.945589219663718e+109 < b_2

    1. Initial program 46.6

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity46.6

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.248052338324558 \cdot 10^{+85}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.2946614796208325 \cdot 10^{-116}:\\ \;\;\;\;\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 3.945589219663718 \cdot 10^{+109}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Reproduce

herbie shell --seed 2019008 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 17.3s)Debug log

sample133.0ms

Algorithm
intervals

simplify49.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.0b

localize28.0ms

Local error

Found 4 expressions with local error:

23.7b
(sqrt (- (* b_2 b_2) (* a c)))
1.0b
(- (* b_2 b_2) (* a c))
0.8b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

15.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
5.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
2.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series212.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

81.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
58.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
51.0ms
(sqrt (- (* b_2 b_2) (* a c)))
22.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
32 → 73
Calls

32 calls. Slowest were:

308.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
230.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
222.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune789.0ms

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 6.6b

localize25.0ms

Local error

Found 4 expressions with local error:

23.7b
(sqrt (- (pow b_2 2) (* a c)))
1.0b
(- (pow b_2 2) (* a c))
0.8b
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
0.1b
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)

rewrite49.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

23.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
13.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
6.0ms
(- (pow b_2 2) (* a c))

series175.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

62.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
53.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
40.0ms
(sqrt (- (pow b_2 2) (* a c)))
20.0ms
(- (pow b_2 2) (* a c))

simplify2.3s

Counts
32 → 73
Calls

32 calls. Slowest were:

745.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))))
366.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
333.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (pow b_2 2) (* a c))) 3))

prune841.0ms

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 6.6b

localize12.0ms

Local error

Found 4 expressions with local error:

23.7b
(sqrt (- (pow b_2 2) (* a c)))
1.0b
(- (pow b_2 2) (* a c))
0.8b
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
0.1b
(/ 1 (/ a (- (- b_2) (sqrt (- (pow b_2 2) (* a c))))))

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

13.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
6.0ms
(- (pow b_2 2) (* a c))
5.0ms
(sqrt (- (pow b_2 2) (* a c)))

series235.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

87.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (pow b_2 2) (* a c))))))
58.0ms
(sqrt (- (pow b_2 2) (* a c)))
54.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
36.0ms
(- (pow b_2 2) (* a c))

simplify1.6s

Counts
33 → 74
Calls

33 calls. Slowest were:

359.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
298.0ms
(+ (* (- b_2) (- b_2)) (+ (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))) (* (- b_2) (sqrt (- (pow b_2 2) (* a c))))))
250.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))

prune921.0ms

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 6.6b

localize25.0ms

Local error

Found 4 expressions with local error:

23.7b
(sqrt (- (* b_2 b_2) (* a c)))
23.7b
(sqrt (- (* b_2 b_2) (* a c)))
23.7b
(sqrt (- (* b_2 b_2) (* a c)))
1.0b
(- (* b_2 b_2) (* a c))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

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

series178.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

63.0ms
(sqrt (- (* b_2 b_2) (* a c)))
40.0ms
(sqrt (- (* b_2 b_2) (* a c)))
38.0ms
(sqrt (- (* b_2 b_2) (* a c)))
37.0ms
(- (* b_2 b_2) (* a c))

simplify2.1s

Counts
31 → 66
Calls

31 calls. Slowest were:

323.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
278.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
269.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune912.0ms

Pruning

12 alts after pruning (9 fresh and 3 done)

Merged error: 6.6b

regimes563.0ms

Accuracy

85.9% (3.9b remaining)

Error of 9.4b against oracle of 5.5b and baseline of 33.2b

bsearch422.0ms

end0.0ms

sample4.0s

Algorithm
intervals