Average Error: 52.7 → 0.1
Time: 20.6s
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.7

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

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

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

    \[\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 2019016 +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: 19.7s)Debug log

sample202.0ms

Algorithm
intervals
Results
500×(pre true 80)
244×(body nan 80)
109×(body real 320)
102×(body real 160)
31×(body real 80)
14×(body real 640)

simplify64.0ms

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

prune22.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 51.5b

localize44.0ms

Local error

Found 4 expressions with local error:

27.8b
(- (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.0b
(sqrt (fma -3 (* c a) (* b b)))

rewrite34.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))

series207.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
62.0ms
(- (sqrt (fma -3 (* c a) (* b b))) b)
56.0ms
(sqrt (fma -3 (* c a) (* b b)))
51.0ms
(/ (- (sqrt (fma -3 (* c a) (* b b))) b) (* 3 a))
38.0ms
(fma -3 (* c a) (* b b))

simplify1.3s

Counts
34 → 79
Calls
34 calls:
Slowest
679.0ms
(- (* (sqrt (fma -3 (* c a) (* b b))) (sqrt (fma -3 (* c a) (* b b)))) (* b b))
114.0ms
(- (pow (sqrt (fma -3 (* c a) (* b b))) 3) (pow b 3))
94.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)))
77.0ms
(- (log (- (sqrt (fma -3 (* c a) (* b b))) b)) (log (* 3 a)))
36.0ms
(- (pow b 2) (* 3 (* a c)))

prune916.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.6b

localize32.0ms

Local error

Found 4 expressions with local error:

0.4b
(/ (* (* 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.3b
(* (* a c) -3)
0.1b
(+ (sqrt (fma -3 (* c a) (* b b))) b)

rewrite28.0ms

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

series260.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
100.0ms
(* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))
98.0ms
(/ (* (* a c) -3) (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b)))
46.0ms
(+ (sqrt (fma -3 (* c a) (* b b))) b)
16.0ms
(* (* a c) -3)

simplify3.5s

Counts
37 → 83
Calls
37 calls:
Slowest
852.0ms
(- (log (* (* a c) -3)) (+ (log (* 3 a)) (log (+ (sqrt (fma -3 (* c a) (* b b))) b))))
678.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))))
619.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))))
444.0ms
(- (log (* (* a c) -3)) (log (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))))
246.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)))

prune1.1s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

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

rewrite22.0ms

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

series377.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
163.0ms
(* (* 1/3 c) (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b)))
124.0ms
(/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b))
79.0ms
(+ (sqrt (fma -3 (* c a) (* b b))) b)
12.0ms
(* 1/3 c)

simplify1.3s

Counts
32 → 78
Calls
32 calls:
Slowest
497.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))))
231.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)))
226.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)))
118.0ms
(+ (log (* 1/3 c)) (log (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b))))
55.0ms
(* (* 1/3 c) (/ -3 (+ (sqrt (fma -3 (* c a) (* b b))) b)))

prune862.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0b

localize13.0ms

Local error

Found 4 expressions with local error:

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

rewrite11.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
8.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))

series257.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
121.0ms
(/ (- c) (+ b (sqrt (fma -3 (* c a) (* b b)))))
50.0ms
(sqrt (fma -3 (* c a) (* b b)))
43.0ms
(fma -3 (* c a) (* b b))
43.0ms
(+ b (sqrt (fma -3 (* c a) (* b b))))

simplify1.4s

Counts
51 → 85
Calls
51 calls:
Slowest
332.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))))))
183.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))))))
105.0ms
(- (* 2 b) (* 3/2 (/ (* a c) b)))
55.0ms
(* 3/2 (/ (* a c) b))
49.0ms
(/ (* (cbrt (- c)) (cbrt (- c))) (* (cbrt (+ b (sqrt (fma -3 (* c a) (* b b))))) (cbrt (+ b (sqrt (fma -3 (* c a) (* b b)))))))

prune1.1s

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0b

regimes234.0ms

Accuracy

0% (0.1b remaining)

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

bsearch3.0ms

end0.0ms

sample6.4s

Algorithm
intervals
Results
16163×(pre true 80)
8161×(body nan 80)
3597×(body real 320)
2974×(body real 160)
896×(body real 80)
535×(body real 640)