Average Error: 31.5 → 10.6
Time: 5.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 \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}\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \le 1.168099110250801 \cdot 10^{-47}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right) \cdot e^{\log \left(-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 2 regimes
  2. if (* (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)))) < 1.168099110250801e-47

    1. Initial program 0.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)\]

    if 1.168099110250801e-47 < (* (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))))

    1. Initial program 61.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. Taylor expanded around -inf 21.5

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

      \[\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 20.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. Simplified20.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)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \le 1.168099110250801 \cdot 10^{-47}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right) \cdot e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Reproduce

herbie shell --seed 2018362 
(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: 18.6s)Debug log

start8.4s

Algorithm
intervals

setup172.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.2b

localize77.0ms

Local error

Found 4 expressions with local error:

35.9b
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
30.5b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
30.5b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
0.3b
(* (atan2 x.im x.re) y.im)

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 47
Calls

4 calls. Slowest were:

19.0ms
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
5.0ms
(* (atan2 x.im x.re) y.im)
4.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

series265.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

179.0ms
(sin (+ (* (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)))
31.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
22.0ms
(* (atan2 x.im x.re) y.im)

simplify505.0ms

Counts
27 → 59
Calls

27 calls. Slowest were:

141.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
137.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
50.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.2s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 12.1b

localize23.0ms

Local error

Found 4 expressions with local error:

35.9b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
30.5b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
0.3b
(* (atan2 x.im x.re) y.im)
0.2b
(* (log (- x.re)) y.im)

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
4 → 45
Calls

4 calls. Slowest were:

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

series287.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

155.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
90.0ms
(* (log (- x.re)) y.im)
22.0ms
(* (atan2 x.im x.re) y.im)
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify546.0ms

Counts
23 → 57
Calls

23 calls. Slowest were:

160.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
84.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
81.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.1s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 3.7b

localize16.0ms

Local error

Found 4 expressions with local error:

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

rewrite33.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)))
5.0ms
(* (log (- x.re)) y.im)
5.0ms
(* (log (- x.re)) y.re)

series357.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

162.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
98.0ms
(* (log (- x.re)) y.re)
78.0ms
(* (log (- x.re)) y.im)
18.0ms
(* (atan2 x.im x.re) y.im)

simplify447.0ms

Counts
19 → 55
Calls

19 calls. Slowest were:

109.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
82.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
68.0ms
(* -1 (* y.re (log (/ -1 x.re))))

prune923.0ms

Pruning

14 alts after pruning (12 fresh and 2 done)

Merged error: 3.6b

localize33.0ms

Local error

Found 4 expressions with local error:

35.9b
(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)))

rewrite75.0ms

Algorithm
rewrite-expression-head
Counts
4 → 44
Calls

4 calls. Slowest were:

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

series1.8s

Counts
4 → 12
Calls

4 calls. Slowest were:

792.0ms
(cbrt (log (- x.re)))
432.0ms
(cbrt (log (- x.re)))
390.0ms
(cbrt (log (- x.re)))
154.0ms
(sin (+ (* (* (cbrt (log (- x.re))) (cbrt (log (- x.re)))) (* (cbrt (log (- x.re))) y.im)) (* (atan2 x.im x.re) y.re)))

simplify301.0ms

Counts
25 → 56
Calls

25 calls. Slowest were:

66.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
56.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
33.0ms
(+ (* y.im (log -1)) (+ (* (atan2 x.im x.re) y.re) (* y.im (log x.re))))

prune1.0s

Pruning

15 alts after pruning (13 fresh and 2 done)

Merged error: 3.6b

regimes990.0ms

Accuracy

63.7% (5.6b remaining)

Error of 10.6b against oracle of 5.0b and baseline of 20.4b

bsearch17.0ms