Average Error: 6.8 → 0.2
Time: 10.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(\left(x.re \cdot x.im\right) \cdot 3\right) \cdot x.re - {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.8
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.8

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

    \[\leadsto \color{blue}{(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.8

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

    \[\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. Using strategy rm
  8. Applied associate-*r*0.2

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

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

Reproduce

herbie shell --seed 2019005 +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: 9.7s)Debug log

sample103.0ms

Algorithm
intervals

simplify204.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune9.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 5.5b

localize24.0ms

Local error

Found 3 expressions with local error:

6.3b
(* (* x.re x.re) (+ x.im x.im))
5.5b
(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))

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
3 → 48
Calls

3 calls. Slowest were:

3.0ms
(* (* x.re x.re) (+ x.im x.im))
2.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)))

series94.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

56.0ms
(fma x.im (- (* x.re x.re) (* x.im x.im)) (* (* x.re x.re) (+ x.im x.im)))
27.0ms
(- (* x.re x.re) (* x.im x.im))
11.0ms
(* (* x.re x.re) (+ x.im x.im))

simplify574.0ms

Counts
24 → 57
Calls

24 calls. Slowest were:

99.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
84.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
67.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)))

prune513.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 5.4b

localize19.0ms

Local error

Found 3 expressions with local error:

5.5b
(fma x.im (- (* x.re x.re) (* x.im x.im)) (* x.re (* x.re (+ x.im x.im))))
0.1b
(* x.re (* x.re (+ x.im x.im)))
0.0b
(- (* x.re x.re) (* x.im x.im))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 44
Calls

3 calls. Slowest were:

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

series79.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

39.0ms
(fma x.im (- (* x.re x.re) (* x.im x.im)) (* x.re (* x.re (+ x.im x.im))))
20.0ms
(- (* x.re x.re) (* x.im x.im))
20.0ms
(* x.re (* x.re (+ x.im x.im)))

simplify444.0ms

Counts
21 → 53
Calls

21 calls. Slowest were:

97.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
94.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
55.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))

prune534.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 5.4b

localize29.0ms

Local error

Found 3 expressions with local error:

6.3b
(* 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))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 45
Calls

3 calls. Slowest were:

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

series70.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

33.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
20.0ms
(* 3 (* x.im (pow x.re 2)))
16.0ms
(* x.im (pow x.re 2))

simplify1.3s

Counts
24 → 54
Calls

24 calls. Slowest were:

258.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)))))
229.0ms
(fma 3 (* x.im (pow x.re 2)) (- (* (cbrt (pow x.im 3)) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3))))))
116.0ms
(fma 3 (* x.im (pow x.re 2)) (- (* (pow x.im 3) 1)))

prune576.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 3 expressions with local error:

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

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

11.0ms
(- (* 3 (* (* x.im x.re) x.re)) (pow x.im 3))
7.0ms
(* 3 (* (* x.im x.re) x.re))
4.0ms
(* (* x.im x.re) x.re)

series81.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify1.3s

Counts
20 → 51
Calls

20 calls. Slowest were:

233.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)))))
190.0ms
(fma 3 (* (* x.im x.re) x.re) (- (* (cbrt (pow x.im 3)) (* (cbrt (pow x.im 3)) (cbrt (pow x.im 3))))))
137.0ms
(/ (exp (* 3 (* (* x.im x.re) x.re))) (exp (pow x.im 3)))

prune460.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

regimes98.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample3.2s

Algorithm
intervals