Average Error: 6.8 → 0.2
Time: 29.6s
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 - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\]

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. Using strategy rm
  3. Applied difference-of-squares6.8

    \[\leadsto \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  4. Applied associate-*l*0.2

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

    \[\leadsto \left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\]

Reproduce

herbie shell --seed 2018360 
(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: 25.6s)Debug log

start60.0ms

Algorithm
intervals

setup440.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 7.1b

localize30.0ms

Local error

Found 4 expressions with local error:

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

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

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

series123.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

58.0ms
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
34.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)
20.0ms
(+ (* x.re x.im) (* x.im x.re))
11.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

simplify3.5s

Counts
31 → 65
Calls

31 calls. Slowest were:

446.0ms
(* (+ (* x.re x.re) (* x.im x.im)) (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re)))))
361.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)
329.0ms
(* (- (pow (* x.re x.re) 3) (pow (* x.im x.im) 3)) x.im)

prune633.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

localize29.0ms

Local error

Found 4 expressions with local error:

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

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

12.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
9.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
4.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

series126.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

51.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
39.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
19.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
17.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify11.3s

Counts
67 → 86
Calls

67 calls. Slowest were:

502.0ms
(+ (* (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.im)) (- (* x.re x.im) (* x.im x.re))) (* (* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (+ x.re x.im)) (* (- (* (* x.re x.im) (* x.re x.im)) (* (* x.im x.re) (* x.im x.re))) x.re)))
429.0ms
(* (* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (+ x.re x.im)) (- (* x.re x.im) (* x.im x.re)))
388.0ms
(* (- (* x.re x.re) (* x.im x.im)) (* (- (pow x.re 3) (pow x.im 3)) x.im))

prune1.0s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0.0b

localize44.0ms

Local error

Found 4 expressions with local error:

12.3b
(cbrt (+ (* x.re x.im) (* x.im x.re)))
12.3b
(cbrt (* x.re (+ x.im x.im)))
12.3b
(cbrt (* x.re (+ x.im x.im)))
0.5b
(* (cbrt (* x.re (+ x.im x.im))) (cbrt (* x.re (+ x.im x.im))))

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 67
Calls

4 calls. Slowest were:

12.0ms
(* (cbrt (* x.re (+ x.im x.im))) (cbrt (* x.re (+ x.im x.im))))
2.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
2.0ms
(cbrt (* x.re (+ x.im x.im)))

series534.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

161.0ms
(* (cbrt (* x.re (+ x.im x.im))) (cbrt (* x.re (+ x.im x.im))))
130.0ms
(cbrt (* x.re (+ x.im x.im)))
129.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
115.0ms
(cbrt (* x.re (+ x.im x.im)))

simplify3.7s

Counts
51 → 79
Calls

51 calls. Slowest were:

373.0ms
(* (* x.re (+ x.im x.im)) (* x.re (+ x.im x.im)))
332.0ms
(* (* x.re (+ x.im x.im)) (* x.re (+ x.im x.im)))
326.0ms
(* (exp (* -1/3 (+ (* 2 (log (/ -1 x.re))) (* 2 (log (/ -1 x.im)))))) (pow (cbrt 2) 2))

prune1.1s

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

12.3b
(cbrt (* x.re x.im))
12.3b
(cbrt (* x.re (+ x.im x.im)))
12.3b
(cbrt (* x.re (+ x.im x.im)))
1.0b
(cbrt 2)

rewrite2.0ms

Algorithm
rewrite-expression-head
Counts
4 → 39
Calls

4 calls. Slowest were:

1.0ms
(cbrt (* x.re (+ x.im x.im)))
1.0ms
(cbrt (* x.re (+ x.im x.im)))
0.0ms
(cbrt (* x.re x.im))

series338.0ms

Counts
4 → 10
Calls

4 calls. Slowest were:

137.0ms
(cbrt (* x.re (+ x.im x.im)))
121.0ms
(cbrt (* x.re (+ x.im x.im)))
79.0ms
(cbrt (* x.re x.im))
0.0ms
(cbrt 2)

simplify1.7s

Counts
17 → 49
Calls

17 calls. Slowest were:

276.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (* (cbrt (* x.re (+ x.im x.im))) (cbrt (* x.re (+ x.im x.im)))) (* (* (cbrt 2) (cbrt (* x.re x.im))) x.re)))
265.0ms
(* (exp (* -1/3 (+ (log (/ -1 x.re)) (log (/ -1 x.im))))) (cbrt 2))
235.0ms
(* (exp (* -1/3 (+ (log (/ -1 x.re)) (log (/ -1 x.im))))) (cbrt 2))

prune748.0ms

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 0.0b

regimes143.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms