
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
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
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.sin(((t_0 * 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.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
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
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.sin(((t_0 * 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.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_3 (* (exp (- (* t_2 y.re) t_0)) (sin (+ (* t_2 y.im) t_1))))
(t_4 (log (hypot x.re x.im)))
(t_5 (exp (- (* y.re t_4) t_0))))
(if (<= t_3 0.5)
(* t_5 (sin (fma t_4 y.im t_1)))
(if (<= t_3 INFINITY)
(* t_1 t_5)
(* t_5 (sin (fma t_4 y.im (pow (cbrt t_1) 3.0))))))))
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 t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_3 = exp(((t_2 * y_46_re) - t_0)) * sin(((t_2 * y_46_im) + t_1));
double t_4 = log(hypot(x_46_re, x_46_im));
double t_5 = exp(((y_46_re * t_4) - t_0));
double tmp;
if (t_3 <= 0.5) {
tmp = t_5 * sin(fma(t_4, y_46_im, t_1));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_1 * t_5;
} else {
tmp = t_5 * sin(fma(t_4, y_46_im, pow(cbrt(t_1), 3.0)));
}
return tmp;
}
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) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_3 = Float64(exp(Float64(Float64(t_2 * y_46_re) - t_0)) * sin(Float64(Float64(t_2 * y_46_im) + t_1))) t_4 = log(hypot(x_46_re, x_46_im)) t_5 = exp(Float64(Float64(y_46_re * t_4) - t_0)) tmp = 0.0 if (t_3 <= 0.5) tmp = Float64(t_5 * sin(fma(t_4, y_46_im, t_1))); elseif (t_3 <= Inf) tmp = Float64(t_1 * t_5); else tmp = Float64(t_5 * sin(fma(t_4, y_46_im, (cbrt(t_1) ^ 3.0)))); end return tmp end
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]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Exp[N[(N[(t$95$2 * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(t$95$2 * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Exp[N[(N[(y$46$re * t$95$4), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 0.5], N[(t$95$5 * N[Sin[N[(t$95$4 * y$46$im + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(t$95$1 * t$95$5), $MachinePrecision], N[(t$95$5 * N[Sin[N[(t$95$4 * y$46$im + N[Power[N[Power[t$95$1, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_3 := e^{t_2 \cdot y.re - t_0} \cdot \sin \left(t_2 \cdot y.im + t_1\right)\\
t_4 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_5 := e^{y.re \cdot t_4 - t_0}\\
\mathbf{if}\;t_3 \leq 0.5:\\
\;\;\;\;t_5 \cdot \sin \left(\mathsf{fma}\left(t_4, y.im, t_1\right)\right)\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_1 \cdot t_5\\
\mathbf{else}:\\
\;\;\;\;t_5 \cdot \sin \left(\mathsf{fma}\left(t_4, y.im, {\left(\sqrt[3]{t_1}\right)}^{3}\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < 0.5Initial program 85.6%
*-commutative85.6%
hypot-def85.6%
fma-def85.6%
hypot-def85.6%
*-commutative85.6%
Simplified85.6%
if 0.5 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0Initial program 27.4%
*-commutative27.4%
hypot-def27.4%
fma-def27.4%
hypot-def27.4%
*-commutative27.4%
Simplified27.4%
Taylor expanded in y.im around 0 50.3%
Taylor expanded in y.re around 0 63.9%
if +inf.0 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 0.0%
*-commutative0.0%
hypot-def0.0%
fma-def0.0%
hypot-def83.4%
*-commutative83.4%
Simplified83.4%
add-cube-cbrt82.4%
pow384.9%
Applied egg-rr84.9%
Final simplification83.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (* (atan2 x.im x.re) y.im))
(t_2 (* y.re (atan2 x.im x.re)))
(t_3 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_4 (* (exp (- (* t_3 y.re) t_1)) (sin (+ (* t_3 y.im) t_2))))
(t_5 (exp (- (* y.re t_0) t_1))))
(if (or (<= t_4 0.5) (not (<= t_4 INFINITY)))
(* t_5 (sin (fma t_0 y.im t_2)))
(* t_2 t_5))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = atan2(x_46_im, x_46_re) * y_46_im;
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double t_3 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_4 = exp(((t_3 * y_46_re) - t_1)) * sin(((t_3 * y_46_im) + t_2));
double t_5 = exp(((y_46_re * t_0) - t_1));
double tmp;
if ((t_4 <= 0.5) || !(t_4 <= ((double) INFINITY))) {
tmp = t_5 * sin(fma(t_0, y_46_im, t_2));
} else {
tmp = t_2 * t_5;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_3 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_4 = Float64(exp(Float64(Float64(t_3 * y_46_re) - t_1)) * sin(Float64(Float64(t_3 * y_46_im) + t_2))) t_5 = exp(Float64(Float64(y_46_re * t_0) - t_1)) tmp = 0.0 if ((t_4 <= 0.5) || !(t_4 <= Inf)) tmp = Float64(t_5 * sin(fma(t_0, y_46_im, t_2))); else tmp = Float64(t_2 * t_5); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Exp[N[(N[(t$95$3 * y$46$re), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(t$95$3 * y$46$im), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Exp[N[(N[(y$46$re * t$95$0), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t$95$4, 0.5], N[Not[LessEqual[t$95$4, Infinity]], $MachinePrecision]], N[(t$95$5 * N[Sin[N[(t$95$0 * y$46$im + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * t$95$5), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_3 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_4 := e^{t_3 \cdot y.re - t_1} \cdot \sin \left(t_3 \cdot y.im + t_2\right)\\
t_5 := e^{y.re \cdot t_0 - t_1}\\
\mathbf{if}\;t_4 \leq 0.5 \lor \neg \left(t_4 \leq \infty\right):\\
\;\;\;\;t_5 \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, t_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot t_5\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < 0.5 or +inf.0 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 41.7%
*-commutative41.7%
hypot-def41.7%
fma-def41.7%
hypot-def84.5%
*-commutative84.5%
Simplified84.5%
if 0.5 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0Initial program 27.4%
*-commutative27.4%
hypot-def27.4%
fma-def27.4%
hypot-def27.4%
*-commutative27.4%
Simplified27.4%
Taylor expanded in y.im around 0 50.3%
Taylor expanded in y.re around 0 63.9%
Final simplification82.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (exp (- (* y.re t_0) (* (atan2 x.im x.re) y.im)))))
(if (<= y.re -2.5e-16)
(* t_1 t_2)
(if (<= y.re 7.2e-73)
(*
(sin (fma y.re (atan2 x.im x.re) (* y.im t_0)))
(exp (* (atan2 x.im x.re) (- y.im))))
(* t_2 (sin t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = exp(((y_46_re * t_0) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= -2.5e-16) {
tmp = t_1 * t_2;
} else if (y_46_re <= 7.2e-73) {
tmp = sin(fma(y_46_re, atan2(x_46_im, x_46_re), (y_46_im * t_0))) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = t_2 * sin(t_1);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = exp(Float64(Float64(y_46_re * t_0) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (y_46_re <= -2.5e-16) tmp = Float64(t_1 * t_2); elseif (y_46_re <= 7.2e-73) tmp = Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(y_46_im * t_0))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); else tmp = Float64(t_2 * sin(t_1)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(y$46$re * t$95$0), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -2.5e-16], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[y$46$re, 7.2e-73], N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(y$46$im * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := e^{y.re \cdot t_0 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq -2.5 \cdot 10^{-16}:\\
\;\;\;\;t_1 \cdot t_2\\
\mathbf{elif}\;y.re \leq 7.2 \cdot 10^{-73}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, y.im \cdot t_0\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \sin t_1\\
\end{array}
\end{array}
if y.re < -2.5000000000000002e-16Initial program 36.4%
*-commutative36.4%
hypot-def36.4%
fma-def36.4%
hypot-def83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in y.im around 0 86.4%
Taylor expanded in y.re around 0 87.9%
if -2.5000000000000002e-16 < y.re < 7.1999999999999999e-73Initial program 44.0%
Simplified79.3%
Taylor expanded in y.re around 0 80.9%
rec-exp80.9%
Simplified80.9%
if 7.1999999999999999e-73 < y.re Initial program 38.2%
*-commutative38.2%
hypot-def38.2%
fma-def38.2%
hypot-def73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in y.im around 0 75.0%
Final simplification81.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)) (t_1 (* y.re (atan2 x.im x.re))))
(if (<= x.re -1.15e-8)
(* (sin t_1) (exp (- (* (log (/ -1.0 x.re)) (- y.re)) t_0)))
(if (<= x.re 9.5e-85)
(* t_1 (exp (- (* y.re (log (hypot x.re x.im))) t_0)))
(*
(exp (- (* y.re (log x.re)) t_0))
(sin (+ t_1 (* y.im (log x.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 t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -1.15e-8) {
tmp = sin(t_1) * exp(((log((-1.0 / x_46_re)) * -y_46_re) - t_0));
} else if (x_46_re <= 9.5e-85) {
tmp = t_1 * exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - t_0)) * sin((t_1 + (y_46_im * log(x_46_re))));
}
return tmp;
}
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 t_1 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -1.15e-8) {
tmp = Math.sin(t_1) * Math.exp(((Math.log((-1.0 / x_46_re)) * -y_46_re) - t_0));
} else if (x_46_re <= 9.5e-85) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - t_0));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - t_0)) * Math.sin((t_1 + (y_46_im * Math.log(x_46_re))));
}
return tmp;
}
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 t_1 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -1.15e-8: tmp = math.sin(t_1) * math.exp(((math.log((-1.0 / x_46_re)) * -y_46_re) - t_0)) elif x_46_re <= 9.5e-85: tmp = t_1 * math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - t_0)) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - t_0)) * math.sin((t_1 + (y_46_im * math.log(x_46_re)))) return tmp
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) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= -1.15e-8) tmp = Float64(sin(t_1) * exp(Float64(Float64(log(Float64(-1.0 / x_46_re)) * Float64(-y_46_re)) - t_0))); elseif (x_46_re <= 9.5e-85) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - t_0))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)) * sin(Float64(t_1 + Float64(y_46_im * log(x_46_re))))); end return tmp 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; t_1 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -1.15e-8) tmp = sin(t_1) * exp(((log((-1.0 / x_46_re)) * -y_46_re) - t_0)); elseif (x_46_re <= 9.5e-85) tmp = t_1 * exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_0)); else tmp = exp(((y_46_re * log(x_46_re)) - t_0)) * sin((t_1 + (y_46_im * log(x_46_re)))); end tmp_2 = tmp; end
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]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -1.15e-8], N[(N[Sin[t$95$1], $MachinePrecision] * N[Exp[N[(N[(N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision] * (-y$46$re)), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 9.5e-85], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(t$95$1 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -1.15 \cdot 10^{-8}:\\
\;\;\;\;\sin t_1 \cdot e^{\log \left(\frac{-1}{x.re}\right) \cdot \left(-y.re\right) - t_0}\\
\mathbf{elif}\;x.re \leq 9.5 \cdot 10^{-85}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t_0} \cdot \sin \left(t_1 + y.im \cdot \log x.re\right)\\
\end{array}
\end{array}
if x.re < -1.15e-8Initial program 38.0%
*-commutative38.0%
hypot-def38.0%
fma-def38.0%
hypot-def83.1%
*-commutative83.1%
Simplified83.1%
Taylor expanded in y.im around 0 72.9%
Taylor expanded in x.re around -inf 73.0%
*-commutative73.0%
mul-1-neg73.0%
distribute-rgt-neg-in73.0%
*-commutative73.0%
Simplified73.0%
if -1.15e-8 < x.re < 9.49999999999999964e-85Initial program 41.3%
*-commutative41.3%
hypot-def41.3%
fma-def41.3%
hypot-def82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in y.im around 0 68.8%
Taylor expanded in y.re around 0 73.0%
if 9.49999999999999964e-85 < x.re Initial program 41.7%
Taylor expanded in x.re around inf 51.2%
Taylor expanded in x.re around inf 64.5%
Final simplification70.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)) (t_1 (* y.re (atan2 x.im x.re))))
(if (<= x.re -1.4e-8)
(* (sin t_1) (exp (- (* (log (/ -1.0 x.re)) (- y.re)) t_0)))
(* t_1 (exp (- (* y.re (log (hypot x.re x.im))) t_0))))))
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 t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -1.4e-8) {
tmp = sin(t_1) * exp(((log((-1.0 / x_46_re)) * -y_46_re) - t_0));
} else {
tmp = t_1 * exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_0));
}
return tmp;
}
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 t_1 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -1.4e-8) {
tmp = Math.sin(t_1) * Math.exp(((Math.log((-1.0 / x_46_re)) * -y_46_re) - t_0));
} else {
tmp = t_1 * Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - t_0));
}
return tmp;
}
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 t_1 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -1.4e-8: tmp = math.sin(t_1) * math.exp(((math.log((-1.0 / x_46_re)) * -y_46_re) - t_0)) else: tmp = t_1 * math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - t_0)) return tmp
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) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= -1.4e-8) tmp = Float64(sin(t_1) * exp(Float64(Float64(log(Float64(-1.0 / x_46_re)) * Float64(-y_46_re)) - t_0))); else tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - t_0))); end return tmp 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; t_1 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -1.4e-8) tmp = sin(t_1) * exp(((log((-1.0 / x_46_re)) * -y_46_re) - t_0)); else tmp = t_1 * exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_0)); end tmp_2 = tmp; end
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]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -1.4e-8], N[(N[Sin[t$95$1], $MachinePrecision] * N[Exp[N[(N[(N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision] * (-y$46$re)), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -1.4 \cdot 10^{-8}:\\
\;\;\;\;\sin t_1 \cdot e^{\log \left(\frac{-1}{x.re}\right) \cdot \left(-y.re\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - t_0}\\
\end{array}
\end{array}
if x.re < -1.4e-8Initial program 38.0%
*-commutative38.0%
hypot-def38.0%
fma-def38.0%
hypot-def83.1%
*-commutative83.1%
Simplified83.1%
Taylor expanded in y.im around 0 72.9%
Taylor expanded in x.re around -inf 73.0%
*-commutative73.0%
mul-1-neg73.0%
distribute-rgt-neg-in73.0%
*-commutative73.0%
Simplified73.0%
if -1.4e-8 < x.re Initial program 41.4%
*-commutative41.4%
hypot-def41.4%
fma-def41.4%
hypot-def78.2%
*-commutative78.2%
Simplified78.2%
Taylor expanded in y.im around 0 59.3%
Taylor expanded in y.re around 0 61.5%
Final simplification64.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= x.im 8e-309)
(* y.re (* (atan2 x.im x.re) (exp (* (atan2 x.im x.re) (- y.im)))))
(*
(sin (* y.re (atan2 x.im x.re)))
(exp (- (* y.re (log x.im)) (* (atan2 x.im x.re) y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= 8e-309) {
tmp = y_46_re * (atan2(x_46_im, x_46_re) * exp((atan2(x_46_im, x_46_re) * -y_46_im)));
} else {
tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
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
real(8) :: tmp
if (x_46im <= 8d-309) then
tmp = y_46re * (atan2(x_46im, x_46re) * exp((atan2(x_46im, x_46re) * -y_46im)))
else
tmp = sin((y_46re * atan2(x_46im, x_46re))) * exp(((y_46re * log(x_46im)) - (atan2(x_46im, x_46re) * y_46im)))
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) {
double tmp;
if (x_46_im <= 8e-309) {
tmp = y_46_re * (Math.atan2(x_46_im, x_46_re) * Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im)));
} else {
tmp = Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.exp(((y_46_re * Math.log(x_46_im)) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_im <= 8e-309: tmp = y_46_re * (math.atan2(x_46_im, x_46_re) * math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))) else: tmp = math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) * math.exp(((y_46_re * math.log(x_46_im)) - (math.atan2(x_46_im, x_46_re) * y_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_im <= 8e-309) tmp = Float64(y_46_re * Float64(atan(x_46_im, x_46_re) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))))); else tmp = Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) * exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(atan(x_46_im, x_46_re) * y_46_im)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_im <= 8e-309) tmp = y_46_re * (atan2(x_46_im, x_46_re) * exp((atan2(x_46_im, x_46_re) * -y_46_im))); else tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, 8e-309], N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 8 \cdot 10^{-309}:\\
\;\;\;\;y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.im < 8.0000000000000003e-309Initial program 39.5%
*-commutative39.5%
hypot-def39.5%
fma-def39.5%
hypot-def79.4%
*-commutative79.4%
Simplified79.4%
Taylor expanded in y.im around 0 64.0%
Taylor expanded in y.re around 0 45.6%
*-commutative45.6%
distribute-lft-neg-in45.6%
*-commutative45.6%
Simplified45.6%
if 8.0000000000000003e-309 < x.im Initial program 41.5%
*-commutative41.5%
hypot-def41.5%
fma-def41.5%
hypot-def79.7%
*-commutative79.7%
Simplified79.7%
Taylor expanded in y.im around 0 62.1%
Taylor expanded in x.re around 0 54.3%
*-commutative54.3%
*-commutative54.3%
Simplified54.3%
Final simplification49.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (* y.re (atan2 x.im x.re)) (exp (- (* y.re (log (hypot x.re x.im))) (* (atan2 x.im x.re) y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return (y_46_re * atan2(x_46_im, x_46_re)) * exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return (y_46_re * Math.atan2(x_46_im, x_46_re)) * Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return (y_46_re * math.atan2(x_46_im, x_46_re)) * math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) * exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - Float64(atan(x_46_im, x_46_re) * y_46_im)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = (y_46_re * atan2(x_46_im, x_46_re)) * exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
\end{array}
Initial program 40.5%
*-commutative40.5%
hypot-def40.5%
fma-def40.5%
hypot-def79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in y.im around 0 63.1%
Taylor expanded in y.re around 0 63.1%
Final simplification63.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* y.re (* (atan2 x.im x.re) (exp (* (atan2 x.im x.re) (- y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return y_46_re * (atan2(x_46_im, x_46_re) * exp((atan2(x_46_im, x_46_re) * -y_46_im)));
}
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 = y_46re * (atan2(x_46im, x_46re) * exp((atan2(x_46im, x_46re) * -y_46im)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return y_46_re * (Math.atan2(x_46_im, x_46_re) * Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return y_46_re * (math.atan2(x_46_im, x_46_re) * math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(y_46_re * Float64(atan(x_46_im, x_46_re) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = y_46_re * (atan2(x_46_im, x_46_re) * exp((atan2(x_46_im, x_46_re) * -y_46_im))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\right)
\end{array}
Initial program 40.5%
*-commutative40.5%
hypot-def40.5%
fma-def40.5%
hypot-def79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in y.im around 0 63.1%
Taylor expanded in y.re around 0 43.5%
*-commutative43.5%
distribute-lft-neg-in43.5%
*-commutative43.5%
Simplified43.5%
Final simplification43.5%
herbie shell --seed 2023326
(FPCore (x.re x.im y.re y.im)
:name "powComplex, imaginary part"
:precision binary64
(* (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)))))