Average Error: 6.9 → 0.2
Time: 39.3s
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.9
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 6.9

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

    \[\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 2018362 
(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.1s)Debug log

start60.0ms

Algorithm
intervals

setup233.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 6.2b

localize56.0ms

Local error

Found 4 expressions with local error:

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

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

14.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
8.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
7.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series112.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

38.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
36.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
24.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
13.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify4.7s

Counts
31 → 66
Calls

31 calls. Slowest were:

571.0ms
(/ (exp (* (- (* x.re x.re) (* x.im x.im)) x.re)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
469.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)
430.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)))

prune735.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize13.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.im x.re)) x.im)
0.1b
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
0.0b
(+ (* x.re x.im) (* x.im x.re))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

14.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
10.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
8.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series119.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

45.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
33.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
28.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
12.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify14.9s

Counts
67 → 87
Calls

67 calls. Slowest were:

722.0ms
(- (* (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.re)) (+ (* (* 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.im) (+ x.re x.im)) (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)))
698.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)))))
591.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)))))

prune888.0ms

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

localize23.0ms

Local error

Found 4 expressions with local error:

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

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

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

series572.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

189.0ms
(* (cbrt (+ (* x.re x.im) (* x.im x.re))) (cbrt (+ (* x.re x.im) (* x.im x.re))))
151.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
138.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
94.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))

simplify7.7s

Counts
59 → 87
Calls

59 calls. Slowest were:

686.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))))))
663.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))))))
639.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))))

prune1.1s

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

localize41.0ms

Local error

Found 4 expressions with local error:

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

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
4 → 42
Calls

4 calls. Slowest were:

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

series534.0ms

Counts
4 → 10
Calls

4 calls. Slowest were:

266.0ms
(cbrt x.im)
134.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
133.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
0.0ms
(cbrt 2)

simplify2.1s

Counts
20 → 52
Calls

20 calls. Slowest were:

448.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (* (* (* (cbrt x.im) (* (cbrt x.re) (cbrt 2))) (cbrt (+ (* x.re x.im) (* x.im x.re)))) (cbrt (+ (* x.re x.im) (* x.im x.re)))) x.im))
414.0ms
(cbrt (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)))
334.0ms
(cbrt (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)))

prune908.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

regimes149.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms