Average Error: 6.7 → 0.2
Time: 12.4s
Precision: 64
Internal Precision: 128
\[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
\[\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 - {x.im}^{3}\]

Error

Bits error versus x.re

Bits error versus x.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.7
Target0.2
Herbie0.2
\[\left(x.re \cdot x.im\right) \cdot \left(2 \cdot x.re\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)\]

Derivation

  1. Initial program 6.7

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  2. Initial simplification6.7

    \[\leadsto (x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(\left(x.re \cdot x.re\right) \cdot \left(x.im + x.im\right)\right))_*\]
  3. Taylor expanded around -inf 6.6

    \[\leadsto \color{blue}{3 \cdot \left(x.im \cdot {x.re}^{2}\right) - {x.im}^{3}}\]
  4. Using strategy rm
  5. Applied unpow26.6

    \[\leadsto 3 \cdot \left(x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)}\right) - {x.im}^{3}\]
  6. Applied associate-*r*0.2

    \[\leadsto 3 \cdot \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot x.re\right)} - {x.im}^{3}\]
  7. Final simplification0.2

    \[\leadsto \left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 - {x.im}^{3}\]

Reproduce

herbie shell --seed 2018365 +o rules:numerics
(FPCore (x.re x.im)
  :name "math.cube on complex, imaginary part"

  :herbie-target
  (+ (* (* x.re x.im) (* 2 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))

  (+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))

Details

Time bar (total: 8.2s)Debug log

start88.0ms

Algorithm
intervals

setup255.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 7.1b

localize36.0ms

Local error

Found 3 expressions with local error:

8.2b
(* (* x.re x.re) (+ x.im x.im))
7.1b
(fma x.im (- (* x.re x.re) (* x.im x.im)) (* (* x.re x.re) (+ x.im x.im)))
0.0b
(- (* x.re x.re) (* x.im x.im))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
3 → 48
Calls

3 calls. Slowest were:

7.0ms
(* (* x.re x.re) (+ x.im x.im))
4.0ms
(- (* x.re x.re) (* x.im x.im))
0.0ms
(fma x.im (- (* x.re x.re) (* x.im x.im)) (* (* x.re x.re) (+ x.im x.im)))

series114.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

59.0ms
(fma x.im (- (* x.re x.re) (* x.im x.im)) (* (* x.re x.re) (+ x.im x.im)))
28.0ms
(- (* x.re x.re) (* x.im x.im))
27.0ms
(* (* x.re x.re) (+ x.im x.im))

simplify509.0ms

Counts
24 → 57
Calls

24 calls. Slowest were:

86.0ms
(* (* (* (* x.re x.re) (* x.re x.re)) (* x.re x.re)) (* (* (+ x.im x.im) (+ x.im x.im)) (+ x.im x.im)))
68.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
63.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))

prune605.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 7.0b

localize29.0ms

Local error

Found 3 expressions with local error:

8.2b
(* x.im (pow x.re 2))
0.2b
(* 3 (* x.im (pow x.re 2)))
0.0b
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
3 → 45
Calls

3 calls. Slowest were:

9.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
5.0ms
(* 3 (* x.im (pow x.re 2)))
3.0ms
(* x.im (pow x.re 2))

series107.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

50.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
30.0ms
(* 3 (* x.im (pow x.re 2)))
27.0ms
(* x.im (pow x.re 2))

simplify1.4s

Counts
24 → 54
Calls

24 calls. Slowest were:

282.0ms
(fma (- (cbrt (pow x.im 3))) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3))) (* (cbrt (pow x.im 3)) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3)))))
265.0ms
(fma 3 (* x.im (pow x.re 2)) (- (* (cbrt (pow x.im 3)) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3))))))
151.0ms
(/ (exp (* 3 (* x.im (pow x.re 2)))) (exp (pow x.im 3)))

prune638.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 3 expressions with local error:

0.2b
(* 3 (* (* x.im x.re) x.re))
0.2b
(* (* x.im x.re) x.re)
0.0b
(- (* 3 (* (* x.im x.re) x.re)) (pow x.im 3))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

6.0ms
(- (* 3 (* (* x.im x.re) x.re)) (pow x.im 3))
3.0ms
(* 3 (* (* x.im x.re) x.re))
2.0ms
(* (* x.im x.re) x.re)

series84.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

32.0ms
(- (* 3 (* (* x.im x.re) x.re)) (pow x.im 3))
26.0ms
(* (* x.im x.re) x.re)
26.0ms
(* 3 (* (* x.im x.re) x.re))

simplify1.4s

Counts
20 → 51
Calls

20 calls. Slowest were:

299.0ms
(fma (- (cbrt (pow x.im 3))) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3))) (* (cbrt (pow x.im 3)) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3)))))
209.0ms
(fma 3 (* (* x.im x.re) x.re) (- (* (cbrt (pow x.im 3)) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3))))))
152.0ms
(fma 3 (* (* x.im x.re) x.re) (- (* (pow x.im 3) 1)))

prune541.0ms

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 3 expressions with local error:

0.2b
(* 3 (* x.im x.re))
0.2b
(* (* 3 (* x.im x.re)) x.re)
0.0b
(- (* (* 3 (* x.im x.re)) x.re) (pow x.im 3))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

10.0ms
(- (* (* 3 (* x.im x.re)) x.re) (pow x.im 3))
3.0ms
(* (* 3 (* x.im x.re)) x.re)
1.0ms
(* 3 (* x.im x.re))

series97.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

45.0ms
(- (* (* 3 (* x.im x.re)) x.re) (pow x.im 3))
29.0ms
(* (* 3 (* x.im x.re)) x.re)
23.0ms
(* 3 (* x.im x.re))

simplify1.5s

Counts
21 → 51
Calls

21 calls. Slowest were:

301.0ms
(fma (- (cbrt (pow x.im 3))) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3))) (* (cbrt (pow x.im 3)) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3)))))
263.0ms
(fma (* 3 (* x.im x.re)) x.re (- (* (cbrt (pow x.im 3)) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3))))))
146.0ms
(fma (* 3 (* x.im x.re)) x.re (- (* (pow x.im 3) 1)))

prune589.0ms

Pruning

7 alts after pruning (4 fresh and 3 done)

Merged error: 0.0b

regimes92.0ms

Accuracy

0% (0.2b remaining)

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

bsearch1.0ms