Average Error: 33.3 → 8.8
Time: 17.4s
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}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \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.828824462024135e+54

    1. Initial program 56.5

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. 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. Using strategy rm
    3. Applied div-inv46.5

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
  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}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

herbie shell --seed 2019002 
(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: 16.4s)Debug log

sample119.0ms

Algorithm
intervals

simplify40.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

40.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: 32.3b

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

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

14.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
5.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
2.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series214.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

69.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
65.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
51.0ms
(sqrt (- (* b_2 b_2) (* a c)))
28.0ms
(- (* b_2 b_2) (* a c))

simplify1.7s

Counts
32 → 73
Calls

32 calls. Slowest were:

311.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
268.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
244.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune863.0ms

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

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

series225.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

102.0ms
(/ 1 (/ a (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
56.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
44.0ms
(sqrt (- (* b_2 b_2) (* a c)))
23.0ms
(- (* b_2 b_2) (* a c))

simplify1.4s

Counts
33 → 74
Calls

33 calls. Slowest were:

405.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))))))
217.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
211.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune740.0ms

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

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

13.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
9.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series198.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

67.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
53.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
44.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify3.2s

Counts
42 → 81
Calls

42 calls. Slowest were:

449.0ms
(* (* (* (- (- b_2) (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))))) (* (* (/ 1 a) (/ 1 a)) (/ 1 a)))
368.0ms
(* (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)) 1)
354.0ms
(* (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))) 1)

prune794.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 5.0b

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 50
Calls

4 calls. Slowest were:

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

series136.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

53.0ms
(sqrt (- (* b_2 b_2) (* a c)))
48.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
27.0ms
(- (* b_2 b_2) (* a c))
8.0ms
(/ (* a c) a)

simplify1.0s

Counts
21 → 62
Calls

21 calls. Slowest were:

301.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
267.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
142.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))

prune636.0ms

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 5.0b

regimes481.0ms

Accuracy

88.3% (3.2b remaining)

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

bsearch338.0ms

end0.0ms

sample4.2s

Algorithm
intervals