Average Error: 33.7 → 9.4
Time: 19.1s
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.4031947752424545 \cdot 10^{+120}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.8264402218067264 \cdot 10^{-70}:\\ \;\;\;\;\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 -2.9566045583213624 \cdot 10^{-91}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.2243609558936807 \cdot 10^{+127}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \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 < -1.4031947752424545e+120 or -3.8264402218067264e-70 < b_2 < -2.9566045583213624e-91

    1. Initial program 58.3

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

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity59.0

      \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    6. Applied associate-/l*59.6

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    7. Using strategy rm
    8. Applied associate-/r/59.2

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\frac{1}{a} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    9. Taylor expanded around -inf 3.7

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

    if -1.4031947752424545e+120 < b_2 < -3.8264402218067264e-70

    1. Initial program 42.9

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

      \[\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/45.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. Simplified16.0

      \[\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 -2.9566045583213624e-91 < b_2 < 1.2243609558936807e+127

    1. Initial program 11.8

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

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]

    if 1.2243609558936807e+127 < b_2

    1. Initial program 52.5

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

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity52.5

      \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    6. Applied associate-/l*52.5

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    7. Using strategy rm
    8. Applied associate-/r/52.5

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\frac{1}{a} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    9. Taylor expanded around 0 2.9

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\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.4031947752424545 \cdot 10^{+120}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.8264402218067264 \cdot 10^{-70}:\\ \;\;\;\;\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 -2.9566045583213624 \cdot 10^{-91}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.2243609558936807 \cdot 10^{+127}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019007 
(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.9s)Debug log

sample149.0ms

Algorithm
intervals

simplify41.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

41.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: 33.8b

localize40.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
1.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

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

series189.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

68.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
57.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
43.0ms
(sqrt (- (* b_2 b_2) (* a c)))
20.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
32 → 73
Calls

32 calls. Slowest were:

273.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
238.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
238.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))

prune738.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 6.1b

localize9.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
6.6b
(- (/ (- b_2) a) (/ (sqrt (- (* b_2 b_2) (* a c))) a))
1.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ (sqrt (- (* b_2 b_2) (* a c))) a)

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

16.0ms
(- (/ (- b_2) a) (/ (sqrt (- (* b_2 b_2) (* a c))) a))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(/ (sqrt (- (* b_2 b_2) (* a c))) a)

series193.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

78.0ms
(/ (sqrt (- (* b_2 b_2) (* a c))) a)
54.0ms
(- (/ (- b_2) a) (/ (sqrt (- (* b_2 b_2) (* a c))) a))
37.0ms
(sqrt (- (* b_2 b_2) (* a c)))
24.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
36 → 74
Calls

36 calls. Slowest were:

264.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
221.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
217.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune799.0ms

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 6.1b

localize19.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
10.1b
(- (/ (- b_2) a) (/ 1 (/ a (sqrt (- (* b_2 b_2) (* a c))))))
1.2b
(- (* b_2 b_2) (* a c))
0.2b
(/ 1 (/ a (sqrt (- (* b_2 b_2) (* a c)))))

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
4 → 63
Calls

4 calls. Slowest were:

13.0ms
(- (/ (- b_2) a) (/ 1 (/ a (sqrt (- (* b_2 b_2) (* a c))))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series213.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

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

simplify1.3s

Counts
35 → 75
Calls

35 calls. Slowest were:

208.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
204.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
134.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))

prune834.0ms

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 6.1b

localize18.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
10.9b
(- (/ (- b_2) a) (* (/ 1 a) (sqrt (- (* b_2 b_2) (* a c)))))
1.2b
(- (* b_2 b_2) (* a c))
0.3b
(* (/ 1 a) (sqrt (- (* b_2 b_2) (* a c))))

rewrite44.0ms

Algorithm
rewrite-expression-head
Counts
4 → 71
Calls

4 calls. Slowest were:

18.0ms
(- (/ (- b_2) a) (* (/ 1 a) (sqrt (- (* b_2 b_2) (* a c)))))
16.0ms
(* (/ 1 a) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series217.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

75.0ms
(- (/ (- b_2) a) (* (/ 1 a) (sqrt (- (* b_2 b_2) (* a c)))))
59.0ms
(* (/ 1 a) (sqrt (- (* b_2 b_2) (* a c))))
48.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify3.5s

Counts
50 → 83
Calls

50 calls. Slowest were:

385.0ms
(- (* (- b_2) (* a (sqrt (+ (* b_2 b_2) (* a c))))) (* a (* 1 (sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c)))))))
366.0ms
(* (* (* (/ 1 a) (/ 1 a)) (/ 1 a)) (* (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (sqrt (- (* b_2 b_2) (* a c)))))
322.0ms
(- (* (- b_2) (sqrt (+ (* (* b_2 b_2) (* b_2 b_2)) (+ (* (* a c) (* a c)) (* (* b_2 b_2) (* a c)))))) (* a (* (/ 1 a) (sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3))))))

prune883.0ms

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 6.1b

regimes500.0ms

Accuracy

86.4% (3.9b remaining)

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

bsearch427.0ms

end0.0ms

sample4.6s

Algorithm
intervals