?

Average Error: 33.3 → 5.6
Time: 29.5s
Precision: binary64
Cost: 26696

?

\[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 \cos \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} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;y.re \leq -6 \cdot 10^{-8}:\\ \;\;\;\;e^{\frac{y.re \cdot \log \left(x.re \cdot x.re + x.im \cdot x.im\right)}{2} - t_0} \cdot 1\\ \mathbf{elif}\;y.re \leq 12000:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{\log \left({x.im}^{2}\right) \cdot y.re}{2} - t_0} \cdot 1\\ \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (*
  (exp
   (-
    (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
    (* (atan2 x.im x.re) y.im)))
  (cos
   (+
    (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im)
    (* (atan2 x.im x.re) y.re)))))
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* (atan2 x.im x.re) y.im)))
   (if (<= y.re -6e-8)
     (*
      (exp (- (/ (* y.re (log (+ (* x.re x.re) (* x.im x.im)))) 2.0) t_0))
      1.0)
     (if (<= y.re 12000.0)
       (* (exp (* (atan2 x.im x.re) (- y.im))) 1.0)
       (* (exp (- (/ (* (log (pow x.im 2.0)) y.re) 2.0) t_0)) 1.0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	double tmp;
	if (y_46_re <= -6e-8) {
		tmp = exp((((y_46_re * log(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) / 2.0) - t_0)) * 1.0;
	} else if (y_46_re <= 12000.0) {
		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)) * 1.0;
	} else {
		tmp = exp((((log(pow(x_46_im, 2.0)) * y_46_re) / 2.0) - t_0)) * 1.0;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = atan2(x_46im, x_46re) * y_46im
    if (y_46re <= (-6d-8)) then
        tmp = exp((((y_46re * log(((x_46re * x_46re) + (x_46im * x_46im)))) / 2.0d0) - t_0)) * 1.0d0
    else if (y_46re <= 12000.0d0) then
        tmp = exp((atan2(x_46im, x_46re) * -y_46im)) * 1.0d0
    else
        tmp = exp((((log((x_46im ** 2.0d0)) * y_46re) / 2.0d0) - t_0)) * 1.0d0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
	double tmp;
	if (y_46_re <= -6e-8) {
		tmp = Math.exp((((y_46_re * Math.log(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) / 2.0) - t_0)) * 1.0;
	} else if (y_46_re <= 12000.0) {
		tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im)) * 1.0;
	} else {
		tmp = Math.exp((((Math.log(Math.pow(x_46_im, 2.0)) * y_46_re) / 2.0) - t_0)) * 1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.atan2(x_46_im, x_46_re) * y_46_im
	tmp = 0
	if y_46_re <= -6e-8:
		tmp = math.exp((((y_46_re * math.log(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) / 2.0) - t_0)) * 1.0
	elif y_46_re <= 12000.0:
		tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) * 1.0
	else:
		tmp = math.exp((((math.log(math.pow(x_46_im, 2.0)) * y_46_re) / 2.0) - t_0)) * 1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))))
