Average Error: 33.3 → 8.8
Time: 25.9s
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.828824462024135 \cdot 10^{+54}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.059221789721135 \cdot 10^{-306}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 5.973421650485517 \cdot 10^{+105}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right)\\ \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 4 regimes
  2. if b_2 < -1.828824462024135e+54

    1. Initial program 56.5

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

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

    if -1.828824462024135e+54 < b_2 < -5.059221789721135e-306

    1. Initial program 30.2

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

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

      \[\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}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/30.4

      \[\leadsto \color{blue}{\frac{\left(\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}\right) \cdot \frac{1}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    7. Simplified16.1

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

    if -5.059221789721135e-306 < b_2 < 5.973421650485517e+105

    1. Initial program 9.0

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

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

    if 5.973421650485517e+105 < b_2

    1. Initial program 46.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.828824462024135 \cdot 10^{+54}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.059221789721135 \cdot 10^{-306}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 5.973421650485517 \cdot 10^{+105}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right)\\ \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 2019002 +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: 25.0s)Debug log

sample86.0ms

Algorithm
intervals

simplify20.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.3b

localize51.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.6b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite53.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

27.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
14.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series208.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

80.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
48.0ms
(sqrt (- (* b_2 b_2) (* a c)))
47.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
33.0ms
(- (* b_2 b_2) (* a c))

simplify3.7s

Counts
84 → 111
Calls

84 calls. Slowest were:

443.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
347.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
249.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune1.1s

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 5.0b

localize12.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.6b
(- (* b_2 b_2) (* a c))
0.2b
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 100
Calls

4 calls. Slowest were:

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

series223.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

65.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
63.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
60.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify3.7s

Counts
85 → 112
Calls

85 calls. Slowest were:

432.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))))))
400.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
382.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune1.2s

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 5.0b

localize12.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.6b
(- (* b_2 b_2) (* a c))
0.2b
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

rewrite51.0ms

Algorithm
rewrite-expression-head
Counts
4 → 107
Calls

4 calls. Slowest were:

22.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
18.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
6.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series195.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

68.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
55.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
36.0ms
(sqrt (- (* b_2 b_2) (* a c)))
36.0ms
(- (* b_2 b_2) (* a c))

simplify6.0s

Counts
94 → 119
Calls

94 calls. Slowest were:

597.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
558.0ms
(* (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)) 1)
551.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

prune1.3s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 5.0b

localize16.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
13.4b
(/ (* a c) a)
1.1b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.6b
(- (* b_2 b_2) (* a c))

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

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

series137.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

59.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
46.0ms
(sqrt (- (* b_2 b_2) (* a c)))
23.0ms
(- (* b_2 b_2) (* a c))
9.0ms
(/ (* a c) a)

simplify1.4s

Counts
25 → 76
Calls

25 calls. Slowest were:

460.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
352.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
89.0ms
(- (* 1/2 (/ (* a c) b_2)) (* 2 b_2))

prune680.0ms

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 5.0b

regimes329.0ms

Accuracy

88.3% (3.2b remaining)

Error of 8.8b against oracle of 5.6b and baseline of 33.3b

bsearch350.0ms

end0.0ms

sample4.1s

Algorithm
intervals