Average Error: 33.0 → 7.3
Time: 28.5s
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.149882403051541 \cdot 10^{+52}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.3114917253015484 \cdot 10^{-256}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 1.2400038106051258 \cdot 10^{+68}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \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 < -2.149882403051541e+52

    1. Initial program 56.9

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

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

    if -2.149882403051541e+52 < b_2 < -5.3114917253015484e-256

    1. Initial program 31.7

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

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

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

      \[\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. Simplified17.4

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

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

    if -5.3114917253015484e-256 < b_2 < 1.2400038106051258e+68

    1. Initial program 10.2

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

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

    if 1.2400038106051258e+68 < b_2

    1. Initial program 37.5

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

      \[\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 simplification7.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.149882403051541 \cdot 10^{+52}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.3114917253015484 \cdot 10^{-256}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 1.2400038106051258 \cdot 10^{+68}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 1137770271 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 26.4s)Debug log

sample199.0ms

Algorithm
intervals
Results
192×40.0ms(body real 80)
30×38.0ms(body real 2560)
32×33.0ms(body real 1280)
98×20.0ms(body nan 80)
17×15.0ms(body real 640)
381×14.0ms(pre true 80)
10×8.0ms(body real 320)
1.0ms(body real 5120)
0.0ms(body real 160)

simplify47.0ms

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

prune35.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.0b

localize63.0ms

Local error

Found 4 expressions with local error:

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

rewrite83.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
52.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
18.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))

series341.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
111.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
96.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
87.0ms
(sqrt (- (* b_2 b_2) (* a c)))
46.0ms
(- (* b_2 b_2) (* a c))

simplify2.5s

Counts
32 → 73
Calls
32 calls:
Slowest
595.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
366.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
360.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
267.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))
184.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))

prune1.5s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 7.1b

localize20.0ms

Local error

Found 4 expressions with local error:

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

rewrite59.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
34.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
14.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(- (* b_2 b_2) (* a c))

series307.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
107.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
86.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
72.0ms
(sqrt (- (* b_2 b_2) (* a c)))
42.0ms
(- (* b_2 b_2) (* a c))

simplify4.3s

Counts
42 → 81
Calls
42 calls:
Slowest
600.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)))
466.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
460.0ms
(* (- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c))))) 1)
458.0ms
(* (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)) 1)
430.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

prune1.4s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 7.1b

localize23.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
14.6b
(/ (* a c) a)
0.7b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))

rewrite29.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
13.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(/ (* a c) a)
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(- (* b_2 b_2) (* a c))

series217.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
90.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
75.0ms
(sqrt (- (* b_2 b_2) (* a c)))
42.0ms
(- (* b_2 b_2) (* a c))
10.0ms
(/ (* a c) a)

simplify1.8s

Counts
21 → 62
Calls
21 calls:
Slowest
526.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
482.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
227.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
162.0ms
(- (* 1/2 (/ (* a c) b_2)) b_2)
110.0ms
(- (* 1/2 (/ (* a c) b_2)) (* 2 b_2))

prune1.7s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 7.0b

localize9.0ms

Local error

Found 4 expressions with local error:

22.2b
(sqrt (- (* b_2 b_2) (* a c)))
0.7b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ c (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))

rewrite36.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
14.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
11.0ms
(/ c (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(- (* b_2 b_2) (* a c))

series436.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
234.0ms
(/ c (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))
84.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
73.0ms
(sqrt (- (* b_2 b_2) (* a c)))
45.0ms
(- (* b_2 b_2) (* a c))

simplify2.0s

Counts
27 → 67
Calls
27 calls:
Slowest
435.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
405.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
395.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))))))
190.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
97.0ms
(- (* 1/2 (/ (* a c) b_2)) (* 2 b_2))

prune1.2s

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 7.0b

regimes616.0ms

Accuracy

93.9% (1.5b remaining)

Error of 7.3b against oracle of 5.8b and baseline of 29.8b

bsearch667.0ms

end0.0ms

sample6.8s

Algorithm
intervals
Results
1042×1.5s(body real 2560)
5899×1.4s(body real 80)
882×1.1s(body real 1280)
2924×589.0ms(body nan 80)
11626×478.0ms(pre true 80)
446×460.0ms(body real 640)
116×256.0ms(body real 5120)
218×173.0ms(body real 320)
99×43.0ms(body real 160)