Average Error: 33.1 → 9.5
Time: 36.8s
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 -4.9529633933266 \cdot 10^{-08}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.432147794020809 \cdot 10^{-104}:\\ \;\;\;\;\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 -5.51185453096989 \cdot 10^{-127}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 8.046684077965657 \cdot 10^{+99}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_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 < -4.9529633933266e-08 or -1.432147794020809e-104 < b_2 < -5.51185453096989e-127

    1. Initial program 53.5

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

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

    if -4.9529633933266e-08 < b_2 < -1.432147794020809e-104

    1. Initial program 34.8

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

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

      \[\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. Simplified21.5

      \[\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 -5.51185453096989e-127 < b_2 < 8.046684077965657e+99

    1. Initial program 10.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity10.9

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

    if 8.046684077965657e+99 < b_2

    1. Initial program 44.5

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied div-inv44.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.9529633933266 \cdot 10^{-08}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.432147794020809 \cdot 10^{-104}:\\ \;\;\;\;\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 -5.51185453096989 \cdot 10^{-127}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 8.046684077965657 \cdot 10^{+99}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Reproduce

herbie shell --seed 2019004 +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.8s)Debug log

sample142.0ms

Algorithm
intervals

simplify42.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune40.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.9b

localize19.0ms

Local error

Found 4 expressions with local error:

22.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

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

series165.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

52.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
42.0ms
(sqrt (- (* b_2 b_2) (* a c)))
40.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
31.0ms
(- (* b_2 b_2) (* a c))

simplify3.7s

Counts
84 → 111
Calls

84 calls. Slowest were:

437.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
326.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
231.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune1.2s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 5.1b

localize7.0ms

Local error

Found 4 expressions with local error:

22.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite51.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

20.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
19.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series217.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

68.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
62.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
51.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify4.0s

Counts
84 → 111
Calls

84 calls. Slowest were:

550.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
370.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
240.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))

prune1.3s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 5.1b

localize16.0ms

Local error

Found 4 expressions with local error:

22.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.2b
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 100
Calls

4 calls. Slowest were:

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

series244.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

85.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
69.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
54.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify3.8s

Counts
85 → 112
Calls

85 calls. Slowest were:

515.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
334.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
328.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))))))

prune1.2s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 5.1b

localize8.0ms

Local error

Found 4 expressions with local error:

22.0b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.8b
(- (* b_2 b_2) (* a c))
0.3b
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 129
Calls

4 calls. Slowest were:

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

series215.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

86.0ms
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
58.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
49.0ms
(sqrt (- (* b_2 b_2) (* a c)))
21.0ms
(- (* b_2 b_2) (* a c))

simplify12.5s

Counts
137 → 141
Calls

137 calls. Slowest were:

1.6s
(/ (* (* (/ 1 a) (/ 1 a)) (/ 1 a)) (* (* (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
689.0ms
(/ (cbrt (/ 1 a)) (+ (* (- 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)))))))
651.0ms
(/ (sqrt (/ 1 a)) (+ (* (- 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)))))))

prune1.5s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 5.1b

regimes466.0ms

Accuracy

85.3% (4.1b remaining)

Error of 9.5b against oracle of 5.5b and baseline of 33.1b

bsearch498.0ms

end0.0ms

sample4.4s

Algorithm
intervals