Average Error: 31.8 → 10.1
Time: 4.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}\;y.re \le -16394960.105851:\\ \;\;\;\;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 4.7496459374994184 \cdot 10^{-210} \lor \neg \left(y.re \le 1.2409494224095134 \cdot 10^{-148}\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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log \left(\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}\\ \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 < -16394960.105851

    1. Initial program 38.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 -inf 0.1

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

      \[\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 -16394960.105851 < y.re < 4.7496459374994184e-210 or 1.2409494224095134e-148 < y.re

    1. Initial program 25.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)\]
    2. Taylor expanded around -inf 29.4

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

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

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

      \[\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 4.7496459374994184e-210 < y.re < 1.2409494224095134e-148

    1. Initial program 30.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)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \le -16394960.105851:\\ \;\;\;\;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 4.7496459374994184 \cdot 10^{-210} \lor \neg \left(y.re \le 1.2409494224095134 \cdot 10^{-148}\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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log \left(\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}\\ \end{array}\]

Reproduce

herbie shell --seed 2019010 
(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.0m)Debug log

sample7.9s

Algorithm
intervals

simplify87.0ms

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

prune23.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.4b

localize59.0ms

Local error

Found 4 expressions with local error:

32.7b
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
31.6b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
31.6b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
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
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
18.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)
3.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
2.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

series297.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
192.0ms
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
67.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
19.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
18.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify585.0ms

Counts
27 → 61
Calls
27 calls:
Slowest
112.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
106.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
69.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
62.0ms
(* -1 (* y.re (log (/ -1 x.re))))
58.0ms
(* -1 (* y.re (log (/ 1 x.re))))

prune1.1s

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 13.3b

localize18.0ms

Local error

Found 4 expressions with local error:

32.8b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
31.6b
(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
(* (log (- x.re)) y.im)

rewrite19.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
log-pow
*-commutative
sqrt-div
pow1/2
flip-+
sin-sum
flip3-+
rem-sqrt-square
Counts
4 → 47
Calls
4 calls:
Slowest
10.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)
3.0ms
(* (log (- x.re)) y.im)
2.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

series311.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
107.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
95.0ms
(* (log (- x.re)) y.im)
88.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
22.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify615.0ms

Counts
23 → 59
Calls
23 calls:
Slowest
127.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
80.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
77.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
63.0ms
(* -1 (* y.im (log (/ -1 x.re))))
59.0ms
(* -1 (* y.re (log (/ 1 x.re))))

prune1.2s

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 6.5b

localize13.0ms

Local error

Found 4 expressions with local error:

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

rewrite22.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
14.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)

series331.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
133.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
104.0ms
(* (log (- x.re)) y.im)
82.0ms
(* (log (- x.re)) y.re)
12.0ms
(* (atan2 x.im x.re) y.re)

simplify480.0ms

Counts
19 → 55
Calls
19 calls:
Slowest
101.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
89.0ms
(* -1 (* y.re (log (/ -1 x.re))))
87.0ms
(* -1 (* y.im (log (/ -1 x.re))))
62.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
41.0ms
(* y.re (- (log -1) (log (/ 1 x.re))))

prune975.0ms

Pruning

14 alts after pruning (11 fresh and 3 done)

Merged error: 6.4b

localize31.0ms

Local error

Found 4 expressions with local error:

32.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))) (cbrt (log (- x.re))))
0.5b
(cbrt (log (- x.re)))
0.5b
(cbrt (log (- x.re)))

rewrite72.0ms

Algorithm
rewrite-expression-head
Rules
16×cbrt-prod
13×pow1
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
associate-*l*
associate-*r*
add-exp-log
pow1/3
add-log-exp
log-pow
add-cbrt-cube
pow-prod-up
pow-prod-down
cbrt-unprod
*-commutative
prod-exp
sin-sum
pow-plus
pow2
Counts
4 → 62
Calls
4 calls:
Slowest
62.0ms
(sin (+ (* (* (cbrt (log (- x.re))) (cbrt (log (- x.re)))) (* (cbrt (log (- x.re))) y.im)) (* (atan2 x.im x.re) y.re)))
7.0ms
(* (cbrt (log (- x.re))) (cbrt (log (- x.re))))
1.0ms
(cbrt (log (- x.re)))
1.0ms
(cbrt (log (- x.re)))

series1.3s

Counts
4 → 12
Calls
4 calls:
Slowest
399.0ms
(* (cbrt (log (- x.re))) (cbrt (log (- x.re))))
385.0ms
(cbrt (log (- x.re)))
376.0ms
(cbrt (log (- x.re)))
144.0ms
(sin (+ (* (* (cbrt (log (- x.re))) (cbrt (log (- x.re)))) (* (cbrt (log (- x.re))) y.im)) (* (atan2 x.im x.re) y.re)))

simplify442.0ms

Counts
43 → 74
Calls
43 calls:
Slowest
85.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
78.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
61.0ms
(pow (pow (- (log -1) (log (/ 1 x.re))) 2) 1/3)
38.0ms
(+ (* y.im (log -1)) (+ (* (atan2 x.im x.re) y.re) (* y.im (log x.re))))
27.0ms
(* (sin (* (* (cbrt (log (- x.re))) (cbrt (log (- x.re)))) (* (cbrt (log (- x.re))) y.im))) (cos (* (atan2 x.im x.re) y.re)))

prune1.3s

Pruning

15 alts after pruning (12 fresh and 3 done)

Merged error: 6.4b

regimes979.0ms

Accuracy

52.1% (5.4b remaining)

Error of 10.1b against oracle of 4.7b and baseline of 16.0b

bsearch14.6s

end0.0ms

sample3.5m

Algorithm
intervals