
(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)))
(cos (+ (* 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))) * cos(((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))) * cos(((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.cos(((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.cos(((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))) * cos(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))) * cos(((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[Cos[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 \cos \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 15 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)))
(cos (+ (* 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))) * cos(((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))) * cos(((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.cos(((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.cos(((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))) * cos(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))) * cos(((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[Cos[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 \cos \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 (log (hypot x.im x.re))))
(if (or (<= y.re -5e+31) (not (<= y.re 3e+143)))
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos (* y.im t_0)))
(*
(exp (fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im))))
(cos (* y.im (+ t_0 (/ (* y.re (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 t_0 = log(hypot(x_46_im, x_46_re));
double tmp;
if ((y_46_re <= -5e+31) || !(y_46_re <= 3e+143)) {
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((y_46_im * t_0));
} else {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos((y_46_im * (t_0 + ((y_46_re * 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) t_0 = log(hypot(x_46_im, x_46_re)) tmp = 0.0 if ((y_46_re <= -5e+31) || !(y_46_re <= 3e+143)) tmp = 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(y_46_im * t_0))); else tmp = Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(Float64(y_46_im * Float64(t_0 + Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) / y_46_im))))); 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$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y$46$re, -5e+31], N[Not[LessEqual[y$46$re, 3e+143]], $MachinePrecision]], 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[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[(t$95$0 + N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;y.re \leq -5 \cdot 10^{+31} \lor \neg \left(y.re \leq 3 \cdot 10^{+143}\right):\\
\;\;\;\;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(y.im \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(y.im \cdot \left(t\_0 + \frac{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.im}\right)\right)\\
\end{array}
\end{array}
if y.re < -5.00000000000000027e31 or 3.0000000000000001e143 < y.re Initial program 37.8%
Taylor expanded in y.re around 0 42.2%
*-commutative42.2%
unpow242.2%
unpow242.2%
hypot-undefine84.5%
Simplified84.5%
if -5.00000000000000027e31 < y.re < 3.0000000000000001e143Initial program 36.8%
fmm-def36.8%
hypot-define36.8%
distribute-rgt-neg-out36.8%
fma-define36.8%
hypot-define78.8%
*-commutative78.8%
Simplified78.8%
Taylor expanded in y.im around inf 36.8%
unpow236.8%
unpow236.8%
hypot-undefine78.2%
Simplified78.2%
Final simplification80.4%
(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 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_3 (exp (- (* t_2 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= (* t_3 (cos (+ (* t_2 y.im) t_1))) INFINITY)
(* t_3 (cos (* y.im (log (hypot x.im x.re)))))
(*
(exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_0 y.im 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 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_3 = exp(((t_2 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if ((t_3 * cos(((t_2 * y_46_im) + t_1))) <= ((double) INFINITY)) {
tmp = t_3 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
} else {
tmp = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_0, y_46_im, 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 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_3 = exp(Float64(Float64(t_2 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (Float64(t_3 * cos(Float64(Float64(t_2 * y_46_im) + t_1))) <= Inf) tmp = Float64(t_3 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))); else tmp = Float64(exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_0, y_46_im, 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[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[Exp[N[(N[(t$95$2 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 * N[Cos[N[(N[(t$95$2 * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$3 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(t$95$0 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + t$95$1), $MachinePrecision]], $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 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_3 := e^{t\_2 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;t\_3 \cdot \cos \left(t\_2 \cdot y.im + t\_1\right) \leq \infty:\\
\;\;\;\;t\_3 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t\_0, y.im, t\_1\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))) (cos.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 77.3%
Taylor expanded in y.re around 0 81.7%
*-commutative81.7%
unpow281.7%
unpow281.7%
hypot-undefine81.7%
Simplified81.7%
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))) (cos.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%
fmm-def0.0%
hypot-define0.0%
distribute-rgt-neg-out0.0%
fma-define0.0%
hypot-define78.0%
*-commutative78.0%
Simplified78.0%
Final simplification79.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.im (log (hypot x.im x.re))))))
(if (or (<= y.re -0.0035) (not (<= y.re 2.4e-14)))
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
t_0)
(* t_0 (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) {
double t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double tmp;
if ((y_46_re <= -0.0035) || !(y_46_re <= 2.4e-14)) {
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))) * t_0;
} else {
tmp = t_0 * exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
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.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double tmp;
if ((y_46_re <= -0.0035) || !(y_46_re <= 2.4e-14)) {
tmp = 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))) * t_0;
} else {
tmp = t_0 * Math.exp((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): t_0 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) tmp = 0 if (y_46_re <= -0.0035) or not (y_46_re <= 2.4e-14): tmp = 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))) * t_0 else: tmp = t_0 * math.exp((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) t_0 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) tmp = 0.0 if ((y_46_re <= -0.0035) || !(y_46_re <= 2.4e-14)) tmp = 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))) * t_0); else tmp = Float64(t_0 * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))); tmp = 0.0; if ((y_46_re <= -0.0035) || ~((y_46_re <= 2.4e-14))) 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))) * t_0; else tmp = t_0 * exp((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_] := Block[{t$95$0 = N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y$46$re, -0.0035], N[Not[LessEqual[y$46$re, 2.4e-14]], $MachinePrecision]], 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] * t$95$0), $MachinePrecision], N[(t$95$0 * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{if}\;y.re \leq -0.0035 \lor \neg \left(y.re \leq 2.4 \cdot 10^{-14}\right):\\
\;\;\;\;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 t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -0.00350000000000000007 or 2.4e-14 < y.re Initial program 38.5%
Taylor expanded in y.re around 0 42.6%
*-commutative42.6%
unpow242.6%
unpow242.6%
hypot-undefine80.4%
Simplified80.4%
if -0.00350000000000000007 < y.re < 2.4e-14Initial program 35.8%
fmm-def35.8%
hypot-define35.8%
distribute-rgt-neg-out35.8%
fma-define35.8%
hypot-define77.6%
*-commutative77.6%
Simplified77.6%
Taylor expanded in y.re around 0 35.8%
*-commutative35.8%
unpow235.8%
unpow235.8%
hypot-undefine77.6%
neg-mul-177.6%
distribute-rgt-neg-in77.6%
Simplified77.6%
Final simplification79.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (/ -1.0 x.re)))
(t_1 (* (atan2 x.im x.re) y.im))
(t_2 (* y.re (atan2 x.im x.re))))
(if (<= x.re -3.6e-304)
(* (cos (* y.im t_0)) (exp (- (* t_0 (- y.re)) t_1)))
(if (<= x.re 3.2e-69)
(*
(exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_1))
(cos t_2))
(*
(cos (+ t_2 (* y.im (log x.re))))
(exp (- (* y.re (log x.re)) t_1)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log((-1.0 / x_46_re));
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 tmp;
if (x_46_re <= -3.6e-304) {
tmp = cos((y_46_im * t_0)) * exp(((t_0 * -y_46_re) - t_1));
} else if (x_46_re <= 3.2e-69) {
tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_1)) * cos(t_2);
} else {
tmp = cos((t_2 + (y_46_im * log(x_46_re)))) * exp(((y_46_re * log(x_46_re)) - t_1));
}
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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = log(((-1.0d0) / x_46re))
t_1 = atan2(x_46im, x_46re) * y_46im
t_2 = y_46re * atan2(x_46im, x_46re)
if (x_46re <= (-3.6d-304)) then
tmp = cos((y_46im * t_0)) * exp(((t_0 * -y_46re) - t_1))
else if (x_46re <= 3.2d-69) then
tmp = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - t_1)) * cos(t_2)
else
tmp = cos((t_2 + (y_46im * log(x_46re)))) * exp(((y_46re * log(x_46re)) - t_1))
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 t_0 = Math.log((-1.0 / x_46_re));
double t_1 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_2 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -3.6e-304) {
tmp = Math.cos((y_46_im * t_0)) * Math.exp(((t_0 * -y_46_re) - t_1));
} else if (x_46_re <= 3.2e-69) {
tmp = Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_1)) * Math.cos(t_2);
} else {
tmp = Math.cos((t_2 + (y_46_im * Math.log(x_46_re)))) * Math.exp(((y_46_re * Math.log(x_46_re)) - t_1));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log((-1.0 / x_46_re)) t_1 = math.atan2(x_46_im, x_46_re) * y_46_im t_2 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -3.6e-304: tmp = math.cos((y_46_im * t_0)) * math.exp(((t_0 * -y_46_re) - t_1)) elif x_46_re <= 3.2e-69: tmp = math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_1)) * math.cos(t_2) else: tmp = math.cos((t_2 + (y_46_im * math.log(x_46_re)))) * math.exp(((y_46_re * math.log(x_46_re)) - t_1)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(Float64(-1.0 / x_46_re)) 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)) tmp = 0.0 if (x_46_re <= -3.6e-304) tmp = Float64(cos(Float64(y_46_im * t_0)) * exp(Float64(Float64(t_0 * Float64(-y_46_re)) - t_1))); elseif (x_46_re <= 3.2e-69) tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - t_1)) * cos(t_2)); else tmp = Float64(cos(Float64(t_2 + Float64(y_46_im * log(x_46_re)))) * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_1))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log((-1.0 / x_46_re)); t_1 = atan2(x_46_im, x_46_re) * y_46_im; t_2 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -3.6e-304) tmp = cos((y_46_im * t_0)) * exp(((t_0 * -y_46_re) - t_1)); elseif (x_46_re <= 3.2e-69) tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_1)) * cos(t_2); else tmp = cos((t_2 + (y_46_im * log(x_46_re)))) * exp(((y_46_re * log(x_46_re)) - t_1)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[(-1.0 / x$46$re), $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]}, If[LessEqual[x$46$re, -3.6e-304], N[(N[Cos[N[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(t$95$0 * (-y$46$re)), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 3.2e-69], 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] - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(t$95$2 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\frac{-1}{x.re}\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}\\
\mathbf{if}\;x.re \leq -3.6 \cdot 10^{-304}:\\
\;\;\;\;\cos \left(y.im \cdot t\_0\right) \cdot e^{t\_0 \cdot \left(-y.re\right) - t\_1}\\
\mathbf{elif}\;x.re \leq 3.2 \cdot 10^{-69}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t\_1} \cdot \cos t\_2\\
\mathbf{else}:\\
\;\;\;\;\cos \left(t\_2 + y.im \cdot \log x.re\right) \cdot e^{y.re \cdot \log x.re - t\_1}\\
\end{array}
\end{array}
if x.re < -3.6000000000000001e-304Initial program 38.9%
fmm-def38.9%
hypot-define38.9%
distribute-rgt-neg-out38.9%
fma-define38.9%
hypot-define82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in x.re around -inf 77.6%
+-commutative77.6%
mul-1-neg77.6%
unsub-neg77.6%
*-commutative77.6%
+-commutative77.6%
neg-mul-177.6%
unsub-neg77.6%
mul-1-neg77.6%
distribute-rgt-neg-in77.6%
Simplified77.6%
Taylor expanded in y.re around 0 80.0%
cos-neg80.0%
Simplified80.0%
if -3.6000000000000001e-304 < x.re < 3.19999999999999999e-69Initial program 45.7%
Taylor expanded in y.im around 0 67.7%
if 3.19999999999999999e-69 < x.re Initial program 29.2%
hypot-define50.9%
add-exp-log44.7%
Applied egg-rr44.7%
rem-exp-log50.9%
*-commutative50.9%
add-cube-cbrt53.1%
pow353.7%
*-commutative53.7%
Applied egg-rr53.7%
Taylor expanded in x.im around 0 73.3%
Final simplification75.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)) (t_1 (log (/ -1.0 x.re))))
(if (<= x.re -1e-307)
(* (cos (* y.im t_1)) (exp (- (* t_1 (- y.re)) t_0)))
(*
(cos (+ (* y.re (atan2 x.im x.re)) (* y.im (log x.re))))
(exp (- (* y.re (log x.re)) 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 = log((-1.0 / x_46_re));
double tmp;
if (x_46_re <= -1e-307) {
tmp = cos((y_46_im * t_1)) * exp(((t_1 * -y_46_re) - t_0));
} else {
tmp = cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_re)))) * exp(((y_46_re * log(x_46_re)) - t_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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = atan2(x_46im, x_46re) * y_46im
t_1 = log(((-1.0d0) / x_46re))
if (x_46re <= (-1d-307)) then
tmp = cos((y_46im * t_1)) * exp(((t_1 * -y_46re) - t_0))
else
tmp = cos(((y_46re * atan2(x_46im, x_46re)) + (y_46im * log(x_46re)))) * exp(((y_46re * log(x_46re)) - t_0))
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 t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.log((-1.0 / x_46_re));
double tmp;
if (x_46_re <= -1e-307) {
tmp = Math.cos((y_46_im * t_1)) * Math.exp(((t_1 * -y_46_re) - t_0));
} else {
tmp = Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) + (y_46_im * Math.log(x_46_re)))) * Math.exp(((y_46_re * Math.log(x_46_re)) - 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 = math.log((-1.0 / x_46_re)) tmp = 0 if x_46_re <= -1e-307: tmp = math.cos((y_46_im * t_1)) * math.exp(((t_1 * -y_46_re) - t_0)) else: tmp = math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) + (y_46_im * math.log(x_46_re)))) * math.exp(((y_46_re * math.log(x_46_re)) - 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 = log(Float64(-1.0 / x_46_re)) tmp = 0.0 if (x_46_re <= -1e-307) tmp = Float64(cos(Float64(y_46_im * t_1)) * exp(Float64(Float64(t_1 * Float64(-y_46_re)) - t_0))); else tmp = Float64(cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) + Float64(y_46_im * log(x_46_re)))) * exp(Float64(Float64(y_46_re * log(x_46_re)) - 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 = log((-1.0 / x_46_re)); tmp = 0.0; if (x_46_re <= -1e-307) tmp = cos((y_46_im * t_1)) * exp(((t_1 * -y_46_re) - t_0)); else tmp = cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_re)))) * exp(((y_46_re * log(x_46_re)) - 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[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -1e-307], N[(N[Cos[N[(y$46$im * t$95$1), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(t$95$1 * (-y$46$re)), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $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 := \log \left(\frac{-1}{x.re}\right)\\
\mathbf{if}\;x.re \leq -1 \cdot 10^{-307}:\\
\;\;\;\;\cos \left(y.im \cdot t\_1\right) \cdot e^{t\_1 \cdot \left(-y.re\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.re\right) \cdot e^{y.re \cdot \log x.re - t\_0}\\
\end{array}
\end{array}
if x.re < -9.99999999999999909e-308Initial program 38.9%
fmm-def38.9%
hypot-define38.9%
distribute-rgt-neg-out38.9%
fma-define38.9%
hypot-define82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in x.re around -inf 77.6%
+-commutative77.6%
mul-1-neg77.6%
unsub-neg77.6%
*-commutative77.6%
+-commutative77.6%
neg-mul-177.6%
unsub-neg77.6%
mul-1-neg77.6%
distribute-rgt-neg-in77.6%
Simplified77.6%
Taylor expanded in y.re around 0 80.0%
cos-neg80.0%
Simplified80.0%
if -9.99999999999999909e-308 < x.re Initial program 35.4%
hypot-define56.0%
add-exp-log41.8%
Applied egg-rr41.8%
rem-exp-log56.0%
*-commutative56.0%
add-cube-cbrt59.7%
pow360.1%
*-commutative60.1%
Applied egg-rr60.1%
Taylor expanded in x.im around 0 67.9%
Final simplification73.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.im -0.000165) (not (<= y.im 0.0012)))
(*
(cos (* y.im (log (hypot x.im x.re))))
(exp (* (atan2 x.im x.re) (- y.im))))
(* (cos (* y.re (atan2 x.im x.re))) (pow (hypot 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 tmp;
if ((y_46_im <= -0.000165) || !(y_46_im <= 0.0012)) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(hypot(x_46_im, x_46_re), y_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 tmp;
if ((y_46_im <= -0.000165) || !(y_46_im <= 0.0012)) {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -0.000165) or not (y_46_im <= 0.0012): tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -0.000165) || !(y_46_im <= 0.0012)) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); else tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -0.000165) || ~((y_46_im <= 0.0012))) tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im)); else tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -0.000165], N[Not[LessEqual[y$46$im, 0.0012]], $MachinePrecision]], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -0.000165 \lor \neg \left(y.im \leq 0.0012\right):\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -1.65e-4 or 0.00119999999999999989 < y.im Initial program 34.8%
fmm-def34.8%
hypot-define34.8%
distribute-rgt-neg-out34.8%
fma-define34.1%
hypot-define67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in y.re around 0 28.6%
*-commutative28.6%
unpow228.6%
unpow228.6%
hypot-undefine56.8%
neg-mul-156.8%
distribute-rgt-neg-in56.8%
Simplified56.8%
if -1.65e-4 < y.im < 0.00119999999999999989Initial program 40.0%
fmm-def40.0%
hypot-define40.0%
distribute-rgt-neg-out40.0%
fma-define40.0%
hypot-define88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in y.im around 0 62.6%
unpow262.6%
unpow262.6%
hypot-undefine88.6%
Simplified88.6%
Final simplification71.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im -3e+62) (* (cos (* y.im (log (/ -1.0 x.re)))) (exp (* (atan2 x.im x.re) (- y.im)))) (* (cos (* y.re (atan2 x.im x.re))) (pow (hypot 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 tmp;
if (y_46_im <= -3e+62) {
tmp = cos((y_46_im * log((-1.0 / x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(hypot(x_46_im, x_46_re), y_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 tmp;
if (y_46_im <= -3e+62) {
tmp = Math.cos((y_46_im * Math.log((-1.0 / x_46_re)))) * Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -3e+62: tmp = math.cos((y_46_im * math.log((-1.0 / x_46_re)))) * math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -3e+62) tmp = Float64(cos(Float64(y_46_im * log(Float64(-1.0 / x_46_re)))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); else tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_im <= -3e+62) tmp = cos((y_46_im * log((-1.0 / x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im)); else tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -3e+62], N[(N[Cos[N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3 \cdot 10^{+62}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\frac{-1}{x.re}\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -3e62Initial program 39.2%
fmm-def39.2%
hypot-define39.2%
distribute-rgt-neg-out39.2%
fma-define39.2%
hypot-define66.9%
*-commutative66.9%
Simplified66.9%
Taylor expanded in x.re around -inf 44.7%
+-commutative44.7%
mul-1-neg44.7%
unsub-neg44.7%
*-commutative44.7%
+-commutative44.7%
neg-mul-144.7%
unsub-neg44.7%
mul-1-neg44.7%
distribute-rgt-neg-in44.7%
Simplified44.7%
expm1-log1p-u34.0%
expm1-undefine34.0%
Applied egg-rr34.0%
expm1-define34.0%
Simplified34.0%
Taylor expanded in y.re around 0 40.5%
cos-neg40.5%
distribute-lft-neg-in40.5%
Simplified40.5%
if -3e62 < y.im Initial program 36.7%
fmm-def36.7%
hypot-define36.7%
distribute-rgt-neg-out36.7%
fma-define36.2%
hypot-define79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in y.im around 0 52.3%
unpow252.3%
unpow252.3%
hypot-undefine63.8%
Simplified63.8%
Final simplification59.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (cos (* y.re (atan2 x.im x.re))) (pow (hypot x.im x.re) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(hypot(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) {
return Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (hypot(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) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Initial program 37.1%
fmm-def37.1%
hypot-define37.1%
distribute-rgt-neg-out37.1%
fma-define36.7%
hypot-define77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in y.im around 0 45.9%
unpow245.9%
unpow245.9%
hypot-undefine54.3%
Simplified54.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -1.9e+43) (* (cos (* y.re (atan2 x.im x.re))) (pow x.re y.re)) (+ 1.0 (log (pow (hypot x.re x.im) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.9e+43) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(x_46_re, y_46_re);
} else {
tmp = 1.0 + log(pow(hypot(x_46_re, x_46_im), y_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 tmp;
if (y_46_re <= -1.9e+43) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(x_46_re, y_46_re);
} else {
tmp = 1.0 + Math.log(Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -1.9e+43: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(x_46_re, y_46_re) else: tmp = 1.0 + math.log(math.pow(math.hypot(x_46_re, x_46_im), y_46_re)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -1.9e+43) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (x_46_re ^ y_46_re)); else tmp = Float64(1.0 + log((hypot(x_46_re, x_46_im) ^ y_46_re))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -1.9e+43) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (x_46_re ^ y_46_re); else tmp = 1.0 + log((hypot(x_46_re, x_46_im) ^ y_46_re)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -1.9e+43], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[x$46$re, y$46$re], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[Log[N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.9 \cdot 10^{+43}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {x.re}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;1 + \log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right)\\
\end{array}
\end{array}
if y.re < -1.90000000000000004e43Initial program 34.7%
fmm-def34.7%
hypot-define34.7%
distribute-rgt-neg-out34.7%
fma-define32.7%
hypot-define83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in y.im around 0 79.7%
unpow279.7%
unpow279.7%
hypot-undefine79.7%
Simplified79.7%
Taylor expanded in x.im around 0 61.6%
if -1.90000000000000004e43 < y.re Initial program 37.7%
fmm-def37.7%
hypot-define37.7%
distribute-rgt-neg-out37.7%
fma-define37.7%
hypot-define75.7%
*-commutative75.7%
Simplified75.7%
Taylor expanded in y.im around 0 38.0%
unpow238.0%
unpow238.0%
hypot-undefine48.3%
Simplified48.3%
Taylor expanded in y.re around 0 24.8%
unpow224.8%
unpow224.8%
hypot-undefine29.7%
Simplified29.7%
*-commutative29.7%
add-log-exp45.1%
pow-to-exp45.1%
hypot-undefine33.5%
+-commutative33.5%
hypot-define45.1%
Applied egg-rr45.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -92000000.0) (* (cos (* y.re (atan2 x.im x.re))) (pow x.im y.re)) (+ 1.0 (log (pow (hypot x.re x.im) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -92000000.0) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(x_46_im, y_46_re);
} else {
tmp = 1.0 + log(pow(hypot(x_46_re, x_46_im), y_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 tmp;
if (y_46_re <= -92000000.0) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(x_46_im, y_46_re);
} else {
tmp = 1.0 + Math.log(Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -92000000.0: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(x_46_im, y_46_re) else: tmp = 1.0 + math.log(math.pow(math.hypot(x_46_re, x_46_im), y_46_re)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -92000000.0) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (x_46_im ^ y_46_re)); else tmp = Float64(1.0 + log((hypot(x_46_re, x_46_im) ^ y_46_re))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -92000000.0) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (x_46_im ^ y_46_re); else tmp = 1.0 + log((hypot(x_46_re, x_46_im) ^ y_46_re)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -92000000.0], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[x$46$im, y$46$re], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[Log[N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -92000000:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {x.im}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;1 + \log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right)\\
\end{array}
\end{array}
if y.re < -9.2e7Initial program 37.0%
fmm-def37.0%
hypot-define37.0%
distribute-rgt-neg-out37.0%
fma-define35.2%
hypot-define83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in y.im around 0 77.9%
unpow277.9%
unpow277.9%
hypot-undefine77.9%
Simplified77.9%
Taylor expanded in x.re around 0 56.0%
if -9.2e7 < y.re Initial program 37.2%
fmm-def37.2%
hypot-define37.2%
distribute-rgt-neg-out37.2%
fma-define37.2%
hypot-define75.6%
*-commutative75.6%
Simplified75.6%
Taylor expanded in y.im around 0 37.4%
unpow237.4%
unpow237.4%
hypot-undefine48.0%
Simplified48.0%
Taylor expanded in y.re around 0 25.4%
unpow225.4%
unpow225.4%
hypot-undefine30.4%
Simplified30.4%
*-commutative30.4%
add-log-exp45.7%
pow-to-exp45.7%
hypot-undefine33.8%
+-commutative33.8%
hypot-define45.7%
Applied egg-rr45.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (+ 1.0 (log (pow (hypot x.re x.im) y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0 + log(pow(hypot(x_46_re, x_46_im), y_46_re));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0 + Math.log(Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return 1.0 + math.log(math.pow(math.hypot(x_46_re, x_46_im), y_46_re))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(1.0 + log((hypot(x_46_re, x_46_im) ^ y_46_re))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 1.0 + log((hypot(x_46_re, x_46_im) ^ y_46_re)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(1.0 + N[Log[N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right)
\end{array}
Initial program 37.1%
fmm-def37.1%
hypot-define37.1%
distribute-rgt-neg-out37.1%
fma-define36.7%
hypot-define77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in y.im around 0 45.9%
unpow245.9%
unpow245.9%
hypot-undefine54.3%
Simplified54.3%
Taylor expanded in y.re around 0 21.2%
unpow221.2%
unpow221.2%
hypot-undefine24.5%
Simplified24.5%
*-commutative24.5%
add-log-exp39.5%
pow-to-exp39.5%
hypot-undefine30.0%
+-commutative30.0%
hypot-define39.5%
Applied egg-rr39.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -58.0)
(+ 1.0 (* y.re (log1p (+ (hypot x.re x.im) -1.0))))
(if (<= y.re 2.4e-14)
(+ (* (atan2 x.im x.re) y.im) 1.0)
(+ 1.0 (* y.re (log (+ x.im (* 0.5 (/ (pow x.re 2.0) x.im)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -58.0) {
tmp = 1.0 + (y_46_re * log1p((hypot(x_46_re, x_46_im) + -1.0)));
} else if (y_46_re <= 2.4e-14) {
tmp = (atan2(x_46_im, x_46_re) * y_46_im) + 1.0;
} else {
tmp = 1.0 + (y_46_re * log((x_46_im + (0.5 * (pow(x_46_re, 2.0) / x_46_im)))));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -58.0) {
tmp = 1.0 + (y_46_re * Math.log1p((Math.hypot(x_46_re, x_46_im) + -1.0)));
} else if (y_46_re <= 2.4e-14) {
tmp = (Math.atan2(x_46_im, x_46_re) * y_46_im) + 1.0;
} else {
tmp = 1.0 + (y_46_re * Math.log((x_46_im + (0.5 * (Math.pow(x_46_re, 2.0) / x_46_im)))));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -58.0: tmp = 1.0 + (y_46_re * math.log1p((math.hypot(x_46_re, x_46_im) + -1.0))) elif y_46_re <= 2.4e-14: tmp = (math.atan2(x_46_im, x_46_re) * y_46_im) + 1.0 else: tmp = 1.0 + (y_46_re * math.log((x_46_im + (0.5 * (math.pow(x_46_re, 2.0) / x_46_im))))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -58.0) tmp = Float64(1.0 + Float64(y_46_re * log1p(Float64(hypot(x_46_re, x_46_im) + -1.0)))); elseif (y_46_re <= 2.4e-14) tmp = Float64(Float64(atan(x_46_im, x_46_re) * y_46_im) + 1.0); else tmp = Float64(1.0 + Float64(y_46_re * log(Float64(x_46_im + Float64(0.5 * Float64((x_46_re ^ 2.0) / x_46_im)))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -58.0], N[(1.0 + N[(y$46$re * N[Log[1 + N[(N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 2.4e-14], N[(N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 + N[(y$46$re * N[Log[N[(x$46$im + N[(0.5 * N[(N[Power[x$46$re, 2.0], $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -58:\\
\;\;\;\;1 + y.re \cdot \mathsf{log1p}\left(\mathsf{hypot}\left(x.re, x.im\right) + -1\right)\\
\mathbf{elif}\;y.re \leq 2.4 \cdot 10^{-14}:\\
\;\;\;\;\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + 1\\
\mathbf{else}:\\
\;\;\;\;1 + y.re \cdot \log \left(x.im + 0.5 \cdot \frac{{x.re}^{2}}{x.im}\right)\\
\end{array}
\end{array}
if y.re < -58Initial program 38.2%
fmm-def38.2%
hypot-define38.2%
distribute-rgt-neg-out38.2%
fma-define36.4%
hypot-define83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in y.im around 0 78.3%
unpow278.3%
unpow278.3%
hypot-undefine78.3%
Simplified78.3%
Taylor expanded in y.re around 0 5.6%
unpow25.6%
unpow25.6%
hypot-undefine2.4%
Simplified2.4%
log1p-expm1-u12.7%
expm1-undefine12.7%
add-exp-log12.7%
hypot-undefine14.2%
+-commutative14.2%
hypot-define12.7%
Applied egg-rr12.7%
if -58 < y.re < 2.4e-14Initial program 36.2%
fmm-def36.2%
hypot-define36.2%
distribute-rgt-neg-out36.2%
fma-define36.2%
hypot-define77.5%
*-commutative77.5%
Simplified77.5%
Applied egg-rr44.9%
Taylor expanded in y.re around 0 18.5%
unpow218.5%
unpow218.5%
hypot-undefine43.6%
exp-prod43.0%
Simplified43.0%
Taylor expanded in y.im around 0 43.3%
if 2.4e-14 < y.re Initial program 38.0%
fmm-def38.0%
hypot-define38.0%
distribute-rgt-neg-out38.0%
fma-define38.0%
hypot-define71.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in y.im around 0 55.2%
unpow255.2%
unpow255.2%
hypot-undefine53.8%
Simplified53.8%
Taylor expanded in y.re around 0 28.5%
unpow228.5%
unpow228.5%
hypot-undefine7.4%
Simplified7.4%
Taylor expanded in x.re around 0 17.9%
Final simplification29.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -14.2) (+ 1.0 (* y.re (log1p (+ (hypot x.re x.im) -1.0)))) (+ 1.0 (* y.re (log (hypot x.im x.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -14.2) {
tmp = 1.0 + (y_46_re * log1p((hypot(x_46_re, x_46_im) + -1.0)));
} else {
tmp = 1.0 + (y_46_re * log(hypot(x_46_im, 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 tmp;
if (y_46_re <= -14.2) {
tmp = 1.0 + (y_46_re * Math.log1p((Math.hypot(x_46_re, x_46_im) + -1.0)));
} else {
tmp = 1.0 + (y_46_re * Math.log(Math.hypot(x_46_im, x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -14.2: tmp = 1.0 + (y_46_re * math.log1p((math.hypot(x_46_re, x_46_im) + -1.0))) else: tmp = 1.0 + (y_46_re * math.log(math.hypot(x_46_im, x_46_re))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -14.2) tmp = Float64(1.0 + Float64(y_46_re * log1p(Float64(hypot(x_46_re, x_46_im) + -1.0)))); else tmp = Float64(1.0 + Float64(y_46_re * log(hypot(x_46_im, x_46_re)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -14.2], N[(1.0 + N[(y$46$re * N[Log[1 + N[(N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y$46$re * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -14.2:\\
\;\;\;\;1 + y.re \cdot \mathsf{log1p}\left(\mathsf{hypot}\left(x.re, x.im\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\end{array}
\end{array}
if y.re < -14.199999999999999Initial program 38.2%
fmm-def38.2%
hypot-define38.2%
distribute-rgt-neg-out38.2%
fma-define36.4%
hypot-define83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in y.im around 0 78.3%
unpow278.3%
unpow278.3%
hypot-undefine78.3%
Simplified78.3%
Taylor expanded in y.re around 0 5.6%
unpow25.6%
unpow25.6%
hypot-undefine2.4%
Simplified2.4%
log1p-expm1-u12.7%
expm1-undefine12.7%
add-exp-log12.7%
hypot-undefine14.2%
+-commutative14.2%
hypot-define12.7%
Applied egg-rr12.7%
if -14.199999999999999 < y.re Initial program 36.8%
fmm-def36.8%
hypot-define36.8%
distribute-rgt-neg-out36.8%
fma-define36.8%
hypot-define75.5%
*-commutative75.5%
Simplified75.5%
Taylor expanded in y.im around 0 37.1%
unpow237.1%
unpow237.1%
hypot-undefine47.8%
Simplified47.8%
Taylor expanded in y.re around 0 25.5%
unpow225.5%
unpow225.5%
hypot-undefine30.5%
Simplified30.5%
Final simplification26.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (+ 1.0 (* y.re (log (hypot x.im x.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0 + (y_46_re * log(hypot(x_46_im, x_46_re)));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0 + (y_46_re * Math.log(Math.hypot(x_46_im, x_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return 1.0 + (y_46_re * math.log(math.hypot(x_46_im, x_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(1.0 + Float64(y_46_re * log(hypot(x_46_im, x_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 1.0 + (y_46_re * log(hypot(x_46_im, x_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(1.0 + N[(y$46$re * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)
\end{array}
Initial program 37.1%
fmm-def37.1%
hypot-define37.1%
distribute-rgt-neg-out37.1%
fma-define36.7%
hypot-define77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in y.im around 0 45.9%
unpow245.9%
unpow245.9%
hypot-undefine54.3%
Simplified54.3%
Taylor expanded in y.re around 0 21.2%
unpow221.2%
unpow221.2%
hypot-undefine24.5%
Simplified24.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 1.0)
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0;
}
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 = 1.0d0
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return 1.0
function code(x_46_re, x_46_im, y_46_re, y_46_im) return 1.0 end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 1.0; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 37.1%
fmm-def37.1%
hypot-define37.1%
distribute-rgt-neg-out37.1%
fma-define36.7%
hypot-define77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in y.im around 0 45.9%
unpow245.9%
unpow245.9%
hypot-undefine54.3%
Simplified54.3%
Taylor expanded in y.re around 0 23.8%
herbie shell --seed 2024170
(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)))))