Average Error: 31.7 → 11.3
Time: 3.8m
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}\;x.im \le -3.934337993343381 \cdot 10^{+157}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\left(\sqrt[3]{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)} \cdot \sqrt[3]{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)}\right) \cdot \sqrt[3]{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)}\right)\\ \mathbf{elif}\;x.im \le -487213.9089142409:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot 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(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)\right)\\ \mathbf{elif}\;x.im \le 1.941785025091902 \cdot 10^{-89}:\\ \;\;\;\;e^{\log \left(-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{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log x.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 4 regimes
  2. if x.im < -3.934337993343381e+157

    1. Initial program 63.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 22.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. Simplified22.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. Using strategy rm
    5. Applied add-cube-cbrt22.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 \color{blue}{\left(\left(\sqrt[3]{\sin \left(\log \left(-x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \cdot \sqrt[3]{\sin \left(\log \left(-x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}\right) \cdot \sqrt[3]{\sin \left(\log \left(-x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}\right)}\]

    if -3.934337993343381e+157 < x.im < -487213.9089142409

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

    if -487213.9089142409 < x.im < 1.941785025091902e-89

    1. Initial program 24.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 11.3

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

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

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

      \[\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 1.941785025091902e-89 < x.im

    1. Initial program 35.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 \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 0 14.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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log x.im\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification11.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \le -3.934337993343381 \cdot 10^{+157}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\left(\sqrt[3]{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)} \cdot \sqrt[3]{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)}\right) \cdot \sqrt[3]{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(-x.re\right)\right)}\right)\\ \mathbf{elif}\;x.im \le -487213.9089142409:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot 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(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)\right)\\ \mathbf{elif}\;x.im \le 1.941785025091902 \cdot 10^{-89}:\\ \;\;\;\;e^{\log \left(-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{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log x.im\right)\\ \end{array}\]

Reproduce

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

sample6.0s

Algorithm
intervals
Results
5.7s1377×body10240exit
103.0ms256×body80valid

simplify134.0ms

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

prune21.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.4b

localize58.0ms

Local error

Found 4 expressions with local error:

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

rewrite28.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
sqrt-prod
associate-*l*
pow1
add-log-exp
add-exp-log
sqrt-div
add-cbrt-cube
pow1/2
flip-+
log-pow
flip3-+
rem-sqrt-square
*-commutative
sin-sum
Counts
4 → 49
Calls
4 calls:
Slowest
12.0ms
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
6.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
3.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
3.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

series331.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
199.0ms
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
88.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
26.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify651.0ms

Counts
27 → 61
Calls
27 calls:
Slowest
110.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
109.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
93.0ms
(* -1 (* y.re (log (/ -1 x.re))))
72.0ms
(* -1 (* y.re (log (/ 1 x.re))))
60.0ms
(sqrt (+ (pow (* x.re x.re) 3) (pow (* x.im x.im) 3)))

prune1.0s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 10.4b

localize35.0ms

Local error

Found 4 expressions with local error:

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

rewrite24.0ms

Algorithm
rewrite-expression-head
Rules
associate-*l*
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
pow1
add-log-exp
add-exp-log
add-cbrt-cube
sqrt-prod
*-commutative
log-pow
sqrt-div
pow1/2
flip-+
sin-sum
flip3-+
rem-sqrt-square
Counts
4 → 46
Calls
4 calls:
Slowest
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.re)
2.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

series258.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
141.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
81.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
17.0ms
(* (atan2 x.im x.re) y.re)

simplify516.0ms

Counts
23 → 58
Calls
23 calls:
Slowest
139.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
78.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
72.0ms
(* -1 (* y.re (log (/ 1 x.re))))
55.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
54.0ms
(* -1 (* y.re (log (/ -1 x.re))))

prune1.1s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 5.8b

localize17.0ms

Local error

Found 4 expressions with local error:

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

rewrite43.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
add-log-exp
add-exp-log
add-cbrt-cube
pow1
sqrt-prod
sin-sum
sqrt-div
flip-+
pow1/2
flip3-+
rem-sqrt-square
Counts
4 → 38
Calls
4 calls:
Slowest
16.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
15.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
9.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
2.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

series441.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
153.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)))
112.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
30.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify689.0ms

Counts
21 → 50
Calls
21 calls:
Slowest
119.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
92.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
80.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
75.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
69.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))

prune1.0s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 5.8b

localize11.0ms

Local error

Found 4 expressions with local error:

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

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
11×associate-*l*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
pow1
add-log-exp
add-exp-log
add-cbrt-cube
*-commutative
log-pow
sin-sum
Counts
4 → 43
Calls
4 calls:
Slowest
8.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
3.0ms
(* (log (- x.re)) y.re)
3.0ms
(* (log (- x.re)) y.im)
2.0ms
(* (atan2 x.im x.re) y.re)

series297.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
150.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
69.0ms
(* (log (- x.re)) y.im)
64.0ms
(* (log (- x.re)) y.re)
13.0ms
(* (atan2 x.im x.re) y.re)

simplify388.0ms

Counts
19 → 55
Calls
19 calls:
Slowest
77.0ms
(* -1 (* y.im (log (/ -1 x.re))))
77.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
74.0ms
(* -1 (* y.re (log (/ -1 x.re))))
52.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
36.0ms
(* y.im (- (log -1) (log (/ 1 x.re))))

prune865.0ms

Pruning

14 alts after pruning (11 fresh and 3 done)

Merged error: 5.8b

regimes945.0ms

Accuracy

42.3% (6.3b remaining)

Error of 11.3b against oracle of 5.0b and baseline of 15.9b

bsearch11.1s

end0.0ms

sample3.3m

Algorithm
intervals
Results
3.2m46229×body10240exit
3.5s8000×body80valid