Average Error: 52.6 → 0.1
Time: 19.5s
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{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} + b}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 52.6

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  2. Simplified52.6

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

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

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

    \[\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) + \left(b \cdot b\right))_*} + b\right)}\]
  7. Using strategy rm
  8. Applied times-frac0.5

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019010 +o rules:numerics
(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: 18.5s)Debug log

sample217.0ms

Algorithm
intervals

simplify94.0ms

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

prune13.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 52.1b

localize23.0ms

Local error

Found 4 expressions with local error:

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

rewrite35.0ms

Algorithm
rewrite-expression-head
Rules
10×add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
sqrt-prod
add-exp-log
fma-neg
add-cbrt-cube
add-log-exp
log1p-expm1-u
pow1
expm1-log1p-u
associate-/l*
times-frac
associate-/l/
flip--
flip3--
div-inv
fma-udef
div-exp
div-sub
pow1/2
frac-2neg
sub-neg
associate-/r*
clear-num
rem-sqrt-square
cbrt-undiv
Counts
4 → 67
Calls
4 calls:
Slowest
21.0ms
(/ (- (sqrt (fma -3 (* c a) (* b b))) b) (* 3 a))
10.0ms
(- (sqrt (fma -3 (* c a) (* b b))) b)
2.0ms
(sqrt (fma -3 (* c a) (* b b)))
0.0ms
(fma -3 (* c a) (* b b))

series198.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
62.0ms
(- (sqrt (fma -3 (* c a) (* b b))) b)
50.0ms
(/ (- (sqrt (fma -3 (* c a) (* b b))) b) (* 3 a))
47.0ms
(sqrt (fma -3 (* c a) (* b b)))
39.0ms
(fma -3 (* c a) (* b b))

simplify1.3s

Counts
34 → 79
Calls
34 calls:
Slowest
653.0ms
(- (* (sqrt (fma -3 (* c a) (* b b))) (sqrt (fma -3 (* c a) (* b b)))) (* b b))
148.0ms
(- (pow (sqrt (fma -3 (* c a) (* b b))) 3) (pow b 3))
76.0ms
(- (log (- (sqrt (fma -3 (* c a) (* b b))) b)) (log (* 3 a)))
59.0ms
(/ (* (* (- (sqrt (fma -3 (* c a) (* b b))) b) (- (sqrt (fma -3 (* c a) (* b b))) b)) (- (sqrt (fma -3 (* c a) (* b b))) b)) (* (* (* 3 a) (* 3 a)) (* 3 a)))
34.0ms
(- (pow b 2) (* 3 (* a c)))

prune916.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.5b

localize29.0ms

Local error

Found 4 expressions with local error:

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

rewrite47.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
log1p-expm1-u
associate-*r/
expm1-log1p-u
associate-*r*
flip-+
cbrt-unprod
*-commutative
associate-/r/
prod-exp
associate-*l*
div-exp
flip3-+
cbrt-undiv
associate-/l*
div-inv
fma-udef
pow-prod-down
times-frac
distribute-lft-in
frac-2neg
associate-/r*
clear-num
distribute-rgt-in
Counts
4 → 63
Calls
4 calls:
Slowest
23.0ms
(/ (* (* a c) -3) (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b)))
17.0ms
(* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))
5.0ms
(* (* a c) -3)
0.0ms
(fma -3 (* c a) (* b b))

series327.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
150.0ms
(/ (* (* a c) -3) (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b)))
125.0ms
(* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))
34.0ms
(fma -3 (* c a) (* b b))
18.0ms
(* (* a c) -3)

simplify3.1s

Counts
32 → 75
Calls
32 calls:
Slowest
611.0ms
(/ (* (* (* (* a c) -3) (* (* a c) -3)) (* (* a c) -3)) (* (* (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b)) (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))) (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))))
573.0ms
(- (log (* (* a c) -3)) (+ (log (* 3 a)) (log (+ (sqrt (fma -3 (* c a) (* b b))) b))))
563.0ms
(/ (* (* (* (* a c) -3) (* (* a c) -3)) (* (* a c) -3)) (* (* (* (* 3 a) (* 3 a)) (* 3 a)) (* (* (+ (sqrt (fma -3 (* c a) (* b b))) b) (+ (sqrt (fma -3 (* c a) (* b b))) b)) (+ (sqrt (fma -3 (* c a) (* b b))) b))))
370.0ms
(- (log (* (* a c) -3)) (log (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))))
198.0ms
(+ (* (sqrt (fma -3 (* c a) (* b b))) (sqrt (fma -3 (* c a) (* b b)))) (- (* b b) (* (sqrt (fma -3 (* c a) (* b b))) b)))

