
(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 12 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 (* y.im (atan2 x.im x.re))) (t_1 (log (/ -1.0 x.re))))
(if (<= x.re -2e-308)
(*
(exp (- (fma y.re t_1 t_0)))
(sin (fma y.re (atan2 x.im x.re) (* t_1 (- y.im)))))
(*
(exp (- (* y.re (log x.re)) t_0))
(sin (fma y.im (log x.re) (* y.re (atan2 x.im x.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * atan2(x_46_im, x_46_re);
double t_1 = log((-1.0 / x_46_re));
double tmp;
if (x_46_re <= -2e-308) {
tmp = exp(-fma(y_46_re, t_1, t_0)) * sin(fma(y_46_re, atan2(x_46_im, x_46_re), (t_1 * -y_46_im)));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - t_0)) * sin(fma(y_46_im, log(x_46_re), (y_46_re * atan2(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) t_1 = log(Float64(-1.0 / x_46_re)) tmp = 0.0 if (x_46_re <= -2e-308) tmp = Float64(exp(Float64(-fma(y_46_re, t_1, t_0))) * sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(t_1 * Float64(-y_46_im))))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)) * sin(fma(y_46_im, log(x_46_re), Float64(y_46_re * atan(x_46_im, x_46_re))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -2e-308], N[(N[Exp[(-N[(y$46$re * t$95$1 + t$95$0), $MachinePrecision])], $MachinePrecision] * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(t$95$1 * (-y$46$im)), $MachinePrecision]), $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[(y$46$im * N[Log[x$46$re], $MachinePrecision] + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\frac{-1}{x.re}\right)\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{-308}:\\
\;\;\;\;e^{-\mathsf{fma}\left(y.re, t\_1, t\_0\right)} \cdot \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, t\_1 \cdot \left(-y.im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t\_0} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.re, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\end{array}
\end{array}
if x.re < -1.9999999999999998e-308Initial program 42.9%
Taylor expanded in x.re around -inf
lower-*.f64N/A
lower-exp.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
lower-neg.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-sin.f64N/A
Applied rewrites69.5%
if -1.9999999999999998e-308 < x.re Initial program 39.9%
Taylor expanded in x.im around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f6468.3
Applied rewrites68.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (sin (+ t_1 (* y.im t_0))))
(t_3 (sqrt (fma x.im x.im (* x.re x.re))))
(t_4 (exp (- (* y.re t_0) (* y.im (atan2 x.im x.re)))))
(t_5 (* t_2 t_4))
(t_6 (* t_4 (sin (* y.im (log t_3)))))
(t_7 (pow t_3 y.re)))
(if (<= t_5 (- INFINITY))
t_6
(if (<= t_5 -1e-236)
(* t_7 t_2)
(if (<= t_5 INFINITY) t_6 (* t_7 t_1))))))
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))));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = sin((t_1 + (y_46_im * t_0)));
double t_3 = sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re)));
double t_4 = exp(((y_46_re * t_0) - (y_46_im * atan2(x_46_im, x_46_re))));
double t_5 = t_2 * t_4;
double t_6 = t_4 * sin((y_46_im * log(t_3)));
double t_7 = pow(t_3, y_46_re);
double tmp;
if (t_5 <= -((double) INFINITY)) {
tmp = t_6;
} else if (t_5 <= -1e-236) {
tmp = t_7 * t_2;
} else if (t_5 <= ((double) INFINITY)) {
tmp = t_6;
} else {
tmp = t_7 * t_1;
}
return tmp;
}
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)))) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = sin(Float64(t_1 + Float64(y_46_im * t_0))) t_3 = sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) t_4 = exp(Float64(Float64(y_46_re * t_0) - Float64(y_46_im * atan(x_46_im, x_46_re)))) t_5 = Float64(t_2 * t_4) t_6 = Float64(t_4 * sin(Float64(y_46_im * log(t_3)))) t_7 = t_3 ^ y_46_re tmp = 0.0 if (t_5 <= Float64(-Inf)) tmp = t_6; elseif (t_5 <= -1e-236) tmp = Float64(t_7 * t_2); elseif (t_5 <= Inf) tmp = t_6; else tmp = Float64(t_7 * 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[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $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[Sin[N[(t$95$1 + N[(y$46$im * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Exp[N[(N[(y$46$re * t$95$0), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 * t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$4 * N[Sin[N[(y$46$im * N[Log[t$95$3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[Power[t$95$3, y$46$re], $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], t$95$6, If[LessEqual[t$95$5, -1e-236], N[(t$95$7 * t$95$2), $MachinePrecision], If[LessEqual[t$95$5, Infinity], t$95$6, N[(t$95$7 * t$95$1), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \sin \left(t\_1 + y.im \cdot t\_0\right)\\
t_3 := \sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\\
t_4 := e^{y.re \cdot t\_0 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
t_5 := t\_2 \cdot t\_4\\
t_6 := t\_4 \cdot \sin \left(y.im \cdot \log t\_3\right)\\
t_7 := {t\_3}^{y.re}\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq -1 \cdot 10^{-236}:\\
\;\;\;\;t\_7 \cdot t\_2\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_6\\
\mathbf{else}:\\
\;\;\;\;t\_7 \cdot t\_1\\
\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)))) < -inf.0 or -1e-236 < (*.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 81.1%
Taylor expanded in y.im around inf
lower-*.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6477.6
Applied rewrites77.6%
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)))) < -1e-236Initial program 77.6%
Taylor expanded in y.im around 0
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6477.8
Applied rewrites77.8%
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%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6442.9
Applied rewrites42.9%
Taylor expanded in y.re around 0
Applied rewrites43.7%
Final simplification61.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re)))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (log (/ -1.0 x.im))))
(if (<= x.im -1.35e-267)
(* (exp (- (fma y.re t_2 t_0))) (sin (fma t_2 (- y.im) t_1)))
(if (<= x.im 1.2e-297)
(*
(pow (sqrt (fma x.im x.im (* x.re x.re))) y.re)
(sin (+ t_1 (* y.im (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))))
(*
(exp (- (* y.re (log x.im)) t_0))
(sin (fma y.im (log x.im) t_1)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * atan2(x_46_im, x_46_re);
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = log((-1.0 / x_46_im));
double tmp;
if (x_46_im <= -1.35e-267) {
tmp = exp(-fma(y_46_re, t_2, t_0)) * sin(fma(t_2, -y_46_im, t_1));
} else if (x_46_im <= 1.2e-297) {
tmp = pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re) * sin((t_1 + (y_46_im * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))))));
} else {
tmp = exp(((y_46_re * log(x_46_im)) - t_0)) * sin(fma(y_46_im, log(x_46_im), t_1));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = log(Float64(-1.0 / x_46_im)) tmp = 0.0 if (x_46_im <= -1.35e-267) tmp = Float64(exp(Float64(-fma(y_46_re, t_2, t_0))) * sin(fma(t_2, Float64(-y_46_im), t_1))); elseif (x_46_im <= 1.2e-297) tmp = Float64((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re) * sin(Float64(t_1 + Float64(y_46_im * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))))))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)) * sin(fma(y_46_im, log(x_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[(y$46$im * N[ArcTan[x$46$im / x$46$re], $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[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -1.35e-267], N[(N[Exp[(-N[(y$46$re * t$95$2 + t$95$0), $MachinePrecision])], $MachinePrecision] * N[Sin[N[(t$95$2 * (-y$46$im) + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1.2e-297], N[(N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision] * N[Sin[N[(t$95$1 + N[(y$46$im * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \log \left(\frac{-1}{x.im}\right)\\
\mathbf{if}\;x.im \leq -1.35 \cdot 10^{-267}:\\
\;\;\;\;e^{-\mathsf{fma}\left(y.re, t\_2, t\_0\right)} \cdot \sin \left(\mathsf{fma}\left(t\_2, -y.im, t\_1\right)\right)\\
\mathbf{elif}\;x.im \leq 1.2 \cdot 10^{-297}:\\
\;\;\;\;{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot \sin \left(t\_1 + y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t\_0} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, t\_1\right)\right)\\
\end{array}
\end{array}
if x.im < -1.34999999999999994e-267Initial program 41.2%
Taylor expanded in x.im around -inf
lower-*.f64N/A
lower-exp.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
lower-neg.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-sin.f64N/A
Applied rewrites68.2%
if -1.34999999999999994e-267 < x.im < 1.2e-297Initial program 62.5%
Taylor expanded in y.im around 0
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6461.7
Applied rewrites61.7%
if 1.2e-297 < x.im Initial program 38.6%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f6468.1
Applied rewrites68.1%
Final simplification67.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re))) (t_1 (* y.re (atan2 x.im x.re))))
(if (<= x.re 6.8e-298)
(*
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(sin t_1))
(* (exp (- (* y.re (log x.re)) t_0)) (sin (fma y.im (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 = y_46_im * atan2(x_46_im, x_46_re);
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= 6.8e-298) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * sin(t_1);
} else {
tmp = exp(((y_46_re * log(x_46_re)) - t_0)) * sin(fma(y_46_im, log(x_46_re), t_1));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= 6.8e-298) tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_0)) * sin(t_1)); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)) * sin(fma(y_46_im, log(x_46_re), t_1))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, 6.8e-298], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sin[t$95$1], $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[(y$46$im * N[Log[x$46$re], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq 6.8 \cdot 10^{-298}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0} \cdot \sin t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t\_0} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.re, t\_1\right)\right)\\
\end{array}
\end{array}
if x.re < 6.8e-298Initial program 42.6%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-atan2.f6455.2
Applied rewrites55.2%
if 6.8e-298 < x.re Initial program 40.2%
Taylor expanded in x.im around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f6468.9
Applied rewrites68.9%
Final simplification61.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re)))
(t_1 (sin (* y.re (atan2 x.im x.re))))
(t_2
(*
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
t_1)))
(if (<= y.re -8e-7) t_2 (if (<= y.re 2.1e-50) (* t_1 (exp (- t_0))) t_2))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * atan2(x_46_im, x_46_re);
double t_1 = sin((y_46_re * atan2(x_46_im, x_46_re)));
double t_2 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * t_1;
double tmp;
if (y_46_re <= -8e-7) {
tmp = t_2;
} else if (y_46_re <= 2.1e-50) {
tmp = t_1 * exp(-t_0);
} else {
tmp = t_2;
}
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 = y_46im * atan2(x_46im, x_46re)
t_1 = sin((y_46re * atan2(x_46im, x_46re)))
t_2 = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_0)) * t_1
if (y_46re <= (-8d-7)) then
tmp = t_2
else if (y_46re <= 2.1d-50) then
tmp = t_1 * exp(-t_0)
else
tmp = t_2
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 = y_46_im * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re)));
double t_2 = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * t_1;
double tmp;
if (y_46_re <= -8e-7) {
tmp = t_2;
} else if (y_46_re <= 2.1e-50) {
tmp = t_1 * Math.exp(-t_0);
} else {
tmp = t_2;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.atan2(x_46_im, x_46_re) t_1 = math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) t_2 = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * t_1 tmp = 0 if y_46_re <= -8e-7: tmp = t_2 elif y_46_re <= 2.1e-50: tmp = t_1 * math.exp(-t_0) else: tmp = t_2 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) t_1 = sin(Float64(y_46_re * atan(x_46_im, x_46_re))) t_2 = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_0)) * t_1) tmp = 0.0 if (y_46_re <= -8e-7) tmp = t_2; elseif (y_46_re <= 2.1e-50) tmp = Float64(t_1 * exp(Float64(-t_0))); else tmp = t_2; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * atan2(x_46_im, x_46_re); t_1 = sin((y_46_re * atan2(x_46_im, x_46_re))); t_2 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * t_1; tmp = 0.0; if (y_46_re <= -8e-7) tmp = t_2; elseif (y_46_re <= 2.1e-50) tmp = t_1 * exp(-t_0); else tmp = t_2; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[y$46$re, -8e-7], t$95$2, If[LessEqual[y$46$re, 2.1e-50], N[(t$95$1 * N[Exp[(-t$95$0)], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
t_2 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0} \cdot t\_1\\
\mathbf{if}\;y.re \leq -8 \cdot 10^{-7}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.re \leq 2.1 \cdot 10^{-50}:\\
\;\;\;\;t\_1 \cdot e^{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y.re < -7.9999999999999996e-7 or 2.1000000000000001e-50 < y.re Initial program 42.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-atan2.f6466.7
Applied rewrites66.7%
if -7.9999999999999996e-7 < y.re < 2.1000000000000001e-50Initial program 40.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-atan2.f6435.0
Applied rewrites35.0%
Taylor expanded in y.re around 0
neg-mul-1N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
neg-mul-1N/A
lower-*.f64N/A
lower-atan2.f64N/A
neg-mul-1N/A
lower-neg.f6449.4
Applied rewrites49.4%
Final simplification58.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (sin t_0))
(t_2 (* t_1 (exp (- (* y.im (atan2 x.im x.re))))))
(t_3 (fma x.im x.im (* x.re x.re)))
(t_4 (pow (sqrt t_3) y.re)))
(if (<= y.im -4.2e+126)
t_2
(if (<= y.im 3.3e-64)
(* t_4 t_1)
(if (<= y.im 2400000000000.0)
(* t_4 (sin (* (* y.im 0.5) (log t_3))))
(if (<= y.im 2.3e+124) (* t_4 t_0) t_2))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = sin(t_0);
double t_2 = t_1 * exp(-(y_46_im * atan2(x_46_im, x_46_re)));
double t_3 = fma(x_46_im, x_46_im, (x_46_re * x_46_re));
double t_4 = pow(sqrt(t_3), y_46_re);
double tmp;
if (y_46_im <= -4.2e+126) {
tmp = t_2;
} else if (y_46_im <= 3.3e-64) {
tmp = t_4 * t_1;
} else if (y_46_im <= 2400000000000.0) {
tmp = t_4 * sin(((y_46_im * 0.5) * log(t_3)));
} else if (y_46_im <= 2.3e+124) {
tmp = t_4 * t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = sin(t_0) t_2 = Float64(t_1 * exp(Float64(-Float64(y_46_im * atan(x_46_im, x_46_re))))) t_3 = fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) t_4 = sqrt(t_3) ^ y_46_re tmp = 0.0 if (y_46_im <= -4.2e+126) tmp = t_2; elseif (y_46_im <= 3.3e-64) tmp = Float64(t_4 * t_1); elseif (y_46_im <= 2400000000000.0) tmp = Float64(t_4 * sin(Float64(Float64(y_46_im * 0.5) * log(t_3)))); elseif (y_46_im <= 2.3e+124) tmp = Float64(t_4 * t_0); else tmp = t_2; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Exp[(-N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sqrt[t$95$3], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$im, -4.2e+126], t$95$2, If[LessEqual[y$46$im, 3.3e-64], N[(t$95$4 * t$95$1), $MachinePrecision], If[LessEqual[y$46$im, 2400000000000.0], N[(t$95$4 * N[Sin[N[(N[(y$46$im * 0.5), $MachinePrecision] * N[Log[t$95$3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.3e+124], N[(t$95$4 * t$95$0), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \sin t\_0\\
t_2 := t\_1 \cdot e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
t_3 := \mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\\
t_4 := {\left(\sqrt{t\_3}\right)}^{y.re}\\
\mathbf{if}\;y.im \leq -4.2 \cdot 10^{+126}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq 3.3 \cdot 10^{-64}:\\
\;\;\;\;t\_4 \cdot t\_1\\
\mathbf{elif}\;y.im \leq 2400000000000:\\
\;\;\;\;t\_4 \cdot \sin \left(\left(y.im \cdot 0.5\right) \cdot \log t\_3\right)\\
\mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+124}:\\
\;\;\;\;t\_4 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y.im < -4.1999999999999998e126 or 2.29999999999999985e124 < y.im Initial program 36.6%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-atan2.f6452.9
Applied rewrites52.9%
Taylor expanded in y.re around 0
neg-mul-1N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
neg-mul-1N/A
lower-*.f64N/A
lower-atan2.f64N/A
neg-mul-1N/A
lower-neg.f6467.3
Applied rewrites67.3%
if -4.1999999999999998e126 < y.im < 3.2999999999999999e-64Initial program 42.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6454.0
Applied rewrites54.0%
if 3.2999999999999999e-64 < y.im < 2.4e12Initial program 76.1%
lift-+.f64N/A
flip-+N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites61.1%
Taylor expanded in y.im around 0
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.4
Applied rewrites60.4%
Taylor expanded in y.im around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.4
Applied rewrites80.4%
if 2.4e12 < y.im < 2.29999999999999985e124Initial program 25.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6448.6
Applied rewrites48.6%
Taylor expanded in y.re around 0
Applied rewrites56.6%
Final simplification60.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (sin t_0))
(t_2 (fma x.im x.im (* x.re x.re)))
(t_3 (pow (sqrt t_2) y.re)))
(if (<= y.im 3.3e-64)
(* t_3 t_1)
(if (<= y.im 2400000000000.0)
(* t_3 (sin (* (* y.im 0.5) (log t_2))))
(if (<= y.im 9e+133)
(* t_3 t_0)
(* t_1 (pow (/ (* (* x.im x.im) 0.5) 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 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = sin(t_0);
double t_2 = fma(x_46_im, x_46_im, (x_46_re * x_46_re));
double t_3 = pow(sqrt(t_2), y_46_re);
double tmp;
if (y_46_im <= 3.3e-64) {
tmp = t_3 * t_1;
} else if (y_46_im <= 2400000000000.0) {
tmp = t_3 * sin(((y_46_im * 0.5) * log(t_2)));
} else if (y_46_im <= 9e+133) {
tmp = t_3 * t_0;
} else {
tmp = t_1 * pow((((x_46_im * x_46_im) * 0.5) / x_46_re), y_46_re);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = sin(t_0) t_2 = fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) t_3 = sqrt(t_2) ^ y_46_re tmp = 0.0 if (y_46_im <= 3.3e-64) tmp = Float64(t_3 * t_1); elseif (y_46_im <= 2400000000000.0) tmp = Float64(t_3 * sin(Float64(Float64(y_46_im * 0.5) * log(t_2)))); elseif (y_46_im <= 9e+133) tmp = Float64(t_3 * t_0); else tmp = Float64(t_1 * (Float64(Float64(Float64(x_46_im * x_46_im) * 0.5) / x_46_re) ^ y_46_re)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sqrt[t$95$2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$im, 3.3e-64], N[(t$95$3 * t$95$1), $MachinePrecision], If[LessEqual[y$46$im, 2400000000000.0], N[(t$95$3 * N[Sin[N[(N[(y$46$im * 0.5), $MachinePrecision] * N[Log[t$95$2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 9e+133], N[(t$95$3 * t$95$0), $MachinePrecision], N[(t$95$1 * N[Power[N[(N[(N[(x$46$im * x$46$im), $MachinePrecision] * 0.5), $MachinePrecision] / x$46$re), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \sin t\_0\\
t_2 := \mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\\
t_3 := {\left(\sqrt{t\_2}\right)}^{y.re}\\
\mathbf{if}\;y.im \leq 3.3 \cdot 10^{-64}:\\
\;\;\;\;t\_3 \cdot t\_1\\
\mathbf{elif}\;y.im \leq 2400000000000:\\
\;\;\;\;t\_3 \cdot \sin \left(\left(y.im \cdot 0.5\right) \cdot \log t\_2\right)\\
\mathbf{elif}\;y.im \leq 9 \cdot 10^{+133}:\\
\;\;\;\;t\_3 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot {\left(\frac{\left(x.im \cdot x.im\right) \cdot 0.5}{x.re}\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < 3.2999999999999999e-64Initial program 40.1%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.1
Applied rewrites50.1%
if 3.2999999999999999e-64 < y.im < 2.4e12Initial program 76.1%
lift-+.f64N/A
flip-+N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites61.1%
Taylor expanded in y.im around 0
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.4
Applied rewrites60.4%
Taylor expanded in y.im around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.4
Applied rewrites80.4%
if 2.4e12 < y.im < 8.9999999999999997e133Initial program 25.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6448.6
Applied rewrites48.6%
Taylor expanded in y.re around 0
Applied rewrites56.6%
if 8.9999999999999997e133 < y.im Initial program 40.1%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6434.5
Applied rewrites34.5%
Taylor expanded in x.re around inf
Applied rewrites29.7%
Taylor expanded in x.re around 0
Applied rewrites43.3%
Final simplification51.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re) (sin (* y.re (atan2 x.im x.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re) * sin((y_46_re * atan2(x_46_im, x_46_re)));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re) * sin(Float64(y_46_re * atan(x_46_im, x_46_re)))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision] * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)
\end{array}
Initial program 41.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6445.4
Applied rewrites45.4%
Final simplification45.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= x.re -5e+107)
(* (sin t_0) (pow (- x.re) y.re))
(* (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -5e+107) {
tmp = sin(t_0) * pow(-x_46_re, y_46_re);
} else {
tmp = pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re) * t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= -5e+107) tmp = Float64(sin(t_0) * (Float64(-x_46_re) ^ y_46_re)); else tmp = Float64((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re) * t_0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -5e+107], N[(N[Sin[t$95$0], $MachinePrecision] * N[Power[(-x$46$re), y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -5 \cdot 10^{+107}:\\
\;\;\;\;\sin t\_0 \cdot {\left(-x.re\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot t\_0\\
\end{array}
\end{array}
if x.re < -5.0000000000000002e107Initial program 17.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6441.4
Applied rewrites41.4%
Taylor expanded in x.re around -inf
Applied rewrites45.4%
if -5.0000000000000002e107 < x.re Initial program 47.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6446.4
Applied rewrites46.4%
Taylor expanded in y.re around 0
Applied rewrites45.8%
Final simplification45.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re) (* y.re (atan2 x.im x.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re) * (y_46_re * atan2(x_46_im, x_46_re));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re) * Float64(y_46_re * atan(x_46_im, x_46_re))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision] * N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)
\end{array}
Initial program 41.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6445.4
Applied rewrites45.4%
Taylor expanded in y.re around 0
Applied rewrites43.3%
Final simplification43.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (* y.re (atan2 x.im x.re))) (t_1 (sqrt (pow t_0 2.0)))) (if (<= y.im -0.0054) t_1 (if (<= y.im 2.1e-250) t_0 t_1))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = sqrt(pow(t_0, 2.0));
double tmp;
if (y_46_im <= -0.0054) {
tmp = t_1;
} else if (y_46_im <= 2.1e-250) {
tmp = t_0;
} else {
tmp = 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) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
t_1 = sqrt((t_0 ** 2.0d0))
if (y_46im <= (-0.0054d0)) then
tmp = t_1
else if (y_46im <= 2.1d-250) then
tmp = t_0
else
tmp = 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 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.sqrt(Math.pow(t_0, 2.0));
double tmp;
if (y_46_im <= -0.0054) {
tmp = t_1;
} else if (y_46_im <= 2.1e-250) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.sqrt(math.pow(t_0, 2.0)) tmp = 0 if y_46_im <= -0.0054: tmp = t_1 elif y_46_im <= 2.1e-250: tmp = t_0 else: tmp = t_1 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = sqrt((t_0 ^ 2.0)) tmp = 0.0 if (y_46_im <= -0.0054) tmp = t_1; elseif (y_46_im <= 2.1e-250) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = sqrt((t_0 ^ 2.0)); tmp = 0.0; if (y_46_im <= -0.0054) tmp = t_1; elseif (y_46_im <= 2.1e-250) tmp = t_0; else tmp = 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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[Power[t$95$0, 2.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, -0.0054], t$95$1, If[LessEqual[y$46$im, 2.1e-250], t$95$0, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \sqrt{{t\_0}^{2}}\\
\mathbf{if}\;y.im \leq -0.0054:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 2.1 \cdot 10^{-250}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -0.0054000000000000003 or 2.1000000000000001e-250 < y.im Initial program 41.6%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6442.7
Applied rewrites42.7%
Taylor expanded in y.re around 0
Applied rewrites6.2%
Applied rewrites4.9%
Applied rewrites19.1%
if -0.0054000000000000003 < y.im < 2.1000000000000001e-250Initial program 41.1%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.7
Applied rewrites53.7%
Taylor expanded in y.re around 0
Applied rewrites26.4%
Final simplification20.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* y.re (atan2 x.im x.re)))
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);
}
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)
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);
}
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)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(y_46_re * atan(x_46_im, x_46_re)) 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); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}
\end{array}
Initial program 41.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6445.4
Applied rewrites45.4%
Taylor expanded in y.re around 0
Applied rewrites11.2%
herbie shell --seed 2024219
(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)))))