Average Error: 30.7 → 0.0
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 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. Simplified4.7

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

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

    \[\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.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)}{\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.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)}{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 2019016 +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.4m)Debug log

sample5.5s

Algorithm
intervals
Results
1234×(pre true 80)
977×(body exit 10240)
257×(body real 80)

simplify149.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
148.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))))

prune37.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 1.5b

localize68.0ms

Local error

Found 4 expressions with local error:

27.3b
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
0.2b
(* (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)) (pow (hypot x.re x.im) y.re))

rewrite27.0ms

Algorithm
rewrite-expression-head
Rules
42×unpow-prod-down
36×times-frac
33×add-cube-cbrt
33×*-un-lft-identity
33×add-sqr-sqrt
13×add-exp-log
div-exp
associate-/l*
pow-exp
add-cbrt-cube
associate-/r*
pow-to-exp
add-log-exp
log1p-expm1-u
pow1
expm1-log1p-u
associate-*l*
fma-udef
div-inv
*-commutative
frac-2neg
clear-num
cos-sum
cbrt-undiv
Counts
4 → 103
Calls
4 calls:
Slowest
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)
0.0ms
(fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re))

series481.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
166.0ms
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
156.0ms
(fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re))
132.0ms
(/ (pow (exp y.im) (atan2 x.im x.re)) (pow (hypot x.re x.im) y.re))
27.0ms
(* (atan2 x.im x.re) y.re)

simplify1.6s

Counts
108 → 115
Calls
108 calls:
Slowest
335.0ms
(/ (exp (* y.im (atan2 x.im x.re))) (exp (* -1 (* y.re (log (/ -1 x.im))))))
148.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)))))
104.0ms
(- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re))))
97.0ms
(/ (exp (* y.im (atan2 x.im x.re))) (exp (* -1 (* y.re (log (/ 1 x.im))))))
93.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: 0b

localize15.0ms

Local error

Found 4 expressions with local error:

27.3b
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
2.7b
(log (pow (hypot x.re x.im) y.re))
0.2b
(* (atan2 x.im x.re) y.re)
0.2b
(* y.im (atan2 x.im x.re))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
log-prod
add-log-exp
log1p-expm1-u
add-cbrt-cube
pow1
expm1-log1p-u
associate-*l*
associate-*r*
rem-log-exp
unpow-prod-down
*-commutative
fma-udef
log-pow
pow-exp
cos-sum
pow-to-exp
Counts
4 → 55
Calls
4 calls:
Slowest
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))
1.0ms
(* y.im (atan2 x.im x.re))

series210.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
110.0ms
(cos (fma y.im (log (hypot x.re x.im)) (* (atan2 x.im x.re) y.re)))
78.0ms
(log (pow (hypot x.re x.im) y.re))
13.0ms
(* (atan2 x.im x.re) y.re)
8.0ms
(* y.im (atan2 x.im x.re))

simplify335.0ms

Counts
27 → 67
Calls
27 calls:
Slowest
118.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)))))
93.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
30.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ 1 x.re)))))
21.0ms
(log (pow (* (cbrt (hypot x.re x.im)) (cbrt (hypot x.re x.im))) y.re))
8.0ms
(log (pow (sqrt (hypot x.re x.im)) y.re))

prune1.2s

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize43.0ms

Local error

Found 4 expressions with local error:

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

rewrite33.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
sqrt-prod
associate-*l*
pow1
add-log-exp
log1p-expm1-u
add-exp-log
sqrt-div
add-cbrt-cube
expm1-log1p-u
pow1/2
hypot-def
flip-+
log-pow
flip3-+
rem-sqrt-square
*-commutative
cos-sum
Counts
4 → 59
Calls
4 calls:
Slowest
20.0ms
(cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
4.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
4.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
4.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)

series275.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
148.0ms
(cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
83.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
25.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify736.0ms

Counts
27 → 71
Calls
27 calls:
Slowest
146.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
143.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
95.0ms
(* -1 (* y.re (log (/ -1 x.re))))
86.0ms
(cos (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
61.0ms
(* -1 (* y.re (log (/ 1 x.re))))

prune1.2s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes232.0ms

Accuracy

0% (0.0b remaining)

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

bsearch2.0ms

end0.0ms

sample2.2m

Algorithm
intervals
Results
38786×(pre true 80)
30786×(body exit 10240)
8000×(body real 80)