Average Error: 33.7 → 6.5
Time: 22.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 -8.18380023338469 \cdot 10^{+152}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -4.089318305554672 \cdot 10^{-307}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 3.3987455899985826 \cdot 10^{+126}:\\ \;\;\;\;\frac{(\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \left(\sqrt[3]{-b_2}\right) + \left(-\sqrt{b_2 \cdot b_2 - c \cdot a}\right))_*}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -8.18380023338469e+152

    1. Initial program 62.8

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

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

    if -8.18380023338469e+152 < b_2 < -4.089318305554672e-307

    1. Initial program 33.8

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

      \[\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/37.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. Simplified19.4

      \[\leadsto \frac{\color{blue}{a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied times-frac8.4

      \[\leadsto \color{blue}{\frac{a}{a} \cdot \frac{c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    8. Simplified8.4

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

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

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

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

    if -4.089318305554672e-307 < b_2 < 3.3987455899985826e+126

    1. Initial program 8.6

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

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \sqrt[3]{-b_2}} - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    4. Applied fma-neg9.0

      \[\leadsto \frac{\color{blue}{(\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \left(\sqrt[3]{-b_2}\right) + \left(-\sqrt{b_2 \cdot b_2 - a \cdot c}\right))_*}}{a}\]

    if 3.3987455899985826e+126 < b_2

    1. Initial program 52.4

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

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

      \[\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. Simplified62.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)}\]
    6. Taylor expanded around 0 3.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -8.18380023338469 \cdot 10^{+152}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -4.089318305554672 \cdot 10^{-307}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 3.3987455899985826 \cdot 10^{+126}:\\ \;\;\;\;\frac{(\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \left(\sqrt[3]{-b_2}\right) + \left(-\sqrt{b_2 \cdot b_2 - c \cdot a}\right))_*}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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

sample121.0ms

Algorithm
intervals

simplify25.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

24.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

localize38.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 → 99
Calls

4 calls. Slowest were:

21.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
10.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series187.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

67.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
50.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
48.0ms
(sqrt (- (* b_2 b_2) (* a c)))
22.0ms
(- (* b_2 b_2) (* a c))

simplify3.8s

Counts
84 → 111
Calls

84 calls. Slowest were:

407.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
395.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
308.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune1.3s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 6.1b

localize14.0ms

Local error

Found 4 expressions with local error:

24.0b
(sqrt (- (* b_2 b_2) (* a c)))
16.8b
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
1.5b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
1.2b
(- (* b_2 b_2) (* a c))

rewrite26.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

11.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
6.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series226.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

116.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
53.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
37.0ms
(sqrt (- (* b_2 b_2) (* a c)))
20.0ms
(- (* b_2 b_2) (* a c))

simplify2.8s

Counts
32 → 82
Calls

32 calls. Slowest were:

557.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))))))
472.0ms
(- (log (* a c)) (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
463.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune829.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 6.1b

localize16.0ms

Local error

Found 4 expressions with local error:

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

rewrite46.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

25.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
11.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series269.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

121.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
59.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
58.0ms
(sqrt (- (* b_2 b_2) (* a c)))
30.0ms
(- (* b_2 b_2) (* a c))

simplify1.7s

Counts
31 → 80
Calls

31 calls. Slowest were:

476.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
413.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
295.0ms
(+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (+ (* b_2 b_2) (* (sqrt (- (* b_2 b_2) (* a c))) b_2)))

prune767.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 6.1b

localize10.0ms

Local error

Found 4 expressions with local error:

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

rewrite44.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

23.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
12.0ms
(/ (/ c 1) (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series249.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

110.0ms
(/ (/ c 1) (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
65.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
44.0ms
(sqrt (- (* b_2 b_2) (* a c)))
30.0ms
(- (* b_2 b_2) (* a c))

simplify2.5s

Counts
59 → 99
Calls

59 calls. Slowest were:

469.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
356.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
330.0ms
(/ (* (* (/ c 1) (/ c 1)) (/ c 1)) (* (* (- (sqrt (- (* b_2 b_2) (* a c))) b_2) (- (sqrt (- (* b_2 b_2) (* a c))) b_2)) (- (sqrt (- (* b_2 b_2) (* a c))) b_2)))

prune1.0s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 6.1b

regimes256.0ms

Accuracy

95.9% (1.0b remaining)

Error of 6.5b against oracle of 5.5b and baseline of 29.8b

bsearch485.0ms

end0.0ms

sample4.5s

Algorithm
intervals