Average Error: 7.0 → 0.2
Time: 1.4m
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 2019005 
(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: 1.4m)Debug log

sample113.0ms

Algorithm
intervals

simplify282.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

281.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.7b

localize26.0ms

Local error

Found 4 expressions with local error:

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

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 56
Calls

4 calls. Slowest were:

10.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
5.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
4.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series110.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

39.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
27.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
27.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.re) (* x.im x.im))

simplify4.2s

Counts
33 → 68
Calls

33 calls. Slowest were:

569.0ms
(/ (exp (* (- (* x.re x.re) (* x.im x.im)) x.re)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
481.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)
390.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)))

prune653.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

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

rewrite57.0ms

Algorithm
rewrite-expression-head
Counts
4 → 77
Calls

4 calls. Slowest were:

25.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
16.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
9.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series131.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

46.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))
30.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
25.0ms
(* (- x.re x.im) x.re)

simplify14.6s

Counts
70 → 89
Calls

70 calls. Slowest were:

748.0ms
(* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (- (* x.re x.im) (* x.im x.re)))
643.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)))
610.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)))))

prune908.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0.0b

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

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

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

series499.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

131.0ms
(cbrt (- x.re x.im))
124.0ms
(cbrt (- x.re x.im))
122.0ms
(cbrt (- x.re x.im))
121.0ms
(* (cbrt (- x.re x.im)) (cbrt (- x.re x.im)))

simplify2.3s

Counts
59 → 87
Calls

59 calls. Slowest were:

265.0ms
(- (exp (* 1/3 (+ (log x.im) (log -1)))) (+ (* 1/3 (* x.re (exp (* 1/3 (- (log -1) (* 2 (log x.im))))))) (* 1/9 (* (pow x.re 2) (exp (* 1/3 (- (log -1) (* 5 (log x.im)))))))))
260.0ms
(- (exp (* 1/3 (+ (log x.im) (log -1)))) (+ (* 1/3 (* x.re (exp (* 1/3 (- (log -1) (* 2 (log x.im))))))) (* 1/9 (* (pow x.re 2) (exp (* 1/3 (- (log -1) (* 5 (log x.im)))))))))
258.0ms
(- (exp (* 1/3 (+ (log x.im) (log -1)))) (+ (* 1/3 (* x.re (exp (* 1/3 (- (log -1) (* 2 (log x.im))))))) (* 1/9 (* (pow x.re 2) (exp (* 1/3 (- (log -1) (* 5 (log x.im)))))))))

prune1.1s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

14.0b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
14.0b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
14.0b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
0.3b
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))))

rewrite84.0ms

Algorithm
rewrite-expression-head
Counts
4 → 155
Calls

4 calls. Slowest were:

54.0ms
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))))
10.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
5.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))

series552.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

145.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
145.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
132.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
130.0ms
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))))

simplify51.9s

Counts
199 → 167
Calls

199 calls. Slowest were:

1.3s
(exp (* 1/3 (- (log -1) (* 3 (log (/ -1 x.re))))))
862.0ms
(* (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ x.re x.im) (* (- x.re x.im) x.re)))
860.0ms
(exp (* 1/3 (- (log -1) (* 3 (log (/ -1 x.re))))))

prune3.2s

Pruning

7 alts after pruning (4 fresh and 3 done)

Merged error: 0.0b

regimes137.0ms

Accuracy

0% (0.2b remaining)

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

bsearch1.0ms

end0.0ms

sample3.3s

Algorithm
intervals