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

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. Simplified28.5

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

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

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

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

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

    \[\leadsto \frac{a \cdot c}{\color{blue}{\left(\left(3 \cdot a\right) \cdot \left(\sqrt{-3 \cdot \left(c \cdot a\right) + b \cdot b} + b\right)\right) \cdot \frac{1}{-3}}}\]
  11. Applied times-frac0.6

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

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

    \[\leadsto \frac{\frac{1}{3}}{b + \sqrt{b \cdot b + -3 \cdot \left(c \cdot a\right)}} \cdot \color{blue}{\frac{c}{\frac{-1}{3}}}\]
  14. Using strategy rm
  15. Applied associate-*l/0.4

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

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

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

Reproduce

herbie shell --seed 2019010 
(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: 18.4s)Debug log

sample138.0ms

Algorithm
intervals

simplify69.0ms

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

prune39.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 27.4b

localize43.0ms

Local error

Found 4 expressions with local error:

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

rewrite54.0ms

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

series193.0ms

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

simplify1.2s

Counts
26 → 65
Calls
26 calls:
Slowest
622.0ms
(- (* (sqrt (+ (* -3 (* c a)) (* b b))) (sqrt (+ (* -3 (* c a)) (* b b)))) (* b b))
91.0ms
(- (pow (sqrt (+ (* -3 (* c a)) (* b b))) 3) (pow b 3))
90.0ms
(/ (* (* (- (sqrt (+ (* -3 (* c a)) (* b b))) b) (- (sqrt (+ (* -3 (* c a)) (* b b))) b)) (- (sqrt (+ (* -3 (* c a)) (* b b))) b)) (* (* (* 3 a) (* 3 a)) (* 3 a)))
52.0ms
(- (log (- (sqrt (+ (* -3 (* c a)) (* b b))) b)) (log (* 3 a)))
45.0ms
(- (pow b 2) (* 3 (* a c)))

prune705.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.6b

localize14.0ms

Local error

Found 4 expressions with local error:

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

rewrite62.0ms

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

series268.0ms

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

simplify3.3s

Counts
32 → 68
Calls
32 calls:
Slowest
911.0ms
(/ (* (* (* (* a c) -3) (* (* a c) -3)) (* (* a c) -3)) (* (* (* (* 3 a) (* 3 a)) (* 3 a)) (* (* (+ (sqrt (+ (* -3 (* c a)) (* b b))) b) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b))))
643.0ms
(/ (* (* (* (* a c) -3) (* (* a c) -3)) (* (* a c) -3)) (* (* (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b))) (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b))))
565.0ms
(- (log (* (* a c) -3)) (+ (log (* 3 a)) (log (+ (sqrt (+ (* -3 (* c a)) (* b b))) b))))
487.0ms
(- (log (* (* a c) -3)) (log (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b))))
132.0ms
(+ (* (sqrt (+ (* -3 (* c a)) (* b b))) (sqrt (+ (* -3 (* c a)) (* b b)))) (- (* b b) (* (sqrt (+ (* -3 (* c a)) (* b b))) b)))

prune660.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite36.0ms

Algorithm
rewrite-expression-head
Rules
add-exp-log
add-cbrt-cube
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
pow1
associate-*r*
times-frac
associate-/r*
div-inv
flip-+
*-commutative
associate-*r/
flip3-+
associate-/l*
cbrt-unprod
associate-/r/
prod-exp
pow-prod-down
associate-*l*
div-exp
distribute-lft-in
frac-2neg
sum-log
clear-num
+-commutative
cbrt-undiv
distribute-rgt-in
Counts
4 → 61
Calls
4 calls:
Slowest
20.0ms
(* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b))
8.0ms
(/ (* a c) (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3))
6.0ms
(+ (* -3 (* c a)) (* b b))
1.0ms
(* -3 (* c a))

series297.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
127.0ms
(/ (* a c) (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3))
102.0ms
(* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b))
50.0ms
(+ (* -3 (* c a)) (* b b))
18.0ms
(* -3 (* c a))

simplify2.4s

Counts
37 → 73
Calls
37 calls:
Slowest
270.0ms
(- (log (* a c)) (log (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3)))
263.0ms
(/ (* (* (* a c) (* a c)) (* a c)) (* (* (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3) (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3)) (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3)))
193.0ms
(/ a (* (cbrt (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3)) (cbrt (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3))))
151.0ms
(sqrt (/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3))
149.0ms
(/ (* (* 3 a) (+ (sqrt (+ (* -3 (* c a)) (* b b))) b)) -3)

prune890.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize18.0ms

Local error

Found 4 expressions with local error:

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

rewrite6.0ms

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

series183.0ms

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

simplify2.6s

Counts
31 → 70
Calls
31 calls:
Slowest
1.3s
(/ 1/3 (- (* b b) (* (sqrt (+ (* b b) (* -3 (* c a)))) (sqrt (+ (* b b) (* -3 (* c a)))))))
364.0ms
(* (* (* (/ 1/3 (+ b (sqrt (+ (* b b) (* -3 (* c a)))))) (/ 1/3 (+ b (sqrt (+ (* b b) (* -3 (* c a))))))) (/ 1/3 (+ b (sqrt (+ (* b b) (* -3 (* c a))))))) (* (* (/ c -1/3) (/ c -1/3)) (/ c -1/3)))
220.0ms
(+ (log (/ 1/3 (+ b (sqrt (+ (* b b) (* -3 (* c a))))))) (log (/ c -1/3)))
194.0ms
(+ (* b b) (- (* (sqrt (+ (* b b) (* -3 (* c a)))) (sqrt (+ (* b b) (* -3 (* c a))))) (* b (sqrt (+ (* b b) (* -3 (* c a)))))))
87.0ms
(/ 1/3 (+ (pow b 3) (pow (sqrt (+ (* b b) (* -3 (* c a)))) 3)))

prune831.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0b

regimes192.0ms

Accuracy

0% (0.2b remaining)

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

bsearch3.0ms

end0.0ms

sample4.3s

Algorithm
intervals