Average Error: 43.7 → 0.2
Time: 20.2s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{c \cdot -2}{b + \frac{\sqrt{{\left(\left(-4 \cdot c\right) \cdot a\right)}^{3} + {\left(b \cdot b\right)}^{3}}}{\sqrt{\left(\left(-4 \cdot c\right) \cdot a\right) \cdot \left(\left(-4 \cdot c\right) \cdot a\right) + \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(b \cdot b\right) \cdot \left(\left(-4 \cdot c\right) \cdot a\right)\right)}}}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 43.7

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Simplified43.7

    \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{2 \cdot a}}\]
  3. Using strategy rm
  4. Applied flip--43.7

    \[\leadsto \frac{\color{blue}{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b \cdot b}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}}}{2 \cdot a}\]
  5. Applied associate-/l/43.7

    \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b \cdot b}{\left(2 \cdot a\right) \cdot \left(\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b\right)}}\]
  6. Simplified0.4

    \[\leadsto \frac{\color{blue}{\left(c \cdot -4\right) \cdot a}}{\left(2 \cdot a\right) \cdot \left(\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b\right)}\]
  7. Using strategy rm
  8. Applied times-frac0.4

    \[\leadsto \color{blue}{\frac{c \cdot -4}{2 \cdot a} \cdot \frac{a}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}}\]
  9. Simplified0.4

    \[\leadsto \color{blue}{\frac{\frac{c}{\frac{-1}{2}}}{a}} \cdot \frac{a}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}\]
  10. Using strategy rm
  11. Applied pow10.4

    \[\leadsto \frac{\frac{c}{\frac{-1}{2}}}{a} \cdot \color{blue}{{\left(\frac{a}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}\right)}^{1}}\]
  12. Applied pow10.4

    \[\leadsto \color{blue}{{\left(\frac{\frac{c}{\frac{-1}{2}}}{a}\right)}^{1}} \cdot {\left(\frac{a}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}\right)}^{1}\]
  13. Applied pow-prod-down0.4

    \[\leadsto \color{blue}{{\left(\frac{\frac{c}{\frac{-1}{2}}}{a} \cdot \frac{a}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}\right)}^{1}}\]
  14. Simplified0.2

    \[\leadsto {\color{blue}{\left(\frac{c \cdot -2}{\sqrt{\left(c \cdot -4\right) \cdot a + b \cdot b} + b}\right)}}^{1}\]
  15. Using strategy rm
  16. Applied flip3-+0.2

    \[\leadsto {\left(\frac{c \cdot -2}{\sqrt{\color{blue}{\frac{{\left(\left(c \cdot -4\right) \cdot a\right)}^{3} + {\left(b \cdot b\right)}^{3}}{\left(\left(c \cdot -4\right) \cdot a\right) \cdot \left(\left(c \cdot -4\right) \cdot a\right) + \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(\left(c \cdot -4\right) \cdot a\right) \cdot \left(b \cdot b\right)\right)}}} + b}\right)}^{1}\]
  17. Applied sqrt-div0.2

    \[\leadsto {\left(\frac{c \cdot -2}{\color{blue}{\frac{\sqrt{{\left(\left(c \cdot -4\right) \cdot a\right)}^{3} + {\left(b \cdot b\right)}^{3}}}{\sqrt{\left(\left(c \cdot -4\right) \cdot a\right) \cdot \left(\left(c \cdot -4\right) \cdot a\right) + \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(\left(c \cdot -4\right) \cdot a\right) \cdot \left(b \cdot b\right)\right)}}} + b}\right)}^{1}\]
  18. Final simplification0.2

    \[\leadsto \frac{c \cdot -2}{b + \frac{\sqrt{{\left(\left(-4 \cdot c\right) \cdot a\right)}^{3} + {\left(b \cdot b\right)}^{3}}}{\sqrt{\left(\left(-4 \cdot c\right) \cdot a\right) \cdot \left(\left(-4 \cdot c\right) \cdot a\right) + \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(b \cdot b\right) \cdot \left(\left(-4 \cdot c\right) \cdot a\right)\right)}}}\]

Reproduce

herbie shell --seed 2019010 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))

Details

Time bar (total: 19.3s)Debug log

sample198.0ms

Algorithm
intervals

simplify61.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
61.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a))

prune20.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 45.2b

localize21.0ms

Local error

Found 4 expressions with local error:

39.6b
(- (sqrt (- (* b b) (* (* c a) 4))) b)
0.1b
(- (* b b) (* (* c a) 4))
0.1b
(/ (- (sqrt (- (* b b) (* (* c a) 4))) b) (* 2 a))
0.0b
(sqrt (- (* b b) (* (* c a) 4)))

rewrite65.0ms

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

series199.0ms

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

simplify2.1s

Counts
32 → 71
Calls
32 calls:
Slowest
367.0ms
(sqrt (- (pow (* b b) 3) (pow (* (* c a) 4) 3)))
343.0ms
(- (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (* b b))
199.0ms
(- (pow (sqrt (- (* b b) (* (* c a) 4))) 3) (pow b 3))
152.0ms
(- b (* 2 (/ (* a c) b)))
144.0ms
(sqrt (- (* (* b b) (* b b)) (* (* (* c a) 4) (* (* c a) 4))))

prune685.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.2b

localize26.0ms

Local error

Found 4 expressions with local error:

0.4b
(/ (* (* c -4) a) (* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
0.1b
(- (* b b) (* (* c a) 4))
0.1b
(* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b))
0.1b
(+ (sqrt (- (* b b) (* (* c a) 4))) b)

rewrite73.0ms

Algorithm
rewrite-expression-head
Rules
11×add-exp-log
11×add-cbrt-cube
add-log-exp
pow1
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-*r/
flip-+
associate-*r*
flip3-+
cbrt-unprod
associate-/r/
prod-exp
div-exp
cbrt-undiv
associate-/l*
flip--
div-inv
*-commutative
pow-prod-down
associate-*l*
diff-log
flip3--
times-frac
distribute-lft-in
frac-2neg
sub-neg
associate-/r*
clear-num
+-commutative
distribute-rgt-in
Counts
4 → 60
Calls
4 calls:
Slowest
29.0ms
(* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b))
23.0ms
(/ (* (* c -4) a) (* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
15.0ms
(+ (sqrt (- (* b b) (* (* c a) 4))) b)
4.0ms
(- (* b b) (* (* c a) 4))

series359.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
183.0ms
(/ (* (* c -4) a) (* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
95.0ms
(* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b))
55.0ms
(+ (sqrt (- (* b b) (* (* c a) 4))) b)
27.0ms
(- (* b b) (* (* c a) 4))

simplify3.6s

Counts
33 → 72
Calls
33 calls:
Slowest
958.0ms
(/ (* (* (* (* c -4) a) (* (* c -4) a)) (* (* c -4) a)) (* (* (* (* 2 a) (* 2 a)) (* 2 a)) (* (* (+ (sqrt (- (* b b) (* (* c a) 4))) b) (+ (sqrt (- (* b b) (* (* c a) 4))) b)) (+ (sqrt (- (* b b) (* (* c a) 4))) b))))
839.0ms
(/ (* (* (* (* c -4) a) (* (* c -4) a)) (* (* c -4) a)) (* (* (* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b)) (* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b))) (* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b))))
273.0ms
(+ (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (- (* b b) (* (sqrt (- (* b b) (* (* c a) 4))) b)))
263.0ms
(+ (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (- (* b b) (* (sqrt (- (* b b) (* (* c a) 4))) b)))
191.0ms
(- (log (* (* c -4) a)) (+ (log (* 2 a)) (log (+ (sqrt (- (* b b) (* (* c a) 4))) b))))

prune840.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize22.0ms

Local error

Found 4 expressions with local error:

0.4b
(* (/ (/ c -1/2) a) (/ a (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
0.1b
(- (* b b) (* (* c a) 4))
0.1b
(/ a (+ (sqrt (- (* b b) (* (* c a) 4))) b))
0.1b
(+ (sqrt (- (* b b) (* (* c a) 4))) b)

rewrite41.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
associate-*r*
add-cbrt-cube
pow1
associate-/r/
associate-*l*
div-inv
flip-+
flip3-+
associate-/r*
flip--
cbrt-unprod
*-commutative
associate-*r/
prod-exp
associate-*l/
pow-prod-down
diff-log
flip3--
frac-2neg
sub-neg
clear-num
+-commutative
frac-times
Counts
4 → 61
Calls
4 calls:
Slowest
15.0ms
(+ (sqrt (- (* b b) (* (* c a) 4))) b)
11.0ms
(* (/ (/ c -1/2) a) (/ a (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
10.0ms
(/ a (+ (sqrt (- (* b b) (* (* c a) 4))) b))
4.0ms
(- (* b b) (* (* c a) 4))

series406.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
168.0ms
(/ a (+ (sqrt (- (* b b) (* (* c a) 4))) b))
141.0ms
(* (/ (/ c -1/2) a) (/ a (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
72.0ms
(+ (sqrt (- (* b b) (* (* c a) 4))) b)
25.0ms
(- (* b b) (* (* c a) 4))

simplify2.0s

Counts
34 → 73
Calls
34 calls:
Slowest
344.0ms
(+ (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (- (* b b) (* (sqrt (- (* b b) (* (* c a) 4))) b)))
254.0ms
(+ (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (- (* b b) (* (sqrt (- (* b b) (* (* c a) 4))) b)))
245.0ms
(* (/ (/ c -1/2) a) (/ a (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
115.0ms
(* (/ c -1/2) (/ a (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
115.0ms
(- (* 2 b) (* 2 (/ (* a c) b)))

prune790.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0b

localize32.0ms

Local error

Found 4 expressions with local error:

0.1b
(+ (* (* c -4) a) (* b b))
0.1b
(/ (* c -2) (+ (sqrt (+ (* (* c -4) a) (* b b))) b))
0.1b
(+ (sqrt (+ (* (* c -4) a) (* b b))) b)
0.0b
(sqrt (+ (* (* c -4) a) (* b b)))

rewrite34.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
add-log-exp
add-exp-log
add-cbrt-cube
flip-+
flip3-+
pow1
sqrt-prod
times-frac
associate-/r*
associate-/r/
sqrt-div
+-commutative
associate-/l*
div-inv
div-exp
pow1/2
frac-2neg
sum-log
clear-num
rem-sqrt-square
cbrt-undiv
Counts
4 → 56
Calls
4 calls:
Slowest
16.0ms
(/ (* c -2) (+ (sqrt (+ (* (* c -4) a) (* b b))) b))
10.0ms
(+ (sqrt (+ (* (* c -4) a) (* b b))) b)
4.0ms
(+ (* (* c -4) a) (* b b))
3.0ms
(sqrt (+ (* (* c -4) a) (* b b)))

series307.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
137.0ms
(/ (* c -2) (+ (sqrt (+ (* (* c -4) a) (* b b))) b))
73.0ms
(+ (sqrt (+ (* (* c -4) a) (* b b))) b)
56.0ms
(sqrt (+ (* (* c -4) a) (* b b)))
42.0ms
(+ (* (* c -4) a) (* b b))

simplify1.0s

Counts
32 → 68
Calls
32 calls:
Slowest
199.0ms
(sqrt (+ (pow (* (* c -4) a) 3) (pow (* b b) 3)))
198.0ms
(sqrt (- (* (* (* c -4) a) (* (* c -4) a)) (* (* b b) (* b b))))
171.0ms
(+ (* (sqrt (+ (* (* c -4) a) (* b b))) (sqrt (+ (* (* c -4) a) (* b b)))) (- (* b b) (* (sqrt (+ (* (* c -4) a) (* b b))) b)))
97.0ms
(/ (* (* (* c -2) (* c -2)) (* c -2)) (* (* (+ (sqrt (+ (* (* c -4) a) (* b b))) b) (+ (sqrt (+ (* (* c -4) a) (* b b))) b)) (+ (sqrt (+ (* (* c -4) a) (* b b))) b)))
39.0ms
(- (log (* c -2)) (log (+ (sqrt (+ (* (* c -4) a) (* b b))) b)))

prune790.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

regimes265.0ms

Accuracy

0% (0.2b remaining)

Error of 0.2b against oracle of 0.0b and baseline of 0.2b

bsearch3.0ms

end0.0ms

sample5.3s

Algorithm
intervals