Average Error: 30.7 → 0.0
Time: 3.1m
Precision: 64
Internal Precision: 128
\[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
\[\frac{\cos \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{\frac{\left(1 + \frac{1}{2} \cdot \left({\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}^{2} \cdot {y.im}^{2}\right)\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}{{\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}}}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Initial program 30.7

    \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
  2. Initial simplification4.8

    \[\leadsto \frac{\cos \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{\frac{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{{\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}}}\]
  3. Taylor expanded around 0 0.0

    \[\leadsto \frac{\cos \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{\frac{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re} + \left(\frac{1}{2} \cdot \left({y.im}^{2} \cdot {\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}^{2}\right) + 1\right)}}{{\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}}}\]
  4. Final simplification0.0

    \[\leadsto \frac{\cos \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{\frac{\left(1 + \frac{1}{2} \cdot \left({\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}^{2} \cdot {y.im}^{2}\right)\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}{{\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}}}\]

Reproduce

herbie shell --seed 2018365 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))

Details

Time bar (total: 14.0s)Debug log

start6.0s

Algorithm
intervals

setup162.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.7b

localize72.0ms

Local error

Found 4 expressions with local error:

25.8b
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
0.3b
(* (atan2 x.im x.re) y.re)
0.1b
(fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re))
0.0b
(pow (exp y.im) (atan2 x.im x.re))

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 51
Calls

4 calls. Slowest were:

6.0ms
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
5.0ms
(* (atan2 x.im x.re) y.re)
3.0ms
(pow (exp y.im) (atan2 x.im x.re))

series359.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

159.0ms
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
134.0ms
(fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re))
43.0ms
(pow (exp y.im) (atan2 x.im x.re))
22.0ms
(* (atan2 x.im x.re) y.re)

simplify617.0ms

Counts
23 → 63
Calls

23 calls. Slowest were:

162.0ms
(- 1 (+ (* y.im (* (atan2 x.im x.re) (* y.re (log x.im)))) (* 1/2 (* (pow y.im 2) (pow (log x.im) 2)))))
127.0ms
(+ (* y.im (atan2 x.im x.re)) (+ (* 1/2 (* (pow y.im 2) (pow (atan2 x.im x.re) 2))) 1))
115.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.2s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0b

localize31.0ms

Local error

Found 4 expressions with local error:

25.8b
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
0.3b
(* (atan2 x.im x.re) y.re)
0.2b
(* y.im (atan2 x.im x.re))
0.2b
(* (pow y.im 2) (pow (atan2 x.im x.re) 2))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

8.0ms
(* (pow y.im 2) (pow (atan2 x.im x.re) 2))
2.0ms
(* (atan2 x.im x.re) y.re)
2.0ms
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))

series191.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

151.0ms
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
16.0ms
(* (atan2 x.im x.re) y.re)
15.0ms
(* (pow y.im 2) (pow (atan2 x.im x.re) 2))
8.0ms
(* y.im (atan2 x.im x.re))

simplify685.0ms

Counts
35 → 77
Calls

35 calls. Slowest were:

174.0ms
(* (* (* (pow y.im 2) (pow y.im 2)) (pow y.im 2)) (* (* (pow (atan2 x.im x.re) 2) (pow (atan2 x.im x.re) 2)) (pow (atan2 x.im x.re) 2)))
142.0ms
(- 1 (+ (* y.im (* (atan2 x.im x.re) (* y.re (log x.im)))) (* 1/2 (* (pow y.im 2) (pow (log x.im) 2)))))
121.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.8s

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize45.0ms

Local error

Found 4 expressions with local error:

30.2b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
30.2b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
25.8b
(cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
0.3b
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im)

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 59
Calls

4 calls. Slowest were:

13.0ms
(cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
7.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im)
2.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

series246.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

128.0ms
(cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
68.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im)
26.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
24.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify969.0ms

Counts
27 → 71
Calls

27 calls. Slowest were:

217.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
177.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
128.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.3s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes308.0ms

Accuracy

0% (0.0b remaining)

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

bsearch5.0ms