Average Error: 7.0 → 0.2
Time: 36.2s
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

Original7.0
Target0.2
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 7.0

    \[\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-squares7.0

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

sample90.0ms

Algorithm
intervals

simplify232.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune9.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 6.0b

localize34.0ms

Local error

Found 4 expressions with local error:

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

rewrite45.0ms

Algorithm
rewrite-expression-head
Counts
4 → 56
Calls

4 calls. Slowest were:

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

series120.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

43.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
41.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
19.0ms
(- (* x.re x.re) (* x.im x.im))
16.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

simplify4.7s

Counts
33 → 68
Calls

33 calls. Slowest were:

522.0ms
(* (+ (* x.re x.re) (* x.im x.im)) (- (* x.re x.im) (* x.im x.re)))
512.0ms
(/ (exp (* (- (* x.re x.re) (* x.im x.im)) x.re)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
483.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)))

prune695.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize28.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.re)

rewrite53.0ms

Algorithm
rewrite-expression-head
Counts
4 → 77
Calls

4 calls. Slowest were:

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

series147.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

47.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
44.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
29.0ms
(* (- x.re x.im) x.re)
27.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

simplify14.0s

Counts
70 → 89
Calls

70 calls. Slowest were:

656.0ms
(- (* (* (+ (pow x.re 3) (pow x.im 3)) (* (- (pow x.re 3) (pow x.im 3)) 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.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)))
621.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)))))
594.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)))))

prune995.0ms

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

8.8b
(cbrt (* (- x.re x.im) x.re))
8.8b
(cbrt (* (- x.re x.im) x.re))
8.8b
(cbrt (* (- x.re x.im) x.re))
0.5b
(* (cbrt (* (- x.re x.im) x.re)) (cbrt (* (- x.re x.im) x.re)))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

9.0ms
(* (cbrt (* (- x.re x.im) x.re)) (cbrt (* (- x.re x.im) x.re)))
2.0ms
(cbrt (* (- x.re x.im) x.re))
1.0ms
(cbrt (* (- x.re x.im) x.re))

series1.2s

Counts
4 → 12
Calls

4 calls. Slowest were:

318.0ms
(* (cbrt (* (- x.re x.im) x.re)) (cbrt (* (- x.re x.im) x.re)))
312.0ms
(cbrt (* (- x.re x.im) x.re))
283.0ms
(cbrt (* (- x.re x.im) x.re))
256.0ms
(cbrt (* (- x.re x.im) x.re))

simplify4.1s

Counts
49 → 77
Calls

49 calls. Slowest were:

367.0ms
(* (cbrt (* (- (* x.re x.re) (* x.im x.im)) x.re)) (cbrt (* (- (pow x.re 3) (pow x.im 3)) x.re)))
287.0ms
(* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x.re)))))))
286.0ms
(* (cbrt (* (- (pow x.re 3) (pow x.im 3)) x.re)) (cbrt (* (- (* x.re x.re) (* x.im x.im)) x.re)))

prune1.0s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0.0b

localize35.0ms

Local error

Found 4 expressions with local error:

8.8b
(cbrt (* (- x.re x.im) x.re))
8.8b
(cbrt (* (- x.re x.im) x.re))
8.8b
(cbrt (* (- x.re x.im) x.re))
8.8b
(cbrt (* (- x.re x.im) x.re))

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
4 → 44
Calls

4 calls. Slowest were:

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

series1.2s

Counts
4 → 12
Calls

4 calls. Slowest were:

309.0ms
(cbrt (* (- x.re x.im) x.re))
307.0ms
(cbrt (* (- x.re x.im) x.re))
271.0ms
(cbrt (* (- x.re x.im) x.re))
263.0ms
(cbrt (* (- x.re x.im) x.re))

simplify2.9s

Counts
24 → 56
Calls

24 calls. Slowest were:

576.0ms
(* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x.re)))))))
267.0ms
(* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x.re)))))))
258.0ms
(* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x.re)))))))

prune799.0ms

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 0.0b

regimes103.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.9s

Algorithm
intervals