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

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 28.5

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

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

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

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

    \[\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 associate-/r*0.3

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

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

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

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

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

Reproduce

herbie shell --seed 2019010 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))

Details

Time bar (total: 31.2s)Debug log

sample186.0ms

Algorithm
intervals

simplify105.0ms

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

prune14.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 27.5b

localize26.0ms

Local error

Found 4 expressions with local error:

27.1b
(- (sqrt (- (* b b) (* (* c a) 4))) b)
0.3b
(/ (- (sqrt (- (* b b) (* (* c a) 4))) b) (* 2 a))
0.3b
(- (* b b) (* (* c a) 4))
0.1b
(sqrt (- (* b b) (* (* c a) 4)))

rewrite43.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
27.0ms
(/ (- (sqrt (- (* b b) (* (* c a) 4))) b) (* 2 a))
11.0ms
(- (sqrt (- (* b b) (* (* c a) 4))) b)
2.0ms
(- (* b b) (* (* c a) 4))
2.0ms
(sqrt (- (* b b) (* (* c a) 4)))

series205.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
72.0ms
(/ (- (sqrt (- (* b b) (* (* c a) 4))) b) (* 2 a))
57.0ms
(- (sqrt (- (* b b) (* (* c a) 4))) b)
52.0ms
(sqrt (- (* b b) (* (* c a) 4)))
25.0ms
(- (* b b) (* (* c a) 4))

simplify2.2s

Counts
32 → 71
Calls
32 calls:
Slowest
428.0ms
(sqrt (- (pow (* b b) 3) (pow (* (* c a) 4) 3)))
334.0ms
(- (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (* b b))
181.0ms
(- (pow (sqrt (- (* b b) (* (* c a) 4))) 3) (pow b 3))
171.0ms
(sqrt (- (* (* b b) (* b b)) (* (* (* c a) 4) (* (* c a) 4))))
142.0ms
(- b (* 2 (/ (* a c) b)))

prune744.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.3b

localize21.0ms

Local error

Found 4 expressions with local error:

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

rewrite77.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
(/ (* (* c -4) a) (* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
28.0ms
(* (* 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))

series345.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
162.0ms
(/ (* (* c -4) a) (* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
83.0ms
(* (* 2 a) (+ (sqrt (- (* b b) (* (* c a) 4))) b))
74.0ms
(+ (sqrt (- (* b b) (* (* c a) 4))) b)
26.0ms
(- (* b b) (* (* c a) 4))

simplify3.5s

Counts
33 → 72
Calls
33 calls:
Slowest
897.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))))
844.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))))
286.0ms
(+ (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (- (* b b) (* (sqrt (- (* b b) (* (* c a) 4))) b)))
253.0ms
(+ (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (- (* b b) (* (sqrt (- (* b b) (* (* c a) 4))) b)))
176.0ms
(- (log (* (* c -4) a)) (+ (log (* 2 a)) (log (+ (sqrt (- (* b b) (* (* c a) 4))) b))))

prune958.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 4 expressions with local error:

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

rewrite48.0ms

Algorithm
rewrite-expression-head
Rules
20×times-frac
14×add-cube-cbrt
14×*-un-lft-identity
14×add-sqr-sqrt
11×add-exp-log
11×add-cbrt-cube
add-log-exp
associate-/l*
div-inv
div-exp
associate-/r*
cbrt-undiv
pow1
flip-+
associate-/r/
flip3-+
frac-2neg
clear-num
associate-/l/
flip--
diff-log
flip3--
sub-neg
+-commutative
Counts
4 → 77
Calls
4 calls:
Slowest
28.0ms
(/ (/ (* (* c -4) a) (* 2 a)) (+ (sqrt (- (* b b) (* (* c a) 4))) b))
11.0ms
(+ (sqrt (- (* b b) (* (* c a) 4))) b)
5.0ms
(/ (* (* c -4) a) (* 2 a))
2.0ms
(- (* b b) (* (* c a) 4))

series242.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
148.0ms
(/ (/ (* (* c -4) a) (* 2 a)) (+ (sqrt (- (* b b) (* (* c a) 4))) b))
58.0ms
(+ (sqrt (- (* b b) (* (* c a) 4))) b)
27.0ms
(- (* b b) (* (* c a) 4))
8.0ms
(/ (* (* c -4) a) (* 2 a))

simplify14.1s

Counts
62 → 89
Calls
62 calls:
Slowest
1.1s
(/ (/ (* (* c -4) a) (* 2 a)) (sqrt (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
1.1s
(/ (sqrt (/ (* (* c -4) a) (* 2 a))) 1)
995.0ms
(/ (/ (* (* c -4) a) (* 2 a)) (cbrt (+ (sqrt (- (* b b) (* (* c a) 4))) b)))
971.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)))
858.0ms
(/ (/ (* (* c -4) a) (* 2 a)) (+ (sqrt (- (* b b) (* (* c a) 4))) b))

prune1.0s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0b

localize6.0ms

Local error

Found 4 expressions with local error:

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

rewrite29.0ms

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

series234.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
112.0ms
(/ (* -2 c) (+ (sqrt (- (* b b) (* (* c a) 4))) b))
54.0ms
(sqrt (- (* b b) (* (* c a) 4)))
43.0ms
(+ (sqrt (- (* b b) (* (* c a) 4))) b)
25.0ms
(- (* b b) (* (* c a) 4))

simplify1.9s

Counts
32 → 69
Calls
32 calls:
Slowest
361.0ms
(sqrt (- (pow (* b b) 3) (pow (* (* c a) 4) 3)))
289.0ms
(+ (* (sqrt (- (* b b) (* (* c a) 4))) (sqrt (- (* b b) (* (* c a) 4)))) (- (* b b) (* (sqrt (- (* b b) (* (* c a) 4))) b)))
190.0ms
(sqrt (- (* (* b b) (* b b)) (* (* (* c a) 4) (* (* c a) 4))))
127.0ms
(- b (* 2 (/ (* a c) b)))
90.0ms
(- (* 2 b) (* 2 (/ (* a c) b)))

prune689.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

regimes205.0ms

Accuracy

0% (0.3b remaining)

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

bsearch3.0ms

end0.0ms

sample4.4s

Algorithm
intervals