Average Error: 28.5 → 0.3
Time: 25.0s
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(\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b\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 28.5

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

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

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

    \[\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 times-frac0.6

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{1}{a}\right)}^{1}} \cdot {\left(\frac{c \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\right)}^{1}\]
  12. Applied pow-prod-down0.5

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

    \[\leadsto {\color{blue}{\left(\frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}\right)}}^{1}\]
  14. Using strategy rm
  15. Applied neg-sub00.3

    \[\leadsto {\left(\frac{c}{\color{blue}{\left(0 - b\right)} - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}\right)}^{1}\]
  16. Applied associate--l-0.3

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

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

Reproduce

herbie shell --seed 2019016 
(FPCore (a b c d)
  :name "Cubic critical, 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) (* (* 3 a) c)))) (* 3 a)))

Details

Time bar (total: 23.8s)Debug log

sample182.0ms

Algorithm
intervals
Results
522×(pre true 80)
266×(body nan 80)
134×(body real 160)
122×(body real 80)

simplify60.0ms

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

prune14.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 28.2b

localize24.0ms

Local error

Found 4 expressions with local error:

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

rewrite32.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
22.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))

series200.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
72.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
69.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
40.0ms
(- (* b b) (* (* 3 a) c))
18.0ms
(* (* 3 a) c)

simplify1.7s

Counts
30 → 70
Calls
30 calls:
Slowest
261.0ms
(+ (pow (- b) 3) (pow (sqrt (- (* b b) (* (* 3 a) c))) 3))
242.0ms
(- (* (- b) (- b)) (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))))
134.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)))
104.0ms
(- (log (+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (log (* 3 a)))
83.0ms
(- (* 3/2 (/ (* a c) b)) (* 2 b))

prune874.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.5b

localize16.0ms

Local error

Found 4 expressions with local error:

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

rewrite29.0ms

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

series317.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
157.0ms
(/ (* 3 (* c a)) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
103.0ms
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
42.0ms
(- (* b b) (* (* 3 a) c))
15.0ms
(* 3 (* c a))

simplify6.3s

Counts
37 → 76
Calls
37 calls:
Slowest
2.2s
(/ (* (* (* 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)))))))
432.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
340.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
206.0ms
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))

prune897.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

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

rewrite53.0ms

Algorithm
rewrite-expression-head
Rules
21×add-sqr-sqrt
15×*-un-lft-identity
12×associate-*r*
12×times-frac
11×add-exp-log
11×add-cbrt-cube
add-cube-cbrt
difference-of-squares
add-log-exp
associate-/r*
pow1
associate-*l*
associate-/r/
distribute-lft-out--
flip--
div-inv
sqrt-prod
flip3--
cbrt-unprod
*-commutative
prod-exp
div-exp
cbrt-undiv
associate-/l*
associate-*r/
associate-*l/
pow-prod-down
diff-log
frac-2neg
sub-neg
clear-num
frac-times
Counts
4 → 80
Calls
4 calls:
Slowest
23.0ms
(* (/ 1 a) (/ (* c a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
20.0ms
(/ (* c a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
4.0ms
(* (* 3 a) c)
4.0ms
(- (* b b) (* (* 3 a) c))

series325.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
143.0ms
(/ (* c a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
131.0ms
(* (/ 1 a) (/ (* c a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
33.0ms
(- (* b b) (* (* 3 a) c))
18.0ms
(* (* 3 a) c)

simplify4.0s

Counts
58 → 92
Calls
58 calls:
Slowest
401.0ms
(* (/ 1 a) (/ (* c a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
383.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
339.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
321.0ms
(+ (log (/ 1 a)) (- (log (* c a)) (log (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))))
234.0ms
(* 1 (/ (* c a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))

prune1.1s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize18.0ms

Local error

Found 4 expressions with local error:

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

rewrite20.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-*r*
frac-2neg
clear-num
neg-sub0
associate--l-
Counts
4 → 55
Calls
4 calls:
Slowest
11.0ms
(- (- b) (sqrt (- (* b b) (* c (* 3 a)))))
4.0ms
(/ c (- (- b) (sqrt (- (* b b) (* c (* 3 a))))))
2.0ms
(- (* b b) (* c (* 3 a)))
1.0ms
(* c (* 3 a))

series261.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
129.0ms
(/ c (- (- b) (sqrt (- (* b b) (* c (* 3 a))))))
73.0ms
(- (- b) (sqrt (- (* b b) (* c (* 3 a)))))
42.0ms
(- (* b b) (* c (* 3 a)))
17.0ms
(* c (* 3 a))

simplify1.3s

Counts
27 → 67
Calls
27 calls:
Slowest
411.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* c (* 3 a)))) (sqrt (- (* b b) (* c (* 3 a))))) (* (- b) (sqrt (- (* b b) (* c (* 3 a)))))))
73.0ms
(/ (exp (* b b)) (exp (* c (* 3 a))))
60.0ms
(- (* 3/2 (/ (* a c) b)) (* 2 b))
56.0ms
(- (sqrt (- b)) (sqrt (sqrt (- (* b b) (* c (* 3 a))))))
55.0ms
(- (sqrt (- b)) (sqrt (sqrt (- (* b b) (* c (* 3 a))))))

prune749.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

regimes276.0ms

Accuracy

0% (0.2b remaining)

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

bsearch3.0ms

end0.0ms

sample5.1s

Algorithm
intervals
Results
16358×(pre true 80)
8357×(body nan 80)
4453×(body real 160)
3548×(body real 80)