Average Error: 52.2 → 0.1
Time: 20.9s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{c}{\left(-b\right) - \sqrt{\frac{{\left(b \cdot b\right)}^{3} - {\left(\left(a \cdot 3\right) \cdot c\right)}^{3}}{\left(b \cdot b\right) \cdot \left(b \cdot b\right) + \left(\left(\left(a \cdot 3\right) \cdot c\right) \cdot \left(\left(a \cdot 3\right) \cdot c\right) + \left(\left(a \cdot 3\right) \cdot c\right) \cdot \left(b \cdot b\right)\right)}}}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 52.2

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  2. Using strategy rm
  3. Applied flip-+52.2

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
  5. Simplified0.5

    \[\leadsto \frac{\color{blue}{3 \cdot \left(c \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
  6. Using strategy rm
  7. Applied associate-/r*0.4

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

    \[\leadsto \frac{\color{blue}{c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\]
  9. Using strategy rm
  10. Applied flip3--0.1

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

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

Reproduce

herbie shell --seed 2019022 
(FPCore (a b c d)
  :name "Cubic critical, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))

Details

Time bar (total: 20.1s)Debug log

sample180.0ms

Algorithm
intervals
Results
49.0ms276×body80nan
43.0ms117×body320valid
29.0ms532×pre80true
22.0ms90×body160valid
6.0ms12×body640valid
4.0ms37×body80valid

simplify95.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
95.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 50.6b

localize20.0ms

Local error

Found 4 expressions with local error:

25.4b
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
0.2b
(* (* 3 a) c)
0.2b
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
0.0b
(- (* b b) (* (* 3 a) c))

rewrite29.0ms

Algorithm
rewrite-expression-head
Rules
12×*-un-lft-identity
add-log-exp
add-cube-cbrt
add-exp-log
add-cbrt-cube
add-sqr-sqrt
associate-/l*
times-frac
pow1
distribute-lft-out
associate-/l/
flip-+
associate-+l-
flip3-+
neg-sub0
flip--
div-inv
*-commutative
associate-*l*
div-exp
div-sub
diff-log
flip3--
frac-2neg
sub-neg
sum-log
associate-/r*
clear-num
+-commutative
cbrt-undiv
Counts
4 → 58
Calls
4 calls:
Slowest
20.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
5.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
2.0ms
(* (* 3 a) c)
2.0ms
(- (* b b) (* (* 3 a) c))

series184.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
73.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
66.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
32.0ms
(- (* b b) (* (* 3 a) c))
12.0ms
(* (* 3 a) c)

simplify1.5s

Counts
30 → 70
Calls
30 calls:
Slowest
248.0ms
(+ (pow (- b) 3) (pow (sqrt (- (* b b) (* (* 3 a) c))) 3))
233.0ms
(- (* (- b) (- b)) (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))))
90.0ms
(/ (* (* (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (* (* (* 3 a) (* 3 a)) (* 3 a)))
81.0ms
(* (exp (- b)) (exp (sqrt (- (* b b) (* (* 3 a) c)))))
72.0ms
(- (* 3/2 (/ (* a c) b)) (* 2 b))

prune650.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

localize13.0ms

Local error

Found 4 expressions with local error:

0.4b
(/ (* 3 (* c a)) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
0.3b
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
0.3b
(* 3 (* c a))
0.2b
(* (* 3 a) c)

rewrite28.0ms

Algorithm
rewrite-expression-head
Rules
11×add-exp-log
11×add-cbrt-cube
add-sqr-sqrt
associate-*r*
*-un-lft-identity
pow1
add-cube-cbrt
add-log-exp
associate-*r/
*-commutative
difference-of-squares
flip--
cbrt-unprod
associate-/r/
prod-exp
associate-*l*
div-exp
flip3--
distribute-lft-in
sub-neg
cbrt-undiv
distribute-rgt-in
distribute-lft-out--
associate-/l*
div-inv
sqrt-prod
pow-prod-down
times-frac
frac-2neg
associate-/r*
clear-num
Counts
4 → 61
Calls
4 calls:
Slowest
13.0ms
(/ (* 3 (* c a)) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
11.0ms
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
2.0ms
(* (* 3 a) c)
1.0ms
(* 3 (* c a))

series202.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
108.0ms
(/ (* 3 (* c a)) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
59.0ms
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
18.0ms
(* (* 3 a) c)
16.0ms
(* 3 (* c a))

simplify5.7s

Counts
36 → 73
Calls
36 calls:
Slowest
1.9s
(/ (* (* (* 3 (* c a)) (* 3 (* c a))) (* 3 (* c a))) (* (* (* (* 3 a) (* 3 a)) (* 3 a)) (* (* (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))))
1.8s
(/ (* (* (* 3 (* c a)) (* 3 (* c a))) (* 3 (* c a))) (* (* (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))))
377.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
374.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
161.0ms
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))

prune797.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ (* 3 (* c a)) (* 3 a))
0.3b
(* 3 (* c a))
0.2b
(* (* 3 a) c)
0.1b
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))

rewrite24.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-log-exp
add-exp-log
add-cbrt-cube
*-un-lft-identity
add-cube-cbrt
pow1
difference-of-squares
*-commutative
distribute-lft-out--
associate-/l*
flip--
div-inv
sqrt-prod
associate-*l*
associate-*r*
div-exp
diff-log
flip3--
times-frac
frac-2neg
sub-neg
associate-/r*
clear-num
cbrt-undiv
neg-sub0
associate--l-
Counts
4 → 49
Calls
4 calls:
Slowest
11.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
7.0ms
(/ (* 3 (* c a)) (* 3 a))
4.0ms
(* (* 3 a) c)
2.0ms
(* 3 (* c a))

series87.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
54.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
13.0ms
(* (* 3 a) c)
12.0ms
(* 3 (* c a))
8.0ms
(/ (* 3 (* c a)) (* 3 a))

simplify1.5s

Counts
22 → 61
Calls
22 calls:
Slowest
986.0ms
(/ (* (* (* 3 (* c a)) (* 3 (* c a))) (* 3 (* c a))) (* (* (* 3 a) (* 3 a)) (* 3 a)))
184.0ms
(- (log (* 3 (* c a))) (log (* 3 a)))
49.0ms
(/ (exp (- b)) (exp (sqrt (- (* b b) (* (* 3 a) c)))))
49.0ms
(* -3/2 (/ (* a c) b))
41.0ms
(- (* 3/2 (/ (* a c) b)) (* 2 b))

prune726.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0b

localize7.0ms

Local error

Found 4 expressions with local error:

0.2b
(* (* 3 a) c)
0.1b
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
0.1b
(/ c (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
0.0b
(- (* b b) (* (* 3 a) c))

rewrite30.0ms

Algorithm
rewrite-expression-head
Rules
13×add-sqr-sqrt
*-un-lft-identity
add-log-exp
associate-/r*
add-cube-cbrt
difference-of-squares
add-exp-log
add-cbrt-cube
pow1
flip--
flip3--
distribute-lft-out--
sqrt-prod
associate-/r/
diff-log
sub-neg
div-inv
*-commutative
associate-*l*
frac-2neg
clear-num
neg-sub0
associate--l-
Counts
4 → 55
Calls
4 calls:
Slowest
11.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
9.0ms
(/ c (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
5.0ms
(* (* 3 a) c)
4.0ms
(- (* b b) (* (* 3 a) c))

series254.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
125.0ms
(/ c (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
70.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
41.0ms
(- (* b b) (* (* 3 a) c))
17.0ms
(* (* 3 a) c)

simplify1.2s

Counts
27 → 67
Calls
27 calls:
Slowest
384.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
78.0ms
(/ (exp (* b b)) (exp (* (* 3 a) c)))
76.0ms
(/ (exp (- b)) (exp (sqrt (- (* b b) (* (* 3 a) c)))))
56.0ms
(- (* 3/2 (/ (* a c) b)) (* 2 b))
51.0ms
(+ (sqrt (- b)) (sqrt (sqrt (- (* b b) (* (* 3 a) c)))))

prune704.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

regimes253.0ms

Accuracy

0% (0.1b remaining)

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

bsearch5.0ms

end0.0ms

sample5.9s

Algorithm
intervals
Results
1.5s3586×body320valid
1.4s8212×body80nan
886.0ms16212×pre80true
837.0ms2918×body160valid
538.0ms981×body80valid
260.0ms515×body640valid