Average Error: 31.2 → 11.0
Time: 4.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 \sin \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)\]
\[\begin{array}{l} \mathbf{if}\;y.re \le -2.0619687977359296 \cdot 10^{-96}:\\ \;\;\;\;e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sqrt[3]{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right) \cdot \left(\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\right)}\\ \mathbf{elif}\;y.re \le -1.7792701921219835 \cdot 10^{-297}:\\ \;\;\;\;\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log \left(\sqrt{\sqrt{x.im \cdot x.im + x.re \cdot x.re}} \cdot \sqrt{\sqrt{x.im \cdot x.im + x.re \cdot x.re}}\right) \cdot y.im\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;y.re \le 7.866105145579578 \cdot 10^{-231} \lor \neg \left(y.re \le 1.2393756173610735 \cdot 10^{-129}\right):\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if y.re < -2.0619687977359296e-96

    1. Initial program 36.8

      \[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 \sin \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. Taylor expanded around -inf 0.8

      \[\leadsto 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 \sin \left(\log \color{blue}{\left(-1 \cdot x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    3. Simplified0.8

      \[\leadsto 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 \sin \left(\log \color{blue}{\left(-x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    4. Using strategy rm
    5. Applied add-cbrt-cube0.8

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

    if -2.0619687977359296e-96 < y.re < -1.7792701921219835e-297

    1. Initial program 32.0

      \[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 \sin \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. Using strategy rm
    3. Applied add-sqr-sqrt32.0

      \[\leadsto 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 \sin \left(\log \color{blue}{\left(\sqrt{\sqrt{x.re \cdot x.re + x.im \cdot x.im}} \cdot \sqrt{\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)\]

    if -1.7792701921219835e-297 < y.re < 7.866105145579578e-231 or 1.2393756173610735e-129 < y.re

    1. Initial program 21.1

      \[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 \sin \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. Taylor expanded around -inf 19.7

      \[\leadsto 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 \sin \left(\log \color{blue}{\left(-1 \cdot x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    3. Simplified19.7

      \[\leadsto 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 \sin \left(\log \color{blue}{\left(-x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    4. Taylor expanded around -inf 12.9

      \[\leadsto e^{\log \color{blue}{\left(-1 \cdot x.re\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\log \left(-x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    5. Simplified12.9

      \[\leadsto e^{\log \color{blue}{\left(-x.re\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\log \left(-x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]

    if 7.866105145579578e-231 < y.re < 1.2393756173610735e-129

    1. Initial program 29.5

      \[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 \sin \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)\]
  3. Recombined 4 regimes into one program.
  4. Final simplification11.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \le -2.0619687977359296 \cdot 10^{-96}:\\ \;\;\;\;e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sqrt[3]{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right) \cdot \left(\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\right)}\\ \mathbf{elif}\;y.re \le -1.7792701921219835 \cdot 10^{-297}:\\ \;\;\;\;\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log \left(\sqrt{\sqrt{x.im \cdot x.im + x.re \cdot x.re}} \cdot \sqrt{\sqrt{x.im \cdot x.im + x.re \cdot x.re}}\right) \cdot y.im\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;y.re \le 7.866105145579578 \cdot 10^{-231} \lor \neg \left(y.re \le 1.2393756173610735 \cdot 10^{-129}\right):\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Reproduce

herbie shell --seed 2019002 
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))

Details

Time bar (total: 4.3m)Debug log

sample7.0s

Algorithm
intervals

simplify138.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

138.0ms
(* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re))))

prune27.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.3b

localize91.0ms

Local error

Found 4 expressions with local error:

35.1b
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
28.7b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
28.7b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
0.3b
(* (atan2 x.im x.re) y.im)

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 47
Calls

4 calls. Slowest were:

28.0ms
(sin (+ (* (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)))

series217.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

159.0ms
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
26.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
13.0ms
(* (atan2 x.im x.re) y.im)

simplify592.0ms

Counts
27 → 59
Calls

27 calls. Slowest were:

163.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
160.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
65.0ms
(sqrt (+ (pow (* x.re x.re) 3) (pow (* x.im x.im) 3)))

prune1.1s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 10.0b

localize24.0ms

Local error

Found 4 expressions with local error:

35.1b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
28.7b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
0.3b
(* (atan2 x.im x.re) y.im)
0.3b
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)

rewrite21.0ms

Algorithm
rewrite-expression-head
Counts
4 → 46
Calls

4 calls. Slowest were:

13.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
3.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
2.0ms
(* (atan2 x.im x.re) y.im)

series246.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

130.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
83.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
13.0ms
(* (atan2 x.im x.re) y.im)

simplify577.0ms

Counts
23 → 58
Calls

23 calls. Slowest were:

146.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
97.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
69.0ms
(* -1 (* y.re (log (/ -1 x.re))))

prune1.3s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 5.3b

localize25.0ms

Local error

Found 4 expressions with local error:

35.1b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
35.1b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
35.1b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
28.7b
(sqrt (+ (* x.re x.re) (* x.im x.im)))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 38
Calls

4 calls. Slowest were:

13.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
11.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
8.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))

series513.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

179.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
155.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
146.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
33.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify840.0ms

Counts
21 → 50
Calls

21 calls. Slowest were:

187.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
90.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
87.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.2s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 5.3b

localize24.0ms

Local error

Found 4 expressions with local error:

35.1b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
0.3b
(* (atan2 x.im x.re) y.im)
0.3b
(* (log (- x.re)) y.im)
0.3b
(* (log (- x.re)) y.re)

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 43
Calls

4 calls. Slowest were:

17.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
5.0ms
(* (log (- x.re)) y.re)
5.0ms
(* (log (- x.re)) y.im)

series284.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

127.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
77.0ms
(* (log (- x.re)) y.re)
68.0ms
(* (log (- x.re)) y.im)
13.0ms
(* (atan2 x.im x.re) y.im)

simplify482.0ms

Counts
19 → 55
Calls

19 calls. Slowest were:

104.0ms
(* -1 (* y.im (log (/ -1 x.re))))
77.0ms
(* -1 (* y.re (log (/ -1 x.re))))
76.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune833.0ms

Pruning

12 alts after pruning (9 fresh and 3 done)

Merged error: 5.2b

regimes890.0ms

Accuracy

56.2% (6.0b remaining)

Error of 11.0b against oracle of 5.0b and baseline of 18.7b

bsearch38.0s

end0.0ms

sample3.4m

Algorithm
intervals