end
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im)
	tmp = 0.0
	if (y_46_re <= -6e-8)
		tmp = Float64(exp(Float64(Float64(Float64(y_46_re * log(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) / 2.0) - t_0)) * 1.0);
	elseif (y_46_re <= 12000.0)
		tmp = Float64(exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))) * 1.0);
	else
		tmp = Float64(exp(Float64(Float64(Float64(log((x_46_im ^ 2.0)) * y_46_re) / 2.0) - t_0)) * 1.0);
	end
	return tmp
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	tmp = 0.0;
	if (y_46_re <= -6e-8)
		tmp = exp((((y_46_re * log(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) / 2.0) - t_0)) * 1.0;
	elseif (y_46_re <= 12000.0)
		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)) * 1.0;
	else
		tmp = exp((((log((x_46_im ^ 2.0)) * y_46_re) / 2.0) - t_0)) * 1.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[y$46$re, -6e-8], N[(N[Exp[N[(N[(N[(y$46$re * N[Log[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[y$46$re, 12000.0], N[(N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Exp[N[(N[(N[(N[Log[N[Power[x$46$im, 2.0], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] / 2.0), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
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 \cos \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}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;y.re \leq -6 \cdot 10^{-8}:\\
\;\;\;\;e^{\frac{y.re \cdot \log \left(x.re \cdot x.re + x.im \cdot x.im\right)}{2} - t_0} \cdot 1\\

\mathbf{elif}\;y.re \leq 12000:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot 1\\

\mathbf{else}:\\
\;\;\;\;e^{\frac{\log \left({x.im}^{2}\right) \cdot y.re}{2} - t_0} \cdot 1\\


\end{array}

Error?

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 < -5.99999999999999946e-8

    1. Initial program 36.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 \cos \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 in y.im around 0 1.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Taylor expanded in y.re around 0 1.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 \color{blue}{1} \]
    4. Applied egg-rr1.4

      \[\leadsto e^{\color{blue}{\frac{y.re \cdot \log \left(x.re \cdot x.re + x.im \cdot x.im\right)}{2}} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]

    if -5.99999999999999946e-8 < y.re < 12000

    1. Initial program 34.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 \cos \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 in y.im around 0 30.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Taylor expanded in y.re around 0 30.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}{1} \]
    4. Taylor expanded in y.re around 0 7.3

      \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot 1 \]
    5. Simplified7.3

      \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \cdot 1 \]
      Proof

      [Start]7.3

      \[ e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]

      rational.json-simplify-8 [=>]7.3

      \[ e^{\color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right) \cdot -1}} \cdot 1 \]

      rational.json-simplify-2 [=>]7.3

      \[ e^{\color{blue}{-1 \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}} \cdot 1 \]

      rational.json-simplify-43 [=>]7.3

      \[ e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(y.im \cdot -1\right)}} \cdot 1 \]

      rational.json-simplify-8 [<=]7.3

      \[ e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \color{blue}{\left(-y.im\right)}} \cdot 1 \]

    if 12000 < y.re

    1. Initial program 19.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 \cos \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 in y.im around 0 9.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Taylor expanded in y.re around 0 9.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 \color{blue}{1} \]
    4. Applied egg-rr9.9

      \[\leadsto e^{\color{blue}{\frac{y.re \cdot \log \left(x.re \cdot x.re + x.im \cdot x.im\right)}{2}} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    5. Taylor expanded in x.re around 0 6.7

      \[\leadsto e^{\frac{\color{blue}{\log \left({x.im}^{2}\right) \cdot y.re}}{2} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification5.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -6 \cdot 10^{-8}:\\ \;\;\;\;e^{\frac{y.re \cdot \log \left(x.re \cdot x.re + x.im \cdot x.im\right)}{2} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \mathbf{elif}\;y.re \leq 12000:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{\log \left({x.im}^{2}\right) \cdot y.re}{2} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \end{array} \]

Alternatives

Alternative 1
Error6.0
Cost20616
\[\begin{array}{l} t_0 := e^{\frac{y.re \cdot \log \left(x.re \cdot x.re + x.im \cdot x.im\right)}{2} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \mathbf{if}\;y.re \leq -3.55 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.re \leq 3.7 \cdot 10^{+30}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error14.9
Cost20104
\[\begin{array}{l} \mathbf{if}\;x.re \leq -2 \cdot 10^{+88}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right)} \cdot 1\\ \mathbf{elif}\;x.re \leq 8.6 \cdot 10^{-297}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \end{array} \]
Alternative 3
Error9.7
Cost20104
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;x.re \leq -2.45 \cdot 10^{-228}:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - t_0} \cdot 1\\ \mathbf{elif}\;x.re \leq 3 \cdot 10^{-294}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - t_0} \cdot 1\\ \end{array} \]
Alternative 4
Error9.7
Cost20036
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;x.im \leq -2 \cdot 10^{-310}:\\ \;\;\;\;e^{\log \left(-x.im\right) \cdot y.re - t_0} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.im \cdot y.re - t_0} \cdot 1\\ \end{array} \]
Alternative 5
Error15.3
Cost19972
\[\begin{array}{l} \mathbf{if}\;x.im \leq 1.9 \cdot 10^{-304}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.im \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \end{array} \]
Alternative 6
Error20.7
Cost13380
\[\begin{array}{l} \mathbf{if}\;y.re \leq 9.6 \cdot 10^{+142}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right)} \cdot 1\\ \end{array} \]
Alternative 7
Error31.1
Cost13316
\[\begin{array}{l} \mathbf{if}\;x.re \leq -3.1 \cdot 10^{-281}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\left(1 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot 1\\ \end{array} \]
Alternative 8
Error39.0
Cost6912
\[\left(1 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot 1 \]
Alternative 9
Error38.9
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023074 
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  :precision binary64
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))