Average Error: 6.5 → 0.2
Time: 40.9s
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.5
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.5

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

    \[\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 2019002 
(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: 39.9s)Debug log

sample117.0ms

Algorithm
intervals

simplify216.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune11.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 5.0b

localize29.0ms

Local error

Found 4 expressions with local error:

5.1b
(* (- (* 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:

6.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.im) (* x.im x.re)) x.re)
4.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)

series124.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

48.0ms
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
45.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)
19.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
12.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify6.6s

Counts
31 → 65
Calls

31 calls. Slowest were:

2.8s
(* (exp (* (- (* x.re x.re) (* x.im x.im)) x.im)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
532.0ms
(* (+ (* (* x.re x.re) (* x.re x.re)) (+ (* (* x.im x.im) (* x.im x.im)) (* (* x.re x.re) (* x.im x.im)))) (- (* x.re x.im) (* x.im x.re)))
498.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)

prune663.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

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

rewrite53.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

22.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
15.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
9.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

series143.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

58.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
43.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
22.0ms
(+ (* x.re x.im) (* x.im x.re))
20.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

simplify14.1s

Counts
67 → 86
Calls

67 calls. Slowest were:

708.0ms
(+ (* (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im 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))))) (* (* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (+ x.re x.im)) (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)))
695.0ms
(* (- x.re 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)))))
676.0ms
(* (+ x.re 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)))))

prune854.0ms

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

26.7b
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))
26.7b
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))
26.7b
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))
0.4b
(* (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re)) (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re)))

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

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

series577.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

194.0ms
(* (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re)) (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
146.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))
125.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))
113.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))

simplify8.9s

Counts
49 → 77
Calls

49 calls. Slowest were:

784.0ms
(* (cbrt (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))) (cbrt (- (* x.re x.im) (* x.im x.re))))
727.0ms
(* (cbrt (- (* x.re x.im) (* x.im x.re))) (cbrt (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))))
707.0ms
(* (cbrt (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))) (cbrt (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))))

prune897.0ms

Pruning

10 alts after pruning (8 fresh and 2 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

26.7b
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))
26.7b
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))
14.1b
(cbrt (* (+ x.im x.im) x.re))
0.6b
(cbrt x.re)

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
4 → 41
Calls

4 calls. Slowest were:

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

series702.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

319.0ms
(cbrt x.re)
146.0ms
(cbrt (* (+ x.im x.im) x.re))
129.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))
109.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.re))

simplify2.5s

Counts
21 → 53
Calls

21 calls. Slowest were:

456.0ms
(cbrt (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re))
379.0ms
(cbrt (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re))
208.0ms
(* (cbrt 2) (exp (* -1/3 (+ (log (/ 1 x.im)) (* 2 (log (/ 1 x.re)))))))

prune588.0ms

Pruning

10 alts after pruning (8 fresh and 2 done)

Merged error: 0.0b

regimes111.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms

end0.0ms

sample2.6s

Algorithm
intervals