Average Error: 33.5 → 10.6
Time: 38.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 -2.8328889513248502 \cdot 10^{-121}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.0964691378674393 \cdot 10^{+108}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b_2 < -2.8328889513248502e-121

    1. Initial program 50.8

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

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

    if -2.8328889513248502e-121 < b_2 < 3.0964691378674393e+108

    1. Initial program 11.9

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

      \[\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*12.0

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

    if 3.0964691378674393e+108 < b_2

    1. Initial program 46.3

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    3. Simplified3.5

      \[\leadsto \color{blue}{(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.8328889513248502 \cdot 10^{-121}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.0964691378674393 \cdot 10^{+108}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \end{array}\]

Reproduce

herbie shell --seed 2018365 +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: 31.9s)Debug log

start107.0ms

Algorithm
intervals

setup30.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.5b

localize30.0ms

Local error

Found 4 expressions with local error:

24.1b
(sqrt (- (* b_2 b_2) (* a c)))
1.3b
(- (- 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)

rewrite42.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)
13.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(- (* b_2 b_2) (* a c))

series204.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

63.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
60.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
53.0ms
(sqrt (- (* b_2 b_2) (* a c)))
28.0ms
(- (* b_2 b_2) (* a c))

simplify3.7s

Counts
84 → 111
Calls

84 calls. Slowest were:

482.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
291.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
242.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.9b

localize13.0ms

Local error

Found 4 expressions with local error:

24.1b
(sqrt (- (pow b_2 2) (* a c)))
1.3b
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
0.8b
(- (pow b_2 2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)

rewrite44.0ms

Algorithm
rewrite-expression-head
Counts
4 → 105
Calls

4 calls. Slowest were:

22.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
13.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
4.0ms
(sqrt (- (pow b_2 2) (* a c)))

series200.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

68.0ms
(/ (- (- b_2) (sqrt (- (pow b_2 2) (* a c)))) a)
63.0ms
(- (- b_2) (sqrt (- (pow b_2 2) (* a c))))
42.0ms
(sqrt (- (pow b_2 2) (* a c)))
27.0ms
(- (pow b_2 2) (* a c))

simplify4.1s

Counts
92 → 117
Calls

92 calls. Slowest were:

571.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))
424.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
186.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))))

prune1.4s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 5.9b

localize11.0ms

Local error

Found 4 expressions with local error:

24.1b
(sqrt (- (* b_2 b_2) (* a c)))
1.3b
(- (- 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))))))

rewrite27.0ms

Algorithm
rewrite-expression-head
Counts
4 → 100
Calls

4 calls. Slowest were:

12.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series241.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

105.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
63.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
40.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify3.8s

Counts
85 → 112
Calls

85 calls. Slowest were:

546.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
354.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))))))
321.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune1.6s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 5.9b

localize8.0ms

Local error

Found 4 expressions with local error:

24.1b
(sqrt (- (* b_2 b_2) (* a c)))
1.3b
(- (- 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)))

series225.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

91.0ms
(/ (/ 1 a) (/ 1 (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
53.0ms
(sqrt (- (* b_2 b_2) (* a c)))
51.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
29.0ms
(- (* b_2 b_2) (* a c))

simplify12.5s

Counts
137 → 141
Calls

137 calls. Slowest were:

1.5s
(/ (* (* (/ 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)))))))
771.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)))))))
731.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.6s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 5.9b

regimes443.0ms

Accuracy

82.3% (5.0b remaining)

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

bsearch329.0ms