Average Error: 30.9 → 10.9
Time: 6.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 -1.197397631785189 \cdot 10^{+17}:\\ \;\;\;\;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 \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{elif}\;y.re \le 8.094818667930974 \cdot 10^{-187} \lor \neg \left(y.re \le 1.6611395804704506 \cdot 10^{-56}\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}:\\ \;\;\;\;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 \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log \left(\left|\sqrt[3]{x.im \cdot x.im + x.re \cdot x.re}\right| \cdot \sqrt{\sqrt[3]{x.im \cdot x.im + x.re \cdot x.re}}\right) \cdot y.im\right)\\ \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 3 regimes
  2. if y.re < -1.197397631785189e+17

    1. Initial program 36.4

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

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

      \[\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)\]

    if -1.197397631785189e+17 < y.re < 8.094818667930974e-187 or 1.6611395804704506e-56 < y.re

    1. Initial program 25.6

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

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

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

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

      \[\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 8.094818667930974e-187 < y.re < 1.6611395804704506e-56

    1. Initial program 33.9

      \[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-cube-cbrt33.9

      \[\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 \left(\sqrt{\color{blue}{\left(\sqrt[3]{x.re \cdot x.re + x.im \cdot x.im} \cdot \sqrt[3]{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot \sqrt[3]{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)\]
    4. Applied sqrt-prod33.9

      \[\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[3]{x.re \cdot x.re + x.im \cdot x.im} \cdot \sqrt[3]{x.re \cdot x.re + x.im \cdot x.im}} \cdot \sqrt{\sqrt[3]{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)\]
    5. Simplified33.9

      \[\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 \left(\color{blue}{\left|\sqrt[3]{x.re \cdot x.re + x.im \cdot x.im}\right|} \cdot \sqrt{\sqrt[3]{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 3 regimes into one program.
  4. Final simplification10.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \le -1.197397631785189 \cdot 10^{+17}:\\ \;\;\;\;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 \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)\\ \mathbf{elif}\;y.re \le 8.094818667930974 \cdot 10^{-187} \lor \neg \left(y.re \le 1.6611395804704506 \cdot 10^{-56}\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}:\\ \;\;\;\;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 \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log \left(\left|\sqrt[3]{x.im \cdot x.im + x.re \cdot x.re}\right| \cdot \sqrt{\sqrt[3]{x.im \cdot x.im + x.re \cdot x.re}}\right) \cdot y.im\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2018360 
(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: 1.7m)Debug log

start8.8s

Algorithm
intervals

setup159.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.0b

localize106.0ms

Local error

Found 4 expressions with local error:

36.9b
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
31.2b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
31.2b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
0.3b
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 49
Calls

4 calls. Slowest were:

21.0ms
(sin (+ (* (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.re)
4.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

series348.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

232.0ms
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
77.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify724.0ms

Counts
27 → 61
Calls

27 calls. Slowest were:

168.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
152.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
73.0ms
(* -1 (* y.re (log (/ 1 x.re))))

prune1.2s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 10.4b

localize23.0ms

Local error

Found 4 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 47
Calls

4 calls. Slowest were:

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

series382.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

173.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
91.0ms
(* (log (- x.re)) y.im)
86.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
31.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify632.0ms

Counts
23 → 59
Calls

23 calls. Slowest were:

126.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
99.0ms
(* -1 (* y.re (log (/ -1 x.re))))
71.0ms
(* -1 (* y.im (log (/ -1 x.re))))

prune1.2s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 3.7b

localize23.0ms

Local error

Found 4 expressions with local error:

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

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 43
Calls

4 calls. Slowest were:

16.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
3.0ms
(* (log (- x.re)) y.im)
3.0ms
(* (log (- x.re)) y.re)

series361.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

127.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
110.0ms
(* (log (- x.re)) y.im)
99.0ms
(* (log (- x.re)) y.re)
24.0ms
(* (atan2 x.im x.re) y.im)

simplify477.0ms

Counts
19 → 55
Calls

19 calls. Slowest were:

100.0ms
(* -1 (* y.re (log (/ -1 x.re))))
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)))))

prune958.0ms

Pruning

10 alts after pruning (8 fresh and 2 done)

Merged error: 3.7b

localize37.0ms

Local error

Found 4 expressions with local error:

36.8b
(sin (+ (* (* (cbrt (log (- x.re))) (cbrt (log (- x.re)))) (* (cbrt (log (- x.re))) y.im)) (* (atan2 x.im x.re) y.re)))
0.5b
(cbrt (log (- x.re)))
0.5b
(cbrt (log (- x.re)))
0.5b
(cbrt (log (- x.re)))

rewrite56.0ms

Algorithm
rewrite-expression-head
Counts
4 → 44
Calls

4 calls. Slowest were:

51.0ms
(sin (+ (* (* (cbrt (log (- x.re))) (cbrt (log (- x.re)))) (* (cbrt (log (- x.re))) y.im)) (* (atan2 x.im x.re) y.re)))
2.0ms
(cbrt (log (- x.re)))
1.0ms
(cbrt (log (- x.re)))

series1.4s

Counts
4 → 12
Calls

4 calls. Slowest were:

437.0ms
(cbrt (log (- x.re)))
388.0ms
(cbrt (log (- x.re)))
377.0ms
(cbrt (log (- x.re)))
149.0ms
(sin (+ (* (* (cbrt (log (- x.re))) (cbrt (log (- x.re)))) (* (cbrt (log (- x.re))) y.im)) (* (atan2 x.im x.re) y.re)))

simplify371.0ms

Counts
25 → 56
Calls

25 calls. Slowest were:

92.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
50.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
42.0ms
(pow (- (log (/ -1 x.re))) 1/3)

prune976.0ms

Pruning

14 alts after pruning (11 fresh and 3 done)

Merged error: 3.6b

regimes970.0ms

Accuracy

47.7% (5.7b remaining)

Error of 10.9b against oracle of 5.1b and baseline of 16.1b

bsearch1.4m