
(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 9 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 (pow (fma x.im x.im (* x.re x.re)) (* y.re 0.5))))
(if (<= y.re -1.3e-6)
t_0
(if (<= y.re 490000000.0) (exp (- (* y.im (atan2 x.im 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 = pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), (y_46_re * 0.5));
double tmp;
if (y_46_re <= -1.3e-6) {
tmp = t_0;
} else if (y_46_re <= 490000000.0) {
tmp = exp(-(y_46_im * atan2(x_46_im, x_46_re)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ Float64(y_46_re * 0.5) tmp = 0.0 if (y_46_re <= -1.3e-6) tmp = t_0; elseif (y_46_re <= 490000000.0) tmp = exp(Float64(-Float64(y_46_im * atan(x_46_im, x_46_re)))); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(y$46$re * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1.3e-6], t$95$0, If[LessEqual[y$46$re, 490000000.0], N[Exp[(-N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision])], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\left(y.re \cdot 0.5\right)}\\
\mathbf{if}\;y.re \leq -1.3 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 490000000:\\
\;\;\;\;e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.30000000000000005e-6 or 4.9e8 < y.re Initial program 30.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6468.2
Applied rewrites68.2%
Taylor expanded in y.re around 0
Applied rewrites74.4%
lift-*.f64N/A
lift-fma.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
*-lft-identity74.4
lift-pow.f64N/A
lift-sqrt.f64N/A
sqrt-pow2N/A
lower-pow.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6474.4
Applied rewrites74.4%
if -1.30000000000000005e-6 < y.re < 4.9e8Initial program 35.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-atan2.f6448.4
Applied rewrites48.4%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-atan2.f6482.8
Applied rewrites82.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (* y.im (atan2 x.im x.re)))
(t_2 (log (/ -1.0 x.re)))
(t_3 (* y.im (log x.re)))
(t_4 (* (sin t_0) (sin t_3)))
(t_5 (* (cos t_0) (cos t_3))))
(if (<= x.re -5e-309)
(* (cos (fma t_2 (- y.im) t_0)) (exp (- (fma y.re t_2 t_1))))
(*
(/
(- (pow t_5 3.0) (pow t_4 3.0))
(+ (pow t_5 2.0) (+ (pow t_4 2.0) (* t_5 t_4))))
(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 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = y_46_im * atan2(x_46_im, x_46_re);
double t_2 = log((-1.0 / x_46_re));
double t_3 = y_46_im * log(x_46_re);
double t_4 = sin(t_0) * sin(t_3);
double t_5 = cos(t_0) * cos(t_3);
double tmp;
if (x_46_re <= -5e-309) {
tmp = cos(fma(t_2, -y_46_im, t_0)) * exp(-fma(y_46_re, t_2, t_1));
} else {
tmp = ((pow(t_5, 3.0) - pow(t_4, 3.0)) / (pow(t_5, 2.0) + (pow(t_4, 2.0) + (t_5 * t_4)))) * exp(((y_46_re * 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_re * atan(x_46_im, x_46_re)) t_1 = Float64(y_46_im * atan(x_46_im, x_46_re)) t_2 = log(Float64(-1.0 / x_46_re)) t_3 = Float64(y_46_im * log(x_46_re)) t_4 = Float64(sin(t_0) * sin(t_3)) t_5 = Float64(cos(t_0) * cos(t_3)) tmp = 0.0 if (x_46_re <= -5e-309) tmp = Float64(cos(fma(t_2, Float64(-y_46_im), t_0)) * exp(Float64(-fma(y_46_re, t_2, t_1)))); else tmp = Float64(Float64(Float64((t_5 ^ 3.0) - (t_4 ^ 3.0)) / Float64((t_5 ^ 2.0) + Float64((t_4 ^ 2.0) + Float64(t_5 * t_4)))) * exp(Float64(Float64(y_46_re * 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$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[t$95$0], $MachinePrecision] * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[t$95$0], $MachinePrecision] * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -5e-309], N[(N[Cos[N[(t$95$2 * (-y$46$im) + t$95$0), $MachinePrecision]], $MachinePrecision] * N[Exp[(-N[(y$46$re * t$95$2 + t$95$1), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[t$95$5, 3.0], $MachinePrecision] - N[Power[t$95$4, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[Power[t$95$5, 2.0], $MachinePrecision] + N[(N[Power[t$95$4, 2.0], $MachinePrecision] + N[(t$95$5 * t$95$4), $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 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \log \left(\frac{-1}{x.re}\right)\\
t_3 := y.im \cdot \log x.re\\
t_4 := \sin t\_0 \cdot \sin t\_3\\
t_5 := \cos t\_0 \cdot \cos t\_3\\
\mathbf{if}\;x.re \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(t\_2, -y.im, t\_0\right)\right) \cdot e^{-\mathsf{fma}\left(y.re, t\_2, t\_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{{t\_5}^{3} - {t\_4}^{3}}{{t\_5}^{2} + \left({t\_4}^{2} + t\_5 \cdot t\_4\right)} \cdot e^{y.re \cdot \log x.re - t\_1}\\
\end{array}
\end{array}
if x.re < -4.9999999999999995e-309Initial program 32.1%
Taylor expanded in x.re around -inf
lower-*.f64N/A
lower-cos.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
neg-mul-1N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-/.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-exp.f64N/A
Applied rewrites76.7%
if -4.9999999999999995e-309 < x.re Initial program 34.0%
Taylor expanded in x.im around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f6476.5
Applied rewrites76.5%
Applied rewrites79.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma x.im x.im (* x.re x.re))))
(if (<= y.re -1.26e-36)
(pow (* t_0 t_0) (* 0.5 (* y.re 0.5)))
(if (<= y.re 31.0) 1.0 (pow t_0 (* y.re 0.5))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(x_46_im, x_46_im, (x_46_re * x_46_re));
double tmp;
if (y_46_re <= -1.26e-36) {
tmp = pow((t_0 * t_0), (0.5 * (y_46_re * 0.5)));
} else if (y_46_re <= 31.0) {
tmp = 1.0;
} else {
tmp = pow(t_0, (y_46_re * 0.5));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) tmp = 0.0 if (y_46_re <= -1.26e-36) tmp = Float64(t_0 * t_0) ^ Float64(0.5 * Float64(y_46_re * 0.5)); elseif (y_46_re <= 31.0) tmp = 1.0; else tmp = t_0 ^ Float64(y_46_re * 0.5); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.26e-36], N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], N[(0.5 * N[(y$46$re * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y$46$re, 31.0], 1.0, N[Power[t$95$0, N[(y$46$re * 0.5), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\\
\mathbf{if}\;y.re \leq -1.26 \cdot 10^{-36}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{\left(0.5 \cdot \left(y.re \cdot 0.5\right)\right)}\\
\mathbf{elif}\;y.re \leq 31:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;{t\_0}^{\left(y.re \cdot 0.5\right)}\\
\end{array}
\end{array}
if y.re < -1.26000000000000005e-36Initial program 30.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6475.6
Applied rewrites75.6%
Taylor expanded in y.re around 0
Applied rewrites78.5%
lift-*.f64N/A
lift-fma.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
*-lft-identity78.5
lift-pow.f64N/A
lift-sqrt.f64N/A
sqrt-pow2N/A
sqr-powN/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6479.9
Applied rewrites79.9%
if -1.26000000000000005e-36 < y.re < 31Initial program 35.9%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6430.1
Applied rewrites30.1%
Taylor expanded in y.re around 0
Applied rewrites50.2%
if 31 < y.re Initial program 30.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6457.8
Applied rewrites57.8%
Taylor expanded in y.re around 0
Applied rewrites66.9%
lift-*.f64N/A
lift-fma.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
*-lft-identity66.9
lift-pow.f64N/A
lift-sqrt.f64N/A
sqrt-pow2N/A
lower-pow.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6466.9
Applied rewrites66.9%
Final simplification62.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (pow (fma x.im x.im (* x.re x.re)) (* y.re 0.5)))) (if (<= y.re -1.26e-36) t_0 (if (<= y.re 31.0) 1.0 t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), (y_46_re * 0.5));
double tmp;
if (y_46_re <= -1.26e-36) {
tmp = t_0;
} else if (y_46_re <= 31.0) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ Float64(y_46_re * 0.5) tmp = 0.0 if (y_46_re <= -1.26e-36) tmp = t_0; elseif (y_46_re <= 31.0) tmp = 1.0; else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(y$46$re * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1.26e-36], t$95$0, If[LessEqual[y$46$re, 31.0], 1.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\left(y.re \cdot 0.5\right)}\\
\mathbf{if}\;y.re \leq -1.26 \cdot 10^{-36}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 31:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.26000000000000005e-36 or 31 < y.re Initial program 30.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6466.9
Applied rewrites66.9%
Taylor expanded in y.re around 0
Applied rewrites72.8%
lift-*.f64N/A
lift-fma.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
*-lft-identity72.8
lift-pow.f64N/A
lift-sqrt.f64N/A
sqrt-pow2N/A
lower-pow.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6472.8
Applied rewrites72.8%
if -1.26000000000000005e-36 < y.re < 31Initial program 35.9%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6430.1
Applied rewrites30.1%
Taylor expanded in y.re around 0
Applied rewrites50.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.re -5.5e-149) (pow (- x.re) y.re) (if (<= x.re -1.4e-287) (pow x.im y.re) (pow 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 (x_46_re <= -5.5e-149) {
tmp = pow(-x_46_re, y_46_re);
} else if (x_46_re <= -1.4e-287) {
tmp = pow(x_46_im, y_46_re);
} else {
tmp = pow(x_46_re, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46re <= (-5.5d-149)) then
tmp = -x_46re ** y_46re
else if (x_46re <= (-1.4d-287)) then
tmp = x_46im ** y_46re
else
tmp = x_46re ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= -5.5e-149) {
tmp = Math.pow(-x_46_re, y_46_re);
} else if (x_46_re <= -1.4e-287) {
tmp = Math.pow(x_46_im, y_46_re);
} else {
tmp = Math.pow(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 x_46_re <= -5.5e-149: tmp = math.pow(-x_46_re, y_46_re) elif x_46_re <= -1.4e-287: tmp = math.pow(x_46_im, y_46_re) else: tmp = math.pow(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 (x_46_re <= -5.5e-149) tmp = Float64(-x_46_re) ^ y_46_re; elseif (x_46_re <= -1.4e-287) tmp = x_46_im ^ y_46_re; else tmp = 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 (x_46_re <= -5.5e-149) tmp = -x_46_re ^ y_46_re; elseif (x_46_re <= -1.4e-287) tmp = x_46_im ^ y_46_re; else tmp = 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[x$46$re, -5.5e-149], N[Power[(-x$46$re), y$46$re], $MachinePrecision], If[LessEqual[x$46$re, -1.4e-287], N[Power[x$46$im, y$46$re], $MachinePrecision], N[Power[x$46$re, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -5.5 \cdot 10^{-149}:\\
\;\;\;\;{\left(-x.re\right)}^{y.re}\\
\mathbf{elif}\;x.re \leq -1.4 \cdot 10^{-287}:\\
\;\;\;\;{x.im}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re}\\
\end{array}
\end{array}
if x.re < -5.50000000000000043e-149Initial program 34.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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.2
Applied rewrites45.2%
Taylor expanded in y.re around 0
Applied rewrites48.0%
Taylor expanded in x.re around -inf
neg-mul-1N/A
lower-neg.f6462.0
Applied rewrites62.0%
if -5.50000000000000043e-149 < x.re < -1.4000000000000001e-287Initial program 19.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-atan2.f6454.3
Applied rewrites54.3%
Taylor expanded in x.re around 0
unpow2N/A
lower-*.f6454.3
Applied rewrites54.3%
Taylor expanded in y.re around 0
Applied rewrites62.0%
Taylor expanded in y.im around 0
lower-pow.f6454.4
Applied rewrites54.4%
if -1.4000000000000001e-287 < x.re Initial program 35.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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.8
Applied rewrites53.8%
Taylor expanded in y.re around 0
Applied rewrites55.4%
Taylor expanded in x.im around 0
lower-pow.f6456.9
Applied rewrites56.9%
Final simplification58.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im -0.34) (pow (- x.im) y.re) (if (<= x.im 5.8e-53) (pow x.re y.re) (pow 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 (x_46_im <= -0.34) {
tmp = pow(-x_46_im, y_46_re);
} else if (x_46_im <= 5.8e-53) {
tmp = pow(x_46_re, y_46_re);
} else {
tmp = pow(x_46_im, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46im <= (-0.34d0)) then
tmp = -x_46im ** y_46re
else if (x_46im <= 5.8d-53) then
tmp = x_46re ** y_46re
else
tmp = x_46im ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -0.34) {
tmp = Math.pow(-x_46_im, y_46_re);
} else if (x_46_im <= 5.8e-53) {
tmp = Math.pow(x_46_re, y_46_re);
} else {
tmp = Math.pow(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 x_46_im <= -0.34: tmp = math.pow(-x_46_im, y_46_re) elif x_46_im <= 5.8e-53: tmp = math.pow(x_46_re, y_46_re) else: tmp = math.pow(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 (x_46_im <= -0.34) tmp = Float64(-x_46_im) ^ y_46_re; elseif (x_46_im <= 5.8e-53) tmp = x_46_re ^ y_46_re; else tmp = 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 (x_46_im <= -0.34) tmp = -x_46_im ^ y_46_re; elseif (x_46_im <= 5.8e-53) tmp = x_46_re ^ y_46_re; else tmp = 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[x$46$im, -0.34], N[Power[(-x$46$im), y$46$re], $MachinePrecision], If[LessEqual[x$46$im, 5.8e-53], N[Power[x$46$re, y$46$re], $MachinePrecision], N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -0.34:\\
\;\;\;\;{\left(-x.im\right)}^{y.re}\\
\mathbf{elif}\;x.im \leq 5.8 \cdot 10^{-53}:\\
\;\;\;\;{x.re}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if x.im < -0.340000000000000024Initial program 14.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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.3
Applied rewrites46.3%
Taylor expanded in y.re around 0
Applied rewrites48.9%
Taylor expanded in x.im around -inf
mul-1-negN/A
lower-neg.f6459.3
Applied rewrites59.3%
if -0.340000000000000024 < x.im < 5.7999999999999996e-53Initial program 46.6%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6447.4
Applied rewrites47.4%
Taylor expanded in y.re around 0
Applied rewrites51.2%
Taylor expanded in x.im around 0
lower-pow.f6452.7
Applied rewrites52.7%
if 5.7999999999999996e-53 < x.im Initial program 32.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-atan2.f6466.1
Applied rewrites66.1%
Taylor expanded in x.re around 0
unpow2N/A
lower-*.f6469.9
Applied rewrites69.9%
Taylor expanded in y.re around 0
Applied rewrites69.9%
Taylor expanded in y.im around 0
lower-pow.f6458.3
Applied rewrites58.3%
Final simplification56.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -1e-12) (pow x.re y.re) (if (<= y.re 37000.0) 1.0 (pow 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_re <= -1e-12) {
tmp = pow(x_46_re, y_46_re);
} else if (y_46_re <= 37000.0) {
tmp = 1.0;
} else {
tmp = pow(x_46_re, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-1d-12)) then
tmp = x_46re ** y_46re
else if (y_46re <= 37000.0d0) then
tmp = 1.0d0
else
tmp = x_46re ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1e-12) {
tmp = Math.pow(x_46_re, y_46_re);
} else if (y_46_re <= 37000.0) {
tmp = 1.0;
} else {
tmp = Math.pow(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_re <= -1e-12: tmp = math.pow(x_46_re, y_46_re) elif y_46_re <= 37000.0: tmp = 1.0 else: tmp = math.pow(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_re <= -1e-12) tmp = x_46_re ^ y_46_re; elseif (y_46_re <= 37000.0) tmp = 1.0; else tmp = 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_re <= -1e-12) tmp = x_46_re ^ y_46_re; elseif (y_46_re <= 37000.0) tmp = 1.0; else tmp = 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$re, -1e-12], N[Power[x$46$re, y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 37000.0], 1.0, N[Power[x$46$re, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1 \cdot 10^{-12}:\\
\;\;\;\;{x.re}^{y.re}\\
\mathbf{elif}\;y.re \leq 37000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re}\\
\end{array}
\end{array}
if y.re < -9.9999999999999998e-13 or 37000 < y.re Initial program 30.8%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6467.2
Applied rewrites67.2%
Taylor expanded in y.re around 0
Applied rewrites73.3%
Taylor expanded in x.im around 0
lower-pow.f6461.2
Applied rewrites61.2%
if -9.9999999999999998e-13 < y.re < 37000Initial program 35.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6431.3
Applied rewrites31.3%
Taylor expanded in y.re around 0
Applied rewrites48.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -0.0026) (pow x.im y.re) (if (<= y.re 220000000000.0) 1.0 (pow 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 <= -0.0026) {
tmp = pow(x_46_im, y_46_re);
} else if (y_46_re <= 220000000000.0) {
tmp = 1.0;
} else {
tmp = pow(x_46_im, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-0.0026d0)) then
tmp = x_46im ** y_46re
else if (y_46re <= 220000000000.0d0) then
tmp = 1.0d0
else
tmp = x_46im ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -0.0026) {
tmp = Math.pow(x_46_im, y_46_re);
} else if (y_46_re <= 220000000000.0) {
tmp = 1.0;
} else {
tmp = Math.pow(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 <= -0.0026: tmp = math.pow(x_46_im, y_46_re) elif y_46_re <= 220000000000.0: tmp = 1.0 else: tmp = math.pow(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 <= -0.0026) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 220000000000.0) tmp = 1.0; else tmp = 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 <= -0.0026) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 220000000000.0) tmp = 1.0; else tmp = 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, -0.0026], N[Power[x$46$im, y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 220000000000.0], 1.0, N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -0.0026:\\
\;\;\;\;{x.im}^{y.re}\\
\mathbf{elif}\;y.re \leq 220000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if y.re < -0.0025999999999999999 or 2.2e11 < y.re Initial program 29.6%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-atan2.f6469.0
Applied rewrites69.0%
Taylor expanded in x.re around 0
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
Taylor expanded in y.re around 0
Applied rewrites62.8%
Taylor expanded in y.im around 0
lower-pow.f6458.0
Applied rewrites58.0%
if -0.0025999999999999999 < y.re < 2.2e11Initial program 36.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6431.7
Applied rewrites31.7%
Taylor expanded in y.re around 0
Applied rewrites46.8%
(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 33.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.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-*.f6449.5
Applied rewrites49.5%
Taylor expanded in y.re around 0
Applied rewrites25.3%
herbie shell --seed 2024216
(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)))))