Average Error: 31.6 → 10.2
Time: 4.0m
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.3368060071344819 \cdot 10^{-138}:\\ \;\;\;\;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{else}:\\ \;\;\;\;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)\\ \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 y.re < -1.3368060071344819e-138

    1. Initial program 36.7

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

    if -1.3368060071344819e-138 < y.re

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \le -1.3368060071344819 \cdot 10^{-138}:\\ \;\;\;\;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{else}:\\ \;\;\;\;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)\\ \end{array}\]

Reproduce

herbie shell --seed 2019007 
(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

sample6.9s

Algorithm
intervals

simplify112.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

111.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))))

prune13.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 28.6b

localize90.0ms

Local error

Found 4 expressions with local error:

36.6b
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
27.3b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
27.3b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
0.3b
(* (atan2 x.im x.re) y.im)

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 47
Calls

4 calls. Slowest were:

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

series294.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

206.0ms
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
34.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
31.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
24.0ms
(* (atan2 x.im x.re) y.im)

simplify426.0ms

Counts
27 → 59
Calls

27 calls. Slowest were:

114.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
105.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
49.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.3s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 10.2b

localize25.0ms

Local error

Found 4 expressions with local error:

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

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 44
Calls

4 calls. Slowest were:

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

series201.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

144.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
27.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
17.0ms
(* (atan2 x.im x.re) y.re)
13.0ms
(* (atan2 x.im x.re) y.im)

simplify425.0ms

Counts
23 → 56
Calls

23 calls. Slowest were:

122.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
106.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
70.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.6s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 5.0b

localize18.0ms

Local error

Found 4 expressions with local error:

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

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 42
Calls

4 calls. Slowest were:

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

series314.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

160.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
106.0ms
(* (log (- x.re)) y.re)
25.0ms
(* (atan2 x.im x.re) y.re)
23.0ms
(* (atan2 x.im x.re) y.im)

simplify313.0ms

Counts
19 → 54
Calls

19 calls. Slowest were:

90.0ms
(* -1 (* y.re (log (/ -1 x.re))))
72.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
62.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))

prune1.0s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 5.0b

localize21.0ms

Local error

Found 4 expressions with local error:

36.6b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
36.6b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
36.6b
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
0.7b
(cbrt (sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re))))

rewrite42.0ms

Algorithm
rewrite-expression-head
Counts
4 → 35
Calls

4 calls. Slowest were:

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

series660.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

195.0ms
(cbrt (sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re))))
186.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
148.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
131.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))

simplify781.0ms

Counts
18 → 47
Calls

18 calls. Slowest were:

105.0ms
(pow (sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re))))) 1/3)
85.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))
84.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune899.0ms

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 4.9b

regimes729.0ms

Accuracy

50.8% (5.3b remaining)

Error of 10.2b against oracle of 4.8b and baseline of 15.6b

bsearch9.6s

end0.0ms

sample3.6m

Algorithm
intervals