Average Error: 33.2 → 9.4
Time: 27.7s
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{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}\right)}}{a}\]
    5. Applied associate-/l*46.7

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}}}}\]
    6. 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 +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: 26.6s)Debug log

sample79.0ms

Algorithm
intervals

simplify52.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune13.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.0b

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

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

24.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
7.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series233.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

80.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
66.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
53.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify4.0s

Counts
84 → 111
Calls

84 calls. Slowest were:

468.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
299.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
222.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))

prune1.2s

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 6.6b

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

rewrite81.0ms

Algorithm
rewrite-expression-head
Counts
4 → 105
Calls

4 calls. Slowest were:

45.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
18.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
8.0ms
(sqrt (- (pow b_2 2) (* a c)))

series237.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

70.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
67.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
64.0ms
(sqrt (- (pow b_2 2) (* a c)))
36.0ms
(- (pow b_2 2) (* a c))

simplify3.9s

Counts
92 → 117
Calls

92 calls. Slowest were:

437.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))
335.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
217.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))))

prune1.3s

Pruning

13 alts after pruning (12 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))))))

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 106
Calls

4 calls. Slowest were:

19.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
8.0ms
(sqrt (- (pow b_2 2) (* a c)))
7.0ms
(- (pow b_2 2) (* a c))

series207.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

83.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (pow b_2 2) (* a c))))))
61.0ms
(sqrt (- (pow b_2 2) (* a c)))
43.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
20.0ms
(- (pow b_2 2) (* a c))

simplify4.0s

Counts
93 → 118
Calls

93 calls. Slowest were:

484.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))
343.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))))))
298.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))

prune1.3s

Pruning

13 alts after pruning (11 fresh and 2 done)

Merged error: 6.6b

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

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

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

series168.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

53.0ms
(sqrt (- (* b_2 b_2) (* a c)))
45.0ms
(sqrt (- (* b_2 b_2) (* a c)))
39.0ms
(sqrt (- (* b_2 b_2) (* a c)))
31.0ms
(- (* b_2 b_2) (* a c))

simplify3.4s

Counts
33 → 76
Calls

33 calls. Slowest were:

553.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
519.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
452.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune1.0s

Pruning

13 alts after pruning (10 fresh and 3 done)

Merged error: 6.6b

regimes631.0ms

Accuracy

85.9% (3.9b remaining)

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

bsearch376.0ms

end0.0ms

sample4.1s

Algorithm
intervals