Average Error: 33.3 → 6.8
Time: 16.3s
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.2011928214601198 \cdot 10^{+124}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.7718118619005265 \cdot 10^{-295}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}{c}}\\ \mathbf{elif}\;b_2 \le 1.592220113700558 \cdot 10^{+55}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \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.2011928214601198e+124

    1. Initial program 59.7

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

      \[\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 2.2

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

    if -1.2011928214601198e+124 < b_2 < -5.7718118619005265e-295

    1. Initial program 33.4

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

      \[\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--33.5

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

      \[\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. Simplified14.7

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

      \[\leadsto \frac{\color{blue}{c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    9. Using strategy rm
    10. Applied clear-num8.8

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

    if -5.7718118619005265e-295 < b_2 < 1.592220113700558e+55

    1. Initial program 9.5

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

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

    if 1.592220113700558e+55 < b_2

    1. Initial program 36.4

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

      \[\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 simplification6.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.2011928214601198 \cdot 10^{+124}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.7718118619005265 \cdot 10^{-295}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}{c}}\\ \mathbf{elif}\;b_2 \le 1.592220113700558 \cdot 10^{+55}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

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

sample149.0ms

Algorithm
intervals

simplify57.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
57.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.1b

localize32.0ms

Local error

Found 4 expressions with local error:

23.4b
(sqrt (- (* b_2 b_2) (* a c)))
0.4b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite39.0ms

Algorithm
rewrite-expression-head
Rules
15×add-sqr-sqrt
10×*-un-lft-identity
add-log-exp
associate-/l*
add-cube-cbrt
sqrt-prod
difference-of-squares
flip--
add-exp-log
add-cbrt-cube
flip3--
pow1
associate-/l/
distribute-lft-out--
diff-log
sqrt-div
sub-neg
div-inv
div-sub
pow1/2
frac-2neg
clear-num
rem-sqrt-square
neg-sub0
associate--l-
Counts
4 → 61
Calls
4 calls:
Slowest
19.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
11.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series220.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
66.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
62.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
59.0ms
(sqrt (- (* b_2 b_2) (* a c)))
33.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
32 → 73
Calls
32 calls:
Slowest
263.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
262.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
250.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
202.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))
143.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))

prune710.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 6.2b

localize12.0ms

Local error

Found 4 expressions with local error:

23.4b
(sqrt (- (* b_2 b_2) (* a c)))
0.4b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.2b
(- (* b_2 b_2) (* a c))
0.2b
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

rewrite46.0ms

Algorithm
rewrite-expression-head
Rules
16×add-sqr-sqrt
11×*-un-lft-identity
add-log-exp
add-cube-cbrt
add-exp-log
associate-*l*
add-cbrt-cube
pow1
flip--
sqrt-prod
flip3--
difference-of-squares
associate-*r*
distribute-lft-out--
associate-*l/
diff-log
sqrt-div
sub-neg
frac-times
div-inv
cbrt-unprod
*-commutative
un-div-inv
associate-*r/
prod-exp
pow-prod-down
pow1/2
rem-sqrt-square
neg-sub0
associate--l-
Counts
4 → 69
Calls
4 calls:
Slowest
26.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
11.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series159.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
56.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
42.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
40.0ms
(sqrt (- (* b_2 b_2) (* a c)))
20.0ms
(- (* b_2 b_2) (* a c))

simplify2.8s

Counts
42 → 81
Calls
42 calls:
Slowest
387.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)))
347.0ms
(* (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)) 1)
335.0ms
(* (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))) 1)
232.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
221.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

prune783.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 6.2b

localize16.0ms

Local error

Found 4 expressions with local error:

23.4b
(sqrt (- (* b_2 b_2) (* a c)))
15.2b
(/ (* a c) a)
1.7b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.2b
(- (* b_2 b_2) (* a c))

rewrite24.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
*-un-lft-identity
add-sqr-sqrt
add-cube-cbrt
add-exp-log
add-cbrt-cube
pow1
sqrt-prod
flip--
sqrt-div
flip3--
associate-/l*
distribute-lft-out
div-inv
flip-+
associate-+l-
diff-log
pow1/2
flip3-+
frac-2neg
sub-neg
sum-log
clear-num
rem-sqrt-square
+-commutative
neg-sub0
Counts
4 → 50
Calls
4 calls:
Slowest
11.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(/ (* a c) a)
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series121.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
46.0ms
(sqrt (- (* b_2 b_2) (* a c)))
40.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
30.0ms
(- (* b_2 b_2) (* a c))
5.0ms
(/ (* a c) a)

simplify830.0ms

Counts
21 → 62
Calls
21 calls:
Slowest
248.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
162.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
108.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
88.0ms
(- (* 1/2 (/ (* a c) b_2)) (* 2 b_2))
46.0ms
(* -1/2 (/ (* a c) b_2))

prune628.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 6.2b

localize10.0ms

Local error

Found 4 expressions with local error:

23.4b
(sqrt (- (* b_2 b_2) (* a c)))
1.7b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.2b
(- (* b_2 b_2) (* a c))
0.1b
(/ c (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))

rewrite29.0ms

Algorithm
rewrite-expression-head
Rules
10×*-un-lft-identity
add-log-exp
add-sqr-sqrt
add-cube-cbrt
add-exp-log
add-cbrt-cube
associate-/r*
pow1
sqrt-prod
distribute-lft-out
flip--
flip-+
associate-/r/
sqrt-div
flip3--
flip3-+
div-inv
associate-+l-
diff-log
pow1/2
frac-2neg
sub-neg
sum-log
clear-num
rem-sqrt-square
+-commutative
neg-sub0
Counts
4 → 55
Calls
4 calls:
Slowest
11.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
8.0ms
(/ c (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series318.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
158.0ms
(/ c (+ (- 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)))
37.0ms
(- (* b_2 b_2) (* a c))

simplify1.5s

Counts
27 → 67
Calls
27 calls:
Slowest
300.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
297.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))))))
252.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
175.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
89.0ms
(- (* 1/2 (/ (* a c) b_2)) (* 2 b_2))

prune667.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 6.2b

regimes282.0ms

Accuracy

94.5% (1.3b remaining)

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

bsearch550.0ms

end0.0ms

sample4.0s

Algorithm
intervals