Average Error: 33.6 → 10.6
Time: 42.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 -3.6860937275891304 \cdot 10^{+120}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -9.565134490438525 \cdot 10^{-14}:\\ \;\;\;\;\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 -1.4327714371069 \cdot 10^{-133}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.6367105644834092 \cdot 10^{+113}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{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 < -3.6860937275891304e+120 or -9.565134490438525e-14 < b_2 < -1.4327714371069e-133

    1. Initial program 51.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification51.6

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

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

    if -3.6860937275891304e+120 < b_2 < -9.565134490438525e-14

    1. Initial program 46.3

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification46.3

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied flip--46.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}\]
    5. Applied associate-/l/48.1

      \[\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)}}\]
    6. Simplified14.1

      \[\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 -1.4327714371069e-133 < b_2 < 1.6367105644834092e+113

    1. Initial program 11.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification11.5

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    8. Using strategy rm
    9. Applied associate-/r/11.6

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

    if 1.6367105644834092e+113 < b_2

    1. Initial program 46.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification46.8

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    8. Using strategy rm
    9. Applied associate-/r/46.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.6860937275891304 \cdot 10^{+120}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -9.565134490438525 \cdot 10^{-14}:\\ \;\;\;\;\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 -1.4327714371069 \cdot 10^{-133}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.6367105644834092 \cdot 10^{+113}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Reproduce

herbie shell --seed 2018360 +o rules:numerics
(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: 35.9s)Debug log

start144.0ms

Algorithm
intervals

setup65.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.8b

localize22.0ms

Local error

Found 4 expressions with local error:

22.7b
(sqrt (- (* b_2 b_2) (* a c)))
0.8b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite72.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

44.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
16.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series238.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

76.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
68.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
59.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify3.9s

Counts
84 → 111
Calls

84 calls. Slowest were:

520.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
315.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
280.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune1.3s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 4.7b

localize10.0ms

Local error

Found 4 expressions with local error:

22.7b
(sqrt (- (* b_2 b_2) (* a c)))
0.8b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 100
Calls

4 calls. Slowest were:

8.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))
2.0ms
(- (* b_2 b_2) (* a c))

series205.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

82.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
48.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
43.0ms
(sqrt (- (* b_2 b_2) (* a c)))
31.0ms
(- (* b_2 b_2) (* a c))

simplify3.7s

Counts
85 → 112
Calls

85 calls. Slowest were:

540.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
410.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))))))
307.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune1.4s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 4.7b

localize11.0ms

Local error

Found 4 expressions with local error:

22.7b
(sqrt (- (* b_2 b_2) (* a c)))
0.8b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))
0.2b
(* (/ 1 a) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))

rewrite60.0ms

Algorithm
rewrite-expression-head
Counts
4 → 158
Calls

4 calls. Slowest were:

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

series267.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

102.0ms
(* (/ 1 a) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))
73.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
56.0ms
(sqrt (- (* b_2 b_2) (* a c)))
36.0ms
(- (* b_2 b_2) (* a c))

simplify13.1s

Counts
147 → 170
Calls

147 calls. Slowest were:

882.0ms
(* (* (* (/ 1 a) (/ 1 a)) (/ 1 a)) (* (* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
511.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
398.0ms
(* 1 (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))))

prune2.3s

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 4.7b

localize25.0ms

Local error

Found 4 expressions with local error:

22.7b
(sqrt (- (* b_2 b_2) (* a c)))
22.7b
(sqrt (- (* b_2 b_2) (* a c)))
10.8b
(- (- b_2) (* (sqrt (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (sqrt (- (* b_2 b_2) (* a c))))))
0.5b
(* (sqrt (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (sqrt (- (* b_2 b_2) (* a c)))))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 102
Calls

4 calls. Slowest were:

15.0ms
(* (sqrt (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (sqrt (- (* b_2 b_2) (* a c)))))
8.0ms
(- (- b_2) (* (sqrt (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (sqrt (- (* b_2 b_2) (* a c))))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series183.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

61.0ms
(- (- b_2) (* (sqrt (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (sqrt (- (* b_2 b_2) (* a c))))))
47.0ms
(sqrt (- (* b_2 b_2) (* a c)))
39.0ms
(sqrt (- (* b_2 b_2) (* a c)))
36.0ms
(* (sqrt (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (sqrt (- (* b_2 b_2) (* a c)))))

simplify5.7s

Counts
77 → 114
Calls

77 calls. Slowest were:

518.0ms
(* (sqrt (sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))) (sqrt (sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))))
504.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
486.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune1.6s

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 4.7b

regimes445.0ms

Accuracy

81.8% (5.1b remaining)

Error of 10.6b against oracle of 5.5b and baseline of 33.6b

bsearch1.0s