Average Error: 7.1 → 0.2
Time: 38.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.1
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.1

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

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

sample109.0ms

Algorithm
intervals

simplify238.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune10.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 7.3b

localize25.0ms

Local error

Found 4 expressions with local error:

7.3b
(* (- (* 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))

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
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))
9.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
9.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series107.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

39.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
31.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
19.0ms
(+ (* x.re x.im) (* x.im x.re))
18.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

simplify4.2s

Counts
31 → 66
Calls

31 calls. Slowest were:

579.0ms
(/ (exp (* (- (* x.re x.re) (* x.im x.im)) x.re)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
480.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)
455.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)))

prune652.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.1b

localize19.0ms

Local error

Found 4 expressions with local error:

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

rewrite42.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
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))
8.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
5.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series128.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

51.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
34.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
29.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
13.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify14.0s

Counts
67 → 87
Calls

67 calls. Slowest were:

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

prune974.0ms

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0.0b

localize13.0ms

Local error

Found 4 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

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

series607.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

173.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))
152.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))
146.0ms
(* (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im)) (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
135.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))

simplify8.2s

Counts
49 → 77
Calls

49 calls. Slowest were:

693.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))))))
676.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))))))
618.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

11 alts after pruning (9 fresh and 2 done)

Merged error: 0.0b

localize29.0ms

Local error

Found 4 expressions with local error:

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

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

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

series636.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

169.0ms
(cbrt (+ x.re x.im))
163.0ms
(* (cbrt (+ x.re x.im)) (cbrt (+ x.re x.im)))
154.0ms
(cbrt (+ x.re x.im))
149.0ms
(cbrt (+ x.re x.im))

simplify1.5s

Counts
59 → 87
Calls

59 calls. Slowest were:

176.0ms
(- (+ (* 1/3 (* (pow (/ 1 (pow x.im 2)) 1/3) x.re)) (pow x.im 1/3)) (* 1/9 (* (pow (/ 1 (pow x.im 5)) 1/3) (pow x.re 2))))
155.0ms
(- (+ (* 1/3 (* (pow (/ 1 (pow x.im 2)) 1/3) x.re)) (pow x.im 1/3)) (* 1/9 (* (pow (/ 1 (pow x.im 5)) 1/3) (pow x.re 2))))
147.0ms
(- (+ (pow x.im 2/3) (* 2/3 (* (pow (/ 1 x.im) 1/3) x.re))) (* 1/9 (* (pow (/ 1 (pow x.im 4)) 1/3) (pow x.re 2))))

prune1.1s

Pruning

11 alts after pruning (8 fresh and 3 done)

Merged error: 0.0b

regimes118.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms

end0.0ms

sample3.2s

Algorithm
intervals