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

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.3
Herbie0.2
\[\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)\]

Derivation

  1. Initial program 6.7

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
  2. Using strategy rm
  3. Applied difference-of-squares6.7

    \[\leadsto \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)} \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
  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.re\right)} - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
  5. Final simplification0.2

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

Reproduce

herbie shell --seed 2019002 
(FPCore (x.re x.im)
  :name "math.cube on complex, real part"

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

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

Details

Time bar (total: 33.1s)Debug log

sample109.0ms

Algorithm
intervals

simplify267.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune18.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 8.6b

localize49.0ms

Local error

Found 4 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

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

series93.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

32.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
30.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
17.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
15.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify4.6s

Counts
31 → 66
Calls

31 calls. Slowest were:

576.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)
538.0ms
(/ (exp (* (- (* x.re x.re) (* x.im x.im)) x.re)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
440.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)))

prune743.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.1b

localize30.0ms

Local error

Found 4 expressions with local error:

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

rewrite54.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

24.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
15.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
8.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series97.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

38.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
30.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
17.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
12.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify15.8s

Counts
67 → 87
Calls

67 calls. Slowest were:

1.0s
(* (+ 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)))))
729.0ms
(- (* (* (- (* x.re x.re) (* x.im x.im)) (* (- (pow x.re 3) (pow x.im 3)) x.re)) (- (* x.re x.im) (* x.im x.re))) (* (* (- x.re x.im) (+ (* x.re x.re) (+ (* x.im x.im) (* x.re x.im)))) (* (- (* (* x.re x.im) (* x.re x.im)) (* (* x.im x.re) (* x.im x.re))) x.im)))
675.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)))))

prune884.0ms

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

localize22.0ms

Local error

Found 4 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 67
Calls

4 calls. Slowest were:

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

series555.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

156.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
150.0ms
(* (cbrt (* x.re (+ x.im x.im))) (cbrt (* x.re (+ x.im x.im))))
127.0ms
(cbrt (* x.re (+ x.im x.im)))
122.0ms
(cbrt (* x.re (+ x.im x.im)))

simplify3.1s

Counts
51 → 79
Calls

51 calls. Slowest were:

454.0ms
(* (* x.re (+ x.im x.im)) (* x.re (+ x.im x.im)))
386.0ms
(* (* x.re (+ x.im x.im)) (* x.re (+ x.im x.im)))
269.0ms
(cbrt (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)))

prune986.0ms

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 0.0b

localize23.0ms

Local error

Found 4 expressions with local error:

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

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
4 → 38
Calls

4 calls. Slowest were:

2.0ms
(cbrt (* x.re (+ x.im x.im)))
2.0ms
(cbrt (* x.re (+ x.im x.im)))
0.0ms
(cbrt 2)

series525.0ms

Counts
4 → 10
Calls

4 calls. Slowest were:

262.0ms
(cbrt x.re)
141.0ms
(cbrt (* x.re (+ x.im x.im)))
123.0ms
(cbrt (* x.re (+ x.im x.im)))
0.0ms
(cbrt 2)

simplify1.2s

Counts
16 → 48
Calls

16 calls. Slowest were:

458.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (* (cbrt (* x.re (+ x.im x.im))) (cbrt (* x.re (+ x.im x.im)))) (* (* (cbrt x.im) (* (cbrt x.re) (cbrt 2))) x.im)))
142.0ms
(* (exp (* -1/3 (+ (log (/ 1 x.im)) (log (/ 1 x.re))))) (cbrt 2))
132.0ms
(* (exp (* -1/3 (+ (log (/ -1 x.re)) (log (/ -1 x.im))))) (cbrt 2))

prune733.0ms

Pruning

12 alts after pruning (9 fresh and 3 done)

Merged error: 0.0b

regimes196.0ms

Accuracy

0% (0.2b remaining)

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

bsearch3.0ms

end0.0ms

sample2.9s

Algorithm
intervals