Average Error: 33.4 → 9.5
Time: 23.6s
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 -3.9662470494954583 \cdot 10^{+148}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.9841336792382835 \cdot 10^{-77}:\\ \;\;\;\;\frac{\sqrt{{b_2}^{2} - c \cdot a} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{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 3 regimes
  2. if b_2 < -3.9662470494954583e+148

    1. Initial program 58.7

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified58.7

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around 0 58.7

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Taylor expanded around -inf 2.0

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

    if -3.9662470494954583e+148 < b_2 < 1.9841336792382835e-77

    1. Initial program 11.9

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified11.9

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around 0 11.9

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

    if 1.9841336792382835e-77 < b_2

    1. Initial program 52.4

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified52.4

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around 0 52.4

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Taylor expanded around inf 8.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.9662470494954583 \cdot 10^{+148}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.9841336792382835 \cdot 10^{-77}:\\ \;\;\;\;\frac{\sqrt{{b_2}^{2} - c \cdot a} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 323378853 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 21.9s)Debug log

sample155.0ms

Algorithm
intervals
Results
38.0ms199×body80valid
35.0ms30×body2560valid
24.0ms25×body1280valid
14.0ms84×body80nan
10.0ms13×body640valid
5.0msbody320valid
3.0msbody5120valid
2.0msbody160valid

simplify40.0ms

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

prune41.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.1b

localize45.0ms

Local error

Found 4 expressions with local error:

24.4b
(sqrt (- (* b_2 b_2) (* a c)))
1.8b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
1.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)

rewrite84.0ms

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

series304.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
103.0ms
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
81.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
78.0ms
(sqrt (- (* b_2 b_2) (* a c)))
42.0ms
(- (* b_2 b_2) (* a c))

simplify2.0s

Counts
24 → 65
Calls
24 calls:
Slowest
421.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
385.0ms
(- (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* b_2 b_2))
347.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
185.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
135.0ms
(- (pow (sqrt (- (* b_2 b_2) (* a c))) 3) (pow b_2 3))

prune1.1s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 4.7b

localize39.0ms

Local error

Found 4 expressions with local error:

24.4b
(sqrt (- (pow b_2 2) (* a c)))
1.8b
(- (sqrt (- (pow b_2 2) (* a c))) b_2)
1.4b
(- (pow b_2 2) (* a c))
0.1b
(/ (- (sqrt (- (pow b_2 2) (* a c))) b_2) a)

rewrite125.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-log-exp
add-cube-cbrt
*-un-lft-identity
flip--
add-exp-log
add-cbrt-cube
flip3--
pow1
associate-/l*
sqrt-prod
associate-/l/
sqrt-div
sub-neg
div-inv
div-sub
diff-log
pow1/2
frac-2neg
clear-num
rem-sqrt-square
Counts
4 → 53
Calls
4 calls:
Slowest
73.0ms
(/ (- (sqrt (- (pow b_2 2) (* a c))) b_2) a)
36.0ms
(- (sqrt (- (pow b_2 2) (* a c))) b_2)
7.0ms
(- (pow b_2 2) (* a c))
7.0ms
(sqrt (- (pow b_2 2) (* a c)))

series303.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
105.0ms
(/ (- (sqrt (- (pow b_2 2) (* a c))) b_2) a)
79.0ms
(- (sqrt (- (pow b_2 2) (* a c))) b_2)
71.0ms
(sqrt (- (pow b_2 2) (* a c)))
47.0ms
(- (pow b_2 2) (* a c))

simplify2.2s

Counts
24 → 65
Calls
24 calls:
Slowest
562.0ms
(- (* (sqrt (- (pow b_2 2) (* a c))) (sqrt (- (pow b_2 2) (* a c)))) (* b_2 b_2))
504.0ms
(sqrt (- (pow (pow b_2 2) 3) (pow (* a c) 3)))
346.0ms
(sqrt (- (* (pow b_2 2) (pow b_2 2)) (* (* a c) (* a c))))
181.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
142.0ms
(- (pow (sqrt (- (pow b_2 2) (* a c))) 3) (pow b_2 3))

prune1.1s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 4.7b

localize16.0ms

Local error

Found 4 expressions with local error:

24.4b
(sqrt (- (* b_2 b_2) (* a c)))
1.8b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
1.4b
(- (* b_2 b_2) (* a c))
0.2b
(/ 1 (/ a (- (sqrt (- (* b_2 b_2) (* a c))) b_2)))

rewrite40.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-log-exp
add-cube-cbrt
*-un-lft-identity
associate-/r*
add-exp-log
pow1
flip--
add-cbrt-cube
flip3--
sqrt-prod
associate-/r/
div-inv
sqrt-div
sub-neg
inv-pow
pow-flip
diff-log
pow1/2
frac-2neg
clear-num
rec-exp
rem-sqrt-square
Counts
4 → 57
Calls
4 calls:
Slowest
26.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(- (* b_2 b_2) (* a c))
4.0ms
(/ 1 (/ a (- (sqrt (- (* b_2 b_2) (* a c))) b_2)))

series336.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
140.0ms
(/ 1 (/ a (- (sqrt (- (* b_2 b_2) (* a c))) b_2)))
80.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
74.0ms
(sqrt (- (* b_2 b_2) (* a c)))
41.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
27 → 69
Calls
27 calls:
Slowest
402.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
349.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
201.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)))
184.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
97.0ms
(- (* 1/2 (/ (* a c) b_2)) (* 2 b_2))

prune1.2s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 4.7b

localize44.0ms

Local error

Found 4 expressions with local error:

25.2b
(cbrt (- (* b_2 b_2) (* a c)))
25.2b
(cbrt (- (* b_2 b_2) (* a c)))
10.8b
(- (* (fabs (cbrt (- (* b_2 b_2) (* a c)))) (sqrt (cbrt (- (* b_2 b_2) (* a c))))) b_2)
1.4b
(- (* b_2 b_2) (* a c))

rewrite32.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
cbrt-prod
flip--
add-exp-log
add-cbrt-cube
flip3--
cbrt-div
pow1
pow1/3
sub-neg
diff-log
Counts
4 → 49
Calls
4 calls:
Slowest
20.0ms
(- (* (fabs (cbrt (- (* b_2 b_2) (* a c)))) (sqrt (cbrt (- (* b_2 b_2) (* a c))))) b_2)
5.0ms
(- (* b_2 b_2) (* a c))
3.0ms
(cbrt (- (* b_2 b_2) (* a c)))
3.0ms
(cbrt (- (* b_2 b_2) (* a c)))

series478.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
154.0ms
(cbrt (- (* b_2 b_2) (* a c)))
154.0ms
(cbrt (- (* b_2 b_2) (* a c)))
127.0ms
(- (* (fabs (cbrt (- (* b_2 b_2) (* a c)))) (sqrt (cbrt (- (* b_2 b_2) (* a c))))) b_2)
42.0ms
(- (* b_2 b_2) (* a c))

simplify2.5s

Counts
23 → 61
Calls
23 calls:
Slowest
405.0ms
(cbrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
401.0ms
(cbrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
380.0ms
(- (* (exp (* 1/6 (+ (log a) (+ (log -1) (log c))))) (fabs (pow (- (pow b_2 2) (* a c)) 1/3))) (+ b_2 (* 1/6 (* (exp (* 1/6 (- (log -1) (+ (* 5 (log a)) (* 5 (log c)))))) (* (pow b_2 2) (fabs (pow (- (pow b_2 2) (* a c)) 1/3)))))))
345.0ms
(cbrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
339.0ms
(cbrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune1.3s

Pruning

9 alts after pruning (6 fresh and 3 done)

Merged error: 4.7b

regimes625.0ms

Accuracy

84.6% (4.3b remaining)

Error of 9.5b against oracle of 5.2b and baseline of 33.4b

bsearch346.0ms

end0.0ms

sample5.8s

Algorithm
intervals
Results
1.8s5856×body80valid
1.4s1063×body2560valid
948.0ms909×body1280valid
596.0ms2975×body80nan
384.0ms451×body640valid
184.0ms262×body320valid
132.0ms94×body5120valid
46.0ms119×body160valid