prune981.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0b

localize19.0ms

Local error

Found 4 expressions with local error:

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

rewrite15.0ms

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

series298.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
152.0ms
(* (* 1/3 c) (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b)))
99.0ms
(/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b))
35.0ms
(fma -3 (* c a) (* b b))
11.0ms
(* 1/3 c)

simplify1.3s

Counts
27 → 70
Calls
27 calls:
Slowest
554.0ms
(* (* (* (* 1/3 c) (* 1/3 c)) (* 1/3 c)) (* (* (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b)) (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b))) (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b))))
202.0ms
(+ (* (sqrt (fma -3 (* c a) (* b b))) (sqrt (fma -3 (* c a) (* b b)))) (- (* b b) (* (sqrt (fma -3 (* c a) (* b b))) b)))
175.0ms
(+ (* (sqrt (fma -3 (* c a) (* b b))) (sqrt (fma -3 (* c a) (* b b)))) (- (* b b) (* (sqrt (fma -3 (* c a) (* b b))) b)))
104.0ms
(+ (log (* 1/3 c)) (log (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b))))
45.0ms
(* (* 1/3 c) (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b)))

prune823.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0b

localize12.0ms

Local error

Found 4 expressions with local error:

0.1b
(/ (- c) (+ b (sqrt (fma -3 (* c a) (* b b)))))
0.1b
(fma -3 (* c a) (* b b))
0.1b
(+ b (sqrt (fma -3 (* c a) (* b b))))
0.1b
(sqrt (fma -3 (* c a) (* b b)))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
15×add-sqr-sqrt
14×add-cube-cbrt
14×*-un-lft-identity
12×times-frac
add-exp-log
add-cbrt-cube
add-log-exp
associate-/l*
log1p-expm1-u
neg-mul-1
pow1
expm1-log1p-u
sqrt-prod
associate-/r*
flip-+
associate-/r/
flip3-+
div-inv
fma-udef
distribute-frac-neg
div-exp
div-sub
pow1/2
frac-2neg
clear-num
rem-sqrt-square
+-commutative
cbrt-undiv
neg-sub0
Counts
4 → 73
Calls
4 calls:
Slowest
4.0ms
(/ (- c) (+ b (sqrt (fma -3 (* c a) (* b b)))))
1.0ms
(+ b (sqrt (fma -3 (* c a) (* b b))))
1.0ms
(sqrt (fma -3 (* c a) (* b b)))
0.0ms
(fma -3 (* c a) (* b b))

series275.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
127.0ms
(/ (- c) (+ b (sqrt (fma -3 (* c a) (* b b)))))
64.0ms
(+ b (sqrt (fma -3 (* c a) (* b b))))
51.0ms
(sqrt (fma -3 (* c a) (* b b)))
31.0ms
(fma -3 (* c a) (* b b))

simplify1.3s

Counts
51 → 85
Calls
51 calls:
Slowest
318.0ms
(/ (* (* (- c) (- c)) (- c)) (* (* (+ b (sqrt (fma -3 (* c a) (* b b)))) (+ b (sqrt (fma -3 (* c a) (* b b))))) (+ b (sqrt (fma -3 (* c a) (* b b))))))
133.0ms
(- (* 2 b) (* 3/2 (/ (* a c) b)))
109.0ms
(+ (* b b) (- (* (sqrt (fma -3 (* c a) (* b b))) (sqrt (fma -3 (* c a) (* b b)))) (* b (sqrt (fma -3 (* c a) (* b b))))))
41.0ms
(* 3/2 (/ (* a c) b))
40.0ms
(/ (* (cbrt (- c)) (cbrt (- c))) (* (cbrt (+ b (sqrt (fma -3 (* c a) (* b b))))) (cbrt (+ b (sqrt (fma -3 (* c a) (* b b)))))))

prune961.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0b

regimes223.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample6.1s

Algorithm
intervals