
(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 19 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 (* y.re (atan2 x.im x.re)))
(t_2 (sin t_1))
(t_3 (cos t_1))
(t_4 (* y.im t_3))
(t_5 (log (/ -1.0 x.im)))
(t_6
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))))
(if (<= x.im -3e-225)
(* (exp (- (fma y.re t_5 t_0))) (- t_2 (* t_5 t_4)))
(if (<= x.im 3.9e-201)
(* t_6 (fma t_4 (log (sqrt (fma x.im x.im (* x.re x.re)))) t_2))
(if (<= x.im 6e-25)
(* t_6 (fma y.im (* t_3 (log x.im)) t_2))
(*
(exp (- (* y.re (log x.im)) t_0))
(sin (+ t_1 (* y.im (log x.im))))))))))
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 = sin(t_1);
double t_3 = cos(t_1);
double t_4 = y_46_im * t_3;
double t_5 = log((-1.0 / x_46_im));
double t_6 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
double tmp;
if (x_46_im <= -3e-225) {
tmp = exp(-fma(y_46_re, t_5, t_0)) * (t_2 - (t_5 * t_4));
} else if (x_46_im <= 3.9e-201) {
tmp = t_6 * fma(t_4, log(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re)))), t_2);
} else if (x_46_im <= 6e-25) {
tmp = t_6 * fma(y_46_im, (t_3 * log(x_46_im)), t_2);
} else {
tmp = exp(((y_46_re * log(x_46_im)) - t_0)) * sin((t_1 + (y_46_im * log(x_46_im))));
}
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 = sin(t_1) t_3 = cos(t_1) t_4 = Float64(y_46_im * t_3) t_5 = log(Float64(-1.0 / x_46_im)) t_6 = 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)) tmp = 0.0 if (x_46_im <= -3e-225) tmp = Float64(exp(Float64(-fma(y_46_re, t_5, t_0))) * Float64(t_2 - Float64(t_5 * t_4))); elseif (x_46_im <= 3.9e-201) tmp = Float64(t_6 * fma(t_4, log(sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)))), t_2)); elseif (x_46_im <= 6e-25) tmp = Float64(t_6 * fma(y_46_im, Float64(t_3 * log(x_46_im)), t_2)); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)) * sin(Float64(t_1 + Float64(y_46_im * log(x_46_im))))); 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[Sin[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Cos[t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[(y$46$im * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = 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]}, If[LessEqual[x$46$im, -3e-225], N[(N[Exp[(-N[(y$46$re * t$95$5 + t$95$0), $MachinePrecision])], $MachinePrecision] * N[(t$95$2 - N[(t$95$5 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 3.9e-201], N[(t$95$6 * N[(t$95$4 * N[Log[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 6e-25], N[(t$95$6 * N[(y$46$im * N[(t$95$3 * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] + t$95$2), $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[(t$95$1 + N[(y$46$im * N[Log[x$46$im], $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 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \sin t\_1\\
t_3 := \cos t\_1\\
t_4 := y.im \cdot t\_3\\
t_5 := \log \left(\frac{-1}{x.im}\right)\\
t_6 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0}\\
\mathbf{if}\;x.im \leq -3 \cdot 10^{-225}:\\
\;\;\;\;e^{-\mathsf{fma}\left(y.re, t\_5, t\_0\right)} \cdot \left(t\_2 - t\_5 \cdot t\_4\right)\\
\mathbf{elif}\;x.im \leq 3.9 \cdot 10^{-201}:\\
\;\;\;\;t\_6 \cdot \mathsf{fma}\left(t\_4, \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right), t\_2\right)\\
\mathbf{elif}\;x.im \leq 6 \cdot 10^{-25}:\\
\;\;\;\;t\_6 \cdot \mathsf{fma}\left(y.im, t\_3 \cdot \log x.im, t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t\_0} \cdot \sin \left(t\_1 + y.im \cdot \log x.im\right)\\
\end{array}
\end{array}
if x.im < -3.00000000000000018e-225Initial program 35.8%
Taylor expanded in y.im around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f6440.7
Simplified40.7%
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
Simplified70.9%
if -3.00000000000000018e-225 < x.im < 3.9000000000000003e-201Initial program 29.9%
Taylor expanded in y.im around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f6441.8
Simplified41.8%
if 3.9000000000000003e-201 < x.im < 5.9999999999999995e-25Initial program 50.1%
Taylor expanded in x.re around 0
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f6475.2
Simplified75.2%
Taylor expanded in y.im around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-log.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f6477.9
Simplified77.9%
if 5.9999999999999995e-25 < x.im Initial program 33.7%
Applied egg-rr13.5%
Taylor expanded in x.im around inf
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
log-recN/A
lower-neg.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-sin.f64N/A
+-commutativeN/A
Simplified78.8%
Final simplification69.6%
(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 (sin t_1))
(t_3 (cos t_1))
(t_4 (log (/ -1.0 x.im))))
(if (<= x.im -5e-224)
(* (exp (- (fma y.re t_4 t_0))) (- t_2 (* t_4 (* y.im t_3))))
(if (<= x.im 2.15e-271)
(* y.im (* (exp (- t_0)) (log (hypot x.re x.im))))
(if (<= x.im 6e-25)
(*
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(fma y.im (* t_3 (log x.im)) t_2))
(*
(exp (- (* y.re (log x.im)) t_0))
(sin (+ t_1 (* y.im (log x.im))))))))))
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 = sin(t_1);
double t_3 = cos(t_1);
double t_4 = log((-1.0 / x_46_im));
double tmp;
if (x_46_im <= -5e-224) {
tmp = exp(-fma(y_46_re, t_4, t_0)) * (t_2 - (t_4 * (y_46_im * t_3)));
} else if (x_46_im <= 2.15e-271) {
tmp = y_46_im * (exp(-t_0) * log(hypot(x_46_re, x_46_im)));
} else if (x_46_im <= 6e-25) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * fma(y_46_im, (t_3 * log(x_46_im)), t_2);
} else {
tmp = exp(((y_46_re * log(x_46_im)) - t_0)) * sin((t_1 + (y_46_im * log(x_46_im))));
}
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 = sin(t_1) t_3 = cos(t_1) t_4 = log(Float64(-1.0 / x_46_im)) tmp = 0.0 if (x_46_im <= -5e-224) tmp = Float64(exp(Float64(-fma(y_46_re, t_4, t_0))) * Float64(t_2 - Float64(t_4 * Float64(y_46_im * t_3)))); elseif (x_46_im <= 2.15e-271) tmp = Float64(y_46_im * Float64(exp(Float64(-t_0)) * log(hypot(x_46_re, x_46_im)))); elseif (x_46_im <= 6e-25) 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)) * fma(y_46_im, Float64(t_3 * log(x_46_im)), t_2)); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)) * sin(Float64(t_1 + Float64(y_46_im * log(x_46_im))))); 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[Sin[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Cos[t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -5e-224], N[(N[Exp[(-N[(y$46$re * t$95$4 + t$95$0), $MachinePrecision])], $MachinePrecision] * N[(t$95$2 - N[(t$95$4 * N[(y$46$im * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 2.15e-271], N[(y$46$im * N[(N[Exp[(-t$95$0)], $MachinePrecision] * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 6e-25], 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[(y$46$im * N[(t$95$3 * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] + t$95$2), $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[(t$95$1 + N[(y$46$im * N[Log[x$46$im], $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 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \sin t\_1\\
t_3 := \cos t\_1\\
t_4 := \log \left(\frac{-1}{x.im}\right)\\
\mathbf{if}\;x.im \leq -5 \cdot 10^{-224}:\\
\;\;\;\;e^{-\mathsf{fma}\left(y.re, t\_4, t\_0\right)} \cdot \left(t\_2 - t\_4 \cdot \left(y.im \cdot t\_3\right)\right)\\
\mathbf{elif}\;x.im \leq 2.15 \cdot 10^{-271}:\\
\;\;\;\;y.im \cdot \left(e^{-t\_0} \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)\\
\mathbf{elif}\;x.im \leq 6 \cdot 10^{-25}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0} \cdot \mathsf{fma}\left(y.im, t\_3 \cdot \log x.im, t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t\_0} \cdot \sin \left(t\_1 + y.im \cdot \log x.im\right)\\
\end{array}
\end{array}
if x.im < -4.9999999999999999e-224Initial program 41.0%
Taylor expanded in y.im around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f6448.4
Simplified48.4%
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
Simplified66.2%
if -4.9999999999999999e-224 < x.im < 2.15e-271Initial program 41.4%
Taylor expanded in y.im around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f6448.7
Simplified48.7%
Taylor expanded in y.re around 0
lower-*.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
neg-mul-1N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6432.2
Simplified32.2%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lower-hypot.f6441.9
Applied egg-rr41.9%
if 2.15e-271 < x.im < 5.9999999999999995e-25Initial program 51.3%
Taylor expanded in x.re around 0
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f6458.3
Simplified58.3%
Taylor expanded in y.im around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-log.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-atan2.f6456.8
Simplified56.8%
if 5.9999999999999995e-25 < x.im Initial program 33.1%
Applied egg-rr10.2%
Taylor expanded in x.im around inf
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
log-recN/A
lower-neg.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-sin.f64N/A
+-commutativeN/A
Simplified75.6%
Final simplification64.4%
herbie shell --seed 2024218
(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)))))