Average Error: 31.1 → 11.1
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}\;x.re \le -658593911.1636858:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\log \left(-x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{elif}\;x.re \le -1.396871811187125 \cdot 10^{-192} \lor \neg \left(x.re \le -2.270412975964221 \cdot 10^{-206}\right):\\ \;\;\;\;\sin \left(\left(\left(\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)}}}\right) \cdot \sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}}\right) \cdot \sqrt[3]{\log \left(-x.re\right)}\right) \cdot \left(\sqrt[3]{\log \left(-x.re\right)} \cdot y.im\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\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 3 regimes
  2. if x.re < -658593911.1636858

    1. Initial program 39.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. Taylor expanded around -inf 14.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(-1 \cdot x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    3. Simplified14.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(-x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    4. Taylor expanded around -inf 4.5

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

      \[\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 -658593911.1636858 < x.re < -1.396871811187125e-192 or -2.270412975964221e-206 < x.re

    1. Initial program 22.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 16.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. Simplified16.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. Using strategy rm
    5. Applied add-cube-cbrt16.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(\color{blue}{\left(\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}\right) \cdot \sqrt[3]{\log \left(-x.re\right)}\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    6. Applied associate-*l*16.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(\color{blue}{\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}\right) \cdot \left(\sqrt[3]{\log \left(-x.re\right)} \cdot y.im\right)} + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    7. Using strategy rm
    8. Applied add-cube-cbrt16.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(\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\color{blue}{\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}\right) \cdot \sqrt[3]{\log \left(-x.re\right)}}}\right) \cdot \left(\sqrt[3]{\log \left(-x.re\right)} \cdot y.im\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    9. Applied cbrt-prod16.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(\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \color{blue}{\left(\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}} \cdot \sqrt[3]{\sqrt[3]{\log \left(-x.re\right)}}\right)}\right) \cdot \left(\sqrt[3]{\log \left(-x.re\right)} \cdot y.im\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    10. Using strategy rm
    11. Applied add-cube-cbrt16.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(\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \left(\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}} \cdot \sqrt[3]{\sqrt[3]{\color{blue}{\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}\right) \cdot \sqrt[3]{\log \left(-x.re\right)}}}}\right)\right) \cdot \left(\sqrt[3]{\log \left(-x.re\right)} \cdot y.im\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    12. Applied cbrt-prod16.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(\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \left(\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}} \cdot \sqrt[3]{\color{blue}{\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}} \cdot \sqrt[3]{\sqrt[3]{\log \left(-x.re\right)}}}}\right)\right) \cdot \left(\sqrt[3]{\log \left(-x.re\right)} \cdot y.im\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    13. Applied cbrt-prod16.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(\left(\sqrt[3]{\log \left(-x.re\right)} \cdot \left(\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}} \cdot \color{blue}{\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)}}}\right)}\right)\right) \cdot \left(\sqrt[3]{\log \left(-x.re\right)} \cdot y.im\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]

    if -1.396871811187125e-192 < x.re < -2.270412975964221e-206

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -658593911.1636858:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\log \left(-x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{elif}\;x.re \le -1.396871811187125 \cdot 10^{-192} \lor \neg \left(x.re \le -2.270412975964221 \cdot 10^{-206}\right):\\ \;\;\;\;\sin \left(\left(\left(\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{\log \left(-x.re\right)}}}\right) \cdot \sqrt[3]{\sqrt[3]{\log \left(-x.re\right)} \cdot \sqrt[3]{\log \left(-x.re\right)}}\right) \cdot \sqrt[3]{\log \left(-x.re\right)}\right) \cdot \left(\sqrt[3]{\log \left(-x.re\right)} \cdot y.im\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\right)\\ \end{array}\]

Reproduce

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

start9.0s

Algorithm
intervals

setup157.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 31.1b

localize56.0ms

Local error

Found 4 expressions with local error:

35.0b
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
29.5b
(sqrt (+ (* x.re x.re) (* x.im x.im)))
29.5b
(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:

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

series320.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

187.0ms
(sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))
76.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
31.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))
25.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify733.0ms

Counts
27 → 61
Calls

27 calls. Slowest were:

163.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
128.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
98.0ms
(* -1 (* y.re (log (/ -1 x.re))))

prune1.1s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 12.1b

localize37.0ms

Local error

Found 4 expressions with local error:

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

rewrite37.0ms

Algorithm
rewrite-expression-head
Counts
4 → 47
Calls

4 calls. Slowest were:

20.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
6.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
5.0ms
(* (log (- x.re)) y.im)

series388.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

137.0ms
(sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re)))
112.0ms
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
108.0ms
(* (log (- x.re)) y.im)
31.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify651.0ms

Counts
23 → 59
Calls

23 calls. Slowest were:

140.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
77.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
73.0ms
(* -1 (* y.re (log (/ -1 x.re))))

prune1.1s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 5.5b

localize29.0ms

Local error

Found 4 expressions with local error:

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

rewrite46.0ms

Algorithm
rewrite-expression-head
Counts
4 → 46
Calls

4 calls. Slowest were:

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

series965.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

444.0ms
(cbrt (log (- x.re)))
356.0ms
(cbrt (log (- x.re)))
141.0ms
(sin (+ (* (* (cbrt (log (- x.re))) (cbrt (log (- x.re)))) (* (cbrt (log (- x.re))) y.im)) (* (atan2 x.im x.re) y.re)))
24.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify474.0ms

Counts
27 → 58
Calls

27 calls. Slowest were:

117.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
95.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))
73.0ms
(sin (- (* (atan2 x.im x.re) y.re) (* y.im (log (/ -1 x.re)))))

prune1.4s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 5.5b

localize55.0ms

Local error

Found 4 expressions with local error:

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

rewrite215.0ms

Algorithm
rewrite-expression-head
Counts
4 → 49
Calls

4 calls. Slowest were:

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

series969.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

421.0ms
(cbrt (cbrt (log (- x.re))))
360.0ms
(cbrt (log (- x.re)))
156.0ms
(sin (+ (* (* (cbrt (log (- x.re))) (* (cbrt (* (cbrt (log (- x.re))) (cbrt (log (- x.re))))) (cbrt (cbrt (log (- x.re)))))) (* (cbrt (log (- x.re))) y.im)) (* (atan2 x.im x.re) y.re)))
31.0ms
(sqrt (+ (* x.re x.re) (* x.im x.im)))

simplify726.0ms

Counts
30 → 61
Calls

30 calls. Slowest were:

178.0ms
(sqrt (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))))
128.0ms
(* (sin (* (* (cbrt (log (- x.re))) (* (cbrt (* (cbrt (log (- x.re))) (cbrt (log (- x.re))))) (cbrt (cbrt (log (- x.re)))))) (* (cbrt (log (- x.re))) y.im))) (cos (* (atan2 x.im x.re) y.re)))
110.0ms
(sin (- (+ (* (atan2 x.im x.re) y.re) (* y.im (log -1))) (* y.im (log (/ 1 x.re)))))

prune1.4s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 5.5b

regimes701.0ms

Accuracy

44.5% (6.1b remaining)

Error of 11.1b against oracle of 5.0b and baseline of 16.0b

bsearch6.0s