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

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 44.0

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

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

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

    \[\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 associate-/r*0.5

    \[\leadsto \color{blue}{\frac{\frac{\left(a \cdot c\right) \cdot -3}{3 \cdot a}}{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} + b}}\]
  9. Taylor expanded around -inf 0.2

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

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

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

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))

Details

Time bar (total: 27.6s)Debug log

sample198.0ms

Algorithm
intervals
Results
554×(pre true 80)
297×(body nan 80)
159×(body real 160)
54×(body real 80)
44×(body real 320)

simplify89.0ms

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

prune15.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 44.6b

localize25.0ms

Local error

Found 4 expressions with local error:

41.5b
(- (sqrt (fma -3 (* c a) (* b b))) b)
0.3b
(/ (- (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)))

rewrite17.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
10.0ms
(/ (- (sqrt (fma -3 (* c a) (* b b))) b) (* 3 a))
5.0ms
(- (sqrt (fma -3 (* c a) (* b b))) b)
1.0ms
(sqrt (fma -3 (* c a) (* b b)))
0.0ms
(fma -3 (* c a) (* b b))

series222.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
68.0ms
(- (sqrt (fma -3 (* c a) (* b b))) b)
59.0ms
(/ (- (sqrt (fma -3 (* c a) (* b b))) b) (* 3 a))
49.0ms
(sqrt (fma -3 (* c a) (* b b)))
46.0ms
(fma -3 (* c a) (* b b))

simplify1.4s

Counts
34 → 79
Calls
34 calls:
Slowest
741.0ms
(- (* (sqrt (fma -3 (* c a) (* b b))) (sqrt (fma -3 (* c a) (* b b)))) (* b b))
124.0ms
(- (pow (sqrt (fma -3 (* c a) (* b b))) 3) (pow b 3))
118.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)))
50.0ms
(- (log (- (sqrt (fma -3 (* c a) (* b b))) b)) (log (* 3 a)))
48.0ms
(- (pow b 2) (* 3 (* a c)))

prune783.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.5b

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

rewrite27.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
13.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)

series294.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
103.0ms
(/ (* (* a c) -3) (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b)))
96.0ms
(* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))
77.0ms
(+ (sqrt (fma -3 (* c a) (* b b))) b)
18.0ms
(* (* a c) -3)

simplify3.3s

Counts
37 → 83
Calls
37 calls:
Slowest
697.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))))
626.0ms
(- (log (* (* a c) -3)) (+ (log (* 3 a)) (log (+ (sqrt (fma -3 (* c a) (* b b))) b))))
616.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))))
399.0ms
(- (log (* (* a c) -3)) (log (* (* 3 a) (+ (sqrt (fma -3 (* c a) (* b b))) b))))
213.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)))

prune831.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 4 expressions with local error:

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

rewrite23.0ms

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

series190.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
114.0ms
(/ (/ (* (* a c) -3) (* 3 a)) (+ (sqrt (fma -3 (* c a) (* b b))) b))
58.0ms
(+ (sqrt (fma -3 (* c a) (* b b))) b)
11.0ms
(* (* a c) -3)
6.0ms
(/ (* (* a c) -3) (* 3 a))

simplify10.2s

Counts
66 → 100
Calls
66 calls:
Slowest
642.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)))
510.0ms
(/ (sqrt (/ (* (* a c) -3) (* 3 a))) (sqrt (+ (sqrt (fma -3 (* c a) (* b b))) b)))
458.0ms
(/ (* (* (* (* a c) -3) (* (* a c) -3)) (* (* a c) -3)) (* (* (* 3 a) (* 3 a)) (* 3 a)))
438.0ms
(* (cbrt (/ (* (* a c) -3) (* 3 a))) (cbrt (/ (* (* a c) -3) (* 3 a))))
436.0ms
(/ (sqrt (/ (* (* a c) -3) (* 3 a))) (* (cbrt (+ (sqrt (fma -3 (* c a) (* b b))) b)) (cbrt (+ (sqrt (fma -3 (* c a) (* b b))) b))))

prune1.2s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0b

localize6.0ms

Local error

Found 4 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Rules
17×add-sqr-sqrt
16×add-cube-cbrt
16×*-un-lft-identity
12×times-frac
sqrt-prod
add-exp-log
add-cbrt-cube
fma-def
add-log-exp
associate-/l*
log1p-expm1-u
neg-mul-1
pow1
expm1-log1p-u
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 → 79
Calls
4 calls:
Slowest
7.0ms
(/ (- c) (+ (sqrt (fma -3 (* c a) (* b b))) b))
4.0ms
(+ (sqrt (fma -3 (* c a) (* b b))) b)
1.0ms
(sqrt (fma -3 (* c a) (* b b)))
0.0ms
(fma -3 (* c a) (* b b))

series276.0ms

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

simplify1.5s

Counts
56 → 91
Calls
56 calls:
Slowest
377.0ms
(/ (* (* (- c) (- c)) (- c)) (* (* (+ (sqrt (fma -3 (* c a) (* b b))) b) (+ (sqrt (fma -3 (* c a) (* b b))) b)) (+ (sqrt (fma -3 (* c a) (* b b))) b)))
278.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)))
41.0ms
(- (pow b 2) (* 3 (* a c)))
39.0ms
(- (pow b 2) (* 3 (* a c)))
29.0ms
(/ (* (cbrt (- c)) (cbrt (- c))) (* (cbrt (+ (sqrt (fma -3 (* c a) (* b b))) b)) (cbrt (+ (sqrt (fma -3 (* c a) (* b b))) b))))

prune1.0s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0b

regimes218.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample5.7s

Algorithm
intervals
Results
16309×(pre true 80)
8309×(body nan 80)
4795×(body real 160)
1796×(body real 80)
1409×(body real 320)