Average Error: 33.6 → 10.5
Time: 22.6s
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}:\\ \;\;\;\;\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 < -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. Taylor expanded around inf 51.6

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{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. Using strategy rm
    3. 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}\]
    4. 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)}}\]
    5. 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. Taylor expanded around inf 11.5

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

    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. Using strategy rm
    3. Applied *-un-lft-identity46.8

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    4. 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}}}}\]
    5. 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.5

    \[\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}:\\ \;\;\;\;\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 2018360 
(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: 15.7s)Debug log

start188.0ms

Algorithm
intervals

setup28.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.8b

localize47.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)

rewrite44.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

26.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
10.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series206.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

75.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
53.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
53.0ms
(sqrt (- (* b_2 b_2) (* a c)))
24.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
32 → 73
Calls

32 calls. Slowest were:

300.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
276.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
219.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune796.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 4.7b

localize13.0ms

Local error

Found 4 expressions with local error:

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

rewrite64.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

35.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))

series215.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

68.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
60.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
59.0ms
(sqrt (- (pow b_2 2) (* a c)))
28.0ms
(- (pow b_2 2) (* a c))

simplify1.9s

Counts
32 → 73
Calls

32 calls. Slowest were:

537.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))))
263.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
262.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))

prune821.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 4.7b

localize6.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))))))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

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

series260.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

101.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
70.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
53.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
33 → 74
Calls

33 calls. Slowest were:

363.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))))))
304.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
251.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune944.0ms

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 4.7b

localize24.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 → 86
Calls

4 calls. Slowest were:

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

series248.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

67.0ms
(- (- b_2) (* (sqrt (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (sqrt (- (* b_2 b_2) (* a c))))))
61.0ms
(sqrt (- (* b_2 b_2) (* a c)))
61.0ms
(* (sqrt (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (sqrt (- (* b_2 b_2) (* a c)))))
59.0ms
(sqrt (- (* b_2 b_2) (* a c)))

simplify4.5s

Counts
67 → 98
Calls

67 calls. Slowest were:

437.0ms
(* (sqrt (sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))) (sqrt (sqrt (- (* b_2 b_2) (* a c)))))
361.0ms
(* (sqrt (sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))) (sqrt (sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))))
333.0ms
(* (sqrt (sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))) (sqrt (sqrt (- (* b_2 b_2) (* a c)))))

prune1.2s

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 4.7b

regimes489.0ms

Accuracy

82% (5.1b remaining)

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

bsearch567.0ms