Average Error: 31.2 → 0.1
Time: 2.4m
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)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - \log \left({\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}\right)}}\]

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 31.2

    \[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. Simplified4.8

    \[\leadsto \color{blue}{\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. Using strategy rm
  4. Applied add-exp-log4.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)}}{\color{blue}{e^{\log \left({\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}\right)}}}}\]
  5. Applied pow-exp4.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{\color{blue}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}}{e^{\log \left({\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}\right)}}}\]
  6. Applied div-exp0.1

    \[\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)}{\color{blue}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re} - \log \left({\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}\right)}}}\]
  7. Final simplification0.1

    \[\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)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - \log \left({\left(\sqrt{x.re^2 + x.im^2}^*\right)}^{y.re}\right)}}\]

Reproduce

herbie shell --seed 2019007 +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: 2.3m)Debug log

sample3.9s

Algorithm
intervals

simplify521.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

521.0ms
(* (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))))

prune32.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 2.5b

localize73.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.4b
(/ (pow (exp y.im) (atan2 x.im x.re)) (pow (hypot x.re x.im) 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))

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 103
Calls

4 calls. Slowest were:

11.0ms
(/ (pow (exp y.im) (atan2 x.im x.re)) (pow (hypot x.re x.im) y.re))
7.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)

series436.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

177.0ms
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
140.0ms
(/ (pow (exp y.im) (atan2 x.im x.re)) (pow (hypot x.re x.im) y.re))
106.0ms
(fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re))
13.0ms
(* (atan2 x.im x.re) y.re)

simplify1.5s

Counts
108 → 115
Calls

108 calls. Slowest were:

232.0ms
(/ (exp (* y.im (atan2 x.im x.re))) (exp (* -1 (* y.re (log (/ -1 x.im))))))
166.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)))))
129.0ms
(/ (* (* (pow (exp y.im) (atan2 x.im x.re)) (pow (exp y.im) (atan2 x.im x.re))) (pow (exp y.im) (atan2 x.im x.re))) (* (* (pow (hypot x.re x.im) y.re) (pow (hypot x.re x.im) y.re)) (pow (hypot x.re x.im) y.re)))

prune2.1s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize15.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)))
3.7b
(log (pow (hypot x.re x.im) y.re))
0.3b
(* y.im (atan2 x.im x.re))
0.3b
(* (atan2 x.im x.re) y.re)

rewrite7.0ms

Algorithm
rewrite-expression-head
Counts
4 → 55
Calls

4 calls. Slowest were:

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)))
1.0ms
(log (pow (hypot x.re x.im) y.re))

series294.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)))
97.0ms
(log (pow (hypot x.re x.im) y.re))
23.0ms
(* (atan2 x.im x.re) y.re)
14.0ms
(* y.im (atan2 x.im x.re))

simplify338.0ms

Counts
27 → 67
Calls

27 calls. Slowest were:

173.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)))))
63.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
38.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ 1 x.re)))))

prune1.3s

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

localize33.0ms

Local error

Found 4 expressions with local error:

29.1b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
29.1b
(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
(* (atan2 x.im x.re) y.im)

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 57
Calls

4 calls. Slowest were:

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

series225.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

149.0ms
(cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
32.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
22.0ms
(* (atan2 x.im x.re) y.im)
22.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify677.0ms

Counts
27 → 69
Calls

27 calls. Slowest were:

212.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
192.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
65.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.2s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0.0b

regimes257.0ms

Accuracy

0% (0.0b remaining)

Error of 0.1b against oracle of 0.1b and baseline of 0.1b

bsearch3.0ms

end0.0ms

sample2.1m

Algorithm
intervals