
(FPCore (re im) :precision binary64 (* (exp re) (sin im)))
double code(double re, double im) {
return exp(re) * sin(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * sin(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.sin(im);
}
def code(re, im): return math.exp(re) * math.sin(im)
function code(re, im) return Float64(exp(re) * sin(im)) end
function tmp = code(re, im) tmp = exp(re) * sin(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \sin im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (sin im)))
double code(double re, double im) {
return exp(re) * sin(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * sin(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.sin(im);
}
def code(re, im): return math.exp(re) * math.sin(im)
function code(re, im) return Float64(exp(re) * sin(im)) end
function tmp = code(re, im) tmp = exp(re) * sin(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \sin im
\end{array}
(FPCore (re im) :precision binary64 (* (sin im) (exp re)))
double code(double re, double im) {
return sin(im) * exp(re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(im) * exp(re)
end function
public static double code(double re, double im) {
return Math.sin(im) * Math.exp(re);
}
def code(re, im): return math.sin(im) * math.exp(re)
function code(re, im) return Float64(sin(im) * exp(re)) end
function tmp = code(re, im) tmp = sin(im) * exp(re); end
code[re_, im_] := N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin im \cdot e^{re}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin im) (exp re))) (t_1 (* im (exp re))))
(if (<= t_0 (- INFINITY))
(* (fma (* (* im im) -0.16666666666666666) im im) (exp re))
(if (<= t_0 -0.02)
(* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) (sin im))
(if (<= t_0 1e-47)
t_1
(if (<= t_0 1.0)
(*
(fma (/ 1.0 (fma (fma 0.08333333333333333 re -0.5) re 1.0)) re 1.0)
(sin im))
t_1))))))
double code(double re, double im) {
double t_0 = sin(im) * exp(re);
double t_1 = im * exp(re);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(((im * im) * -0.16666666666666666), im, im) * exp(re);
} else if (t_0 <= -0.02) {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * sin(im);
} else if (t_0 <= 1e-47) {
tmp = t_1;
} else if (t_0 <= 1.0) {
tmp = fma((1.0 / fma(fma(0.08333333333333333, re, -0.5), re, 1.0)), re, 1.0) * sin(im);
} else {
tmp = t_1;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(im) * exp(re)) t_1 = Float64(im * exp(re)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(Float64(Float64(im * im) * -0.16666666666666666), im, im) * exp(re)); elseif (t_0 <= -0.02) tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * sin(im)); elseif (t_0 <= 1e-47) tmp = t_1; elseif (t_0 <= 1.0) tmp = Float64(fma(Float64(1.0 / fma(fma(0.08333333333333333, re, -0.5), re, 1.0)), re, 1.0) * sin(im)); else tmp = t_1; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-47], t$95$1, If[LessEqual[t$95$0, 1.0], N[(N[(N[(1.0 / N[(N[(0.08333333333333333 * re + -0.5), $MachinePrecision] * re + 1.0), $MachinePrecision]), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin im \cdot e^{re}\\
t_1 := im \cdot e^{re}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right) \cdot e^{re}\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \sin im\\
\mathbf{elif}\;t\_0 \leq 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(0.08333333333333333, re, -0.5\right), re, 1\right)}, re, 1\right) \cdot \sin im\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f644.1
Applied rewrites4.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6426.4
Applied rewrites26.4%
Applied rewrites26.4%
Taylor expanded in re around inf
lower-exp.f6476.0
Applied rewrites76.0%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6495.9
Applied rewrites95.9%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999997e-48 or 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6495.6
Applied rewrites95.6%
if 9.9999999999999997e-48 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in re around 0
Applied rewrites100.0%
Final simplification94.6%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)
(sin im)))
(t_1 (* (sin im) (exp re)))
(t_2 (* im (exp re))))
(if (<= t_1 (- INFINITY))
(* (fma (* (* im im) -0.16666666666666666) im im) (exp re))
(if (<= t_1 -0.02)
t_0
(if (<= t_1 1e-47) t_2 (if (<= t_1 1.0) t_0 t_2))))))
double code(double re, double im) {
double t_0 = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * sin(im);
double t_1 = sin(im) * exp(re);
double t_2 = im * exp(re);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(((im * im) * -0.16666666666666666), im, im) * exp(re);
} else if (t_1 <= -0.02) {
tmp = t_0;
} else if (t_1 <= 1e-47) {
tmp = t_2;
} else if (t_1 <= 1.0) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * sin(im)) t_1 = Float64(sin(im) * exp(re)) t_2 = Float64(im * exp(re)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(fma(Float64(Float64(im * im) * -0.16666666666666666), im, im) * exp(re)); elseif (t_1 <= -0.02) tmp = t_0; elseif (t_1 <= 1e-47) tmp = t_2; elseif (t_1 <= 1.0) tmp = t_0; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.02], t$95$0, If[LessEqual[t$95$1, 1e-47], t$95$2, If[LessEqual[t$95$1, 1.0], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \sin im\\
t_1 := \sin im \cdot e^{re}\\
t_2 := im \cdot e^{re}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right) \cdot e^{re}\\
\mathbf{elif}\;t\_1 \leq -0.02:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-47}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f644.1
Applied rewrites4.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6426.4
Applied rewrites26.4%
Applied rewrites26.4%
Taylor expanded in re around inf
lower-exp.f6476.0
Applied rewrites76.0%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004 or 9.9999999999999997e-48 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.3
Applied rewrites98.3%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999997e-48 or 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6495.6
Applied rewrites95.6%
Final simplification94.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (fma (fma 0.5 re 1.0) re 1.0) (sin im)))
(t_1 (* (sin im) (exp re)))
(t_2 (* im (exp re))))
(if (<= t_1 (- INFINITY))
(* (fma (* (* im im) -0.16666666666666666) im im) (exp re))
(if (<= t_1 -0.02)
t_0
(if (<= t_1 1e-47) t_2 (if (<= t_1 1.0) t_0 t_2))))))
double code(double re, double im) {
double t_0 = fma(fma(0.5, re, 1.0), re, 1.0) * sin(im);
double t_1 = sin(im) * exp(re);
double t_2 = im * exp(re);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(((im * im) * -0.16666666666666666), im, im) * exp(re);
} else if (t_1 <= -0.02) {
tmp = t_0;
} else if (t_1 <= 1e-47) {
tmp = t_2;
} else if (t_1 <= 1.0) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * sin(im)) t_1 = Float64(sin(im) * exp(re)) t_2 = Float64(im * exp(re)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(fma(Float64(Float64(im * im) * -0.16666666666666666), im, im) * exp(re)); elseif (t_1 <= -0.02) tmp = t_0; elseif (t_1 <= 1e-47) tmp = t_2; elseif (t_1 <= 1.0) tmp = t_0; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.02], t$95$0, If[LessEqual[t$95$1, 1e-47], t$95$2, If[LessEqual[t$95$1, 1.0], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \sin im\\
t_1 := \sin im \cdot e^{re}\\
t_2 := im \cdot e^{re}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right) \cdot e^{re}\\
\mathbf{elif}\;t\_1 \leq -0.02:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-47}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f644.1
Applied rewrites4.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6426.4
Applied rewrites26.4%
Applied rewrites26.4%
Taylor expanded in re around inf
lower-exp.f6476.0
Applied rewrites76.0%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004 or 9.9999999999999997e-48 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.2
Applied rewrites98.2%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999997e-48 or 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6495.6
Applied rewrites95.6%
Final simplification94.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin im) (exp re)))
(t_1 (* (fma (fma 0.5 re 1.0) re 1.0) (sin im)))
(t_2 (* im (exp re))))
(if (<= t_0 (- INFINITY))
(*
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)
(fma (* (* im im) -0.16666666666666666) im im))
(if (<= t_0 -0.02)
t_1
(if (<= t_0 1e-47) t_2 (if (<= t_0 1.0) t_1 t_2))))))
double code(double re, double im) {
double t_0 = sin(im) * exp(re);
double t_1 = fma(fma(0.5, re, 1.0), re, 1.0) * sin(im);
double t_2 = im * exp(re);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(((im * im) * -0.16666666666666666), im, im);
} else if (t_0 <= -0.02) {
tmp = t_1;
} else if (t_0 <= 1e-47) {
tmp = t_2;
} else if (t_0 <= 1.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(im) * exp(re)) t_1 = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * sin(im)) t_2 = Float64(im * exp(re)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); elseif (t_0 <= -0.02) tmp = t_1; elseif (t_0 <= 1e-47) tmp = t_2; elseif (t_0 <= 1.0) tmp = t_1; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], t$95$1, If[LessEqual[t$95$0, 1e-47], t$95$2, If[LessEqual[t$95$0, 1.0], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin im \cdot e^{re}\\
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \sin im\\
t_2 := im \cdot e^{re}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{-47}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f644.1
Applied rewrites4.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6426.4
Applied rewrites26.4%
Applied rewrites26.4%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6457.0
Applied rewrites57.0%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004 or 9.9999999999999997e-48 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.2
Applied rewrites98.2%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999997e-48 or 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6495.6
Applied rewrites95.6%
Final simplification92.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin im) (exp re)))
(t_1 (* (+ 1.0 re) (sin im)))
(t_2 (* im (exp re))))
(if (<= t_0 (- INFINITY))
(*
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)
(fma (* (* im im) -0.16666666666666666) im im))
(if (<= t_0 -0.02)
t_1
(if (<= t_0 1e-47) t_2 (if (<= t_0 1.0) t_1 t_2))))))
double code(double re, double im) {
double t_0 = sin(im) * exp(re);
double t_1 = (1.0 + re) * sin(im);
double t_2 = im * exp(re);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(((im * im) * -0.16666666666666666), im, im);
} else if (t_0 <= -0.02) {
tmp = t_1;
} else if (t_0 <= 1e-47) {
tmp = t_2;
} else if (t_0 <= 1.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(im) * exp(re)) t_1 = Float64(Float64(1.0 + re) * sin(im)) t_2 = Float64(im * exp(re)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); elseif (t_0 <= -0.02) tmp = t_1; elseif (t_0 <= 1e-47) tmp = t_2; elseif (t_0 <= 1.0) tmp = t_1; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 + re), $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(im * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], t$95$1, If[LessEqual[t$95$0, 1e-47], t$95$2, If[LessEqual[t$95$0, 1.0], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin im \cdot e^{re}\\
t_1 := \left(1 + re\right) \cdot \sin im\\
t_2 := im \cdot e^{re}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{-47}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f644.1
Applied rewrites4.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6426.4
Applied rewrites26.4%
Applied rewrites26.4%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6457.0
Applied rewrites57.0%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004 or 9.9999999999999997e-48 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6498.1
Applied rewrites98.1%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999997e-48 or 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6495.6
Applied rewrites95.6%
Final simplification92.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin im) (exp re))) (t_1 (* im (exp re))))
(if (<= t_0 (- INFINITY))
(*
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)
(fma (* (* im im) -0.16666666666666666) im im))
(if (<= t_0 -0.02)
(sin im)
(if (<= t_0 1e-47) t_1 (if (<= t_0 1.0) (sin im) t_1))))))
double code(double re, double im) {
double t_0 = sin(im) * exp(re);
double t_1 = im * exp(re);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(((im * im) * -0.16666666666666666), im, im);
} else if (t_0 <= -0.02) {
tmp = sin(im);
} else if (t_0 <= 1e-47) {
tmp = t_1;
} else if (t_0 <= 1.0) {
tmp = sin(im);
} else {
tmp = t_1;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(im) * exp(re)) t_1 = Float64(im * exp(re)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); elseif (t_0 <= -0.02) tmp = sin(im); elseif (t_0 <= 1e-47) tmp = t_1; elseif (t_0 <= 1.0) tmp = sin(im); else tmp = t_1; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$0, 1e-47], t$95$1, If[LessEqual[t$95$0, 1.0], N[Sin[im], $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin im \cdot e^{re}\\
t_1 := im \cdot e^{re}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\sin im\\
\mathbf{elif}\;t\_0 \leq 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin im\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f644.1
Applied rewrites4.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6426.4
Applied rewrites26.4%
Applied rewrites26.4%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6457.0
Applied rewrites57.0%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004 or 9.9999999999999997e-48 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6497.4
Applied rewrites97.4%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999997e-48 or 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6495.6
Applied rewrites95.6%
Final simplification92.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin im) (exp re)))
(t_1 (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)))
(if (<= t_0 (- INFINITY))
(* t_1 (fma (* (* im im) -0.16666666666666666) im im))
(if (<= t_0 1.0) (sin im) (* t_1 im)))))
double code(double re, double im) {
double t_0 = sin(im) * exp(re);
double t_1 = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1 * fma(((im * im) * -0.16666666666666666), im, im);
} else if (t_0 <= 1.0) {
tmp = sin(im);
} else {
tmp = t_1 * im;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(im) * exp(re)) t_1 = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(t_1 * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); elseif (t_0 <= 1.0) tmp = sin(im); else tmp = Float64(t_1 * im); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(t$95$1 * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[im], $MachinePrecision], N[(t$95$1 * im), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin im \cdot e^{re}\\
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin im\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot im\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f644.1
Applied rewrites4.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6426.4
Applied rewrites26.4%
Applied rewrites26.4%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6457.0
Applied rewrites57.0%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6470.4
Applied rewrites70.4%
if 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6485.3
Applied rewrites85.3%
Taylor expanded in re around 0
Applied rewrites62.8%
Final simplification68.0%
(FPCore (re im)
:precision binary64
(if (<= (* (sin im) (exp re)) 0.0)
(*
(fma (fma 0.5 re 1.0) re 1.0)
(fma (* (* im im) -0.16666666666666666) im im))
(* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) im)))
double code(double re, double im) {
double tmp;
if ((sin(im) * exp(re)) <= 0.0) {
tmp = fma(fma(0.5, re, 1.0), re, 1.0) * fma(((im * im) * -0.16666666666666666), im, im);
} else {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(sin(im) * exp(re)) <= 0.0) tmp = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); else tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin im \cdot e^{re} \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot im\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6442.9
Applied rewrites42.9%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6423.1
Applied rewrites23.1%
Applied rewrites23.1%
Taylor expanded in re around 0
+-commutativeN/A
lft-mult-inverseN/A
*-lft-identityN/A
lft-mult-inverseN/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
Applied rewrites26.3%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6458.7
Applied rewrites58.7%
Taylor expanded in re around 0
Applied rewrites51.4%
Final simplification37.6%
(FPCore (re im) :precision binary64 (if (<= (* (sin im) (exp re)) 0.0) (* (+ 1.0 re) (fma (* (* im im) -0.16666666666666666) im im)) (* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) im)))
double code(double re, double im) {
double tmp;
if ((sin(im) * exp(re)) <= 0.0) {
tmp = (1.0 + re) * fma(((im * im) * -0.16666666666666666), im, im);
} else {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(sin(im) * exp(re)) <= 0.0) tmp = Float64(Float64(1.0 + re) * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); else tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(1.0 + re), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin im \cdot e^{re} \leq 0:\\
\;\;\;\;\left(1 + re\right) \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot im\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6442.9
Applied rewrites42.9%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6423.1
Applied rewrites23.1%
Applied rewrites23.1%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6458.7
Applied rewrites58.7%
Taylor expanded in re around 0
Applied rewrites51.4%
Final simplification35.8%
(FPCore (re im) :precision binary64 (if (<= (* (sin im) (exp re)) 0.0) (* 1.0 (fma (* (* im im) -0.16666666666666666) im im)) (* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) im)))
double code(double re, double im) {
double tmp;
if ((sin(im) * exp(re)) <= 0.0) {
tmp = 1.0 * fma(((im * im) * -0.16666666666666666), im, im);
} else {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(sin(im) * exp(re)) <= 0.0) tmp = Float64(1.0 * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); else tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin im \cdot e^{re} \leq 0:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot im\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6442.9
Applied rewrites42.9%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6423.1
Applied rewrites23.1%
Applied rewrites23.1%
Taylor expanded in re around 0
Applied rewrites22.7%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6458.7
Applied rewrites58.7%
Taylor expanded in re around 0
Applied rewrites51.4%
Final simplification35.6%
(FPCore (re im) :precision binary64 (if (<= (* (sin im) (exp re)) 0.0) (* 1.0 (fma (* (* im im) -0.16666666666666666) im im)) (fma (fma (* (fma 0.16666666666666666 re 0.5) im) re im) re im)))
double code(double re, double im) {
double tmp;
if ((sin(im) * exp(re)) <= 0.0) {
tmp = 1.0 * fma(((im * im) * -0.16666666666666666), im, im);
} else {
tmp = fma(fma((fma(0.16666666666666666, re, 0.5) * im), re, im), re, im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(sin(im) * exp(re)) <= 0.0) tmp = Float64(1.0 * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); else tmp = fma(fma(Float64(fma(0.16666666666666666, re, 0.5) * im), re, im), re, im); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * im), $MachinePrecision] * re + im), $MachinePrecision] * re + im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin im \cdot e^{re} \leq 0:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot im, re, im\right), re, im\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6442.9
Applied rewrites42.9%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6423.1
Applied rewrites23.1%
Applied rewrites23.1%
Taylor expanded in re around 0
Applied rewrites22.7%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6458.7
Applied rewrites58.7%
Taylor expanded in re around 0
Applied rewrites48.1%
Final simplification34.1%
(FPCore (re im) :precision binary64 (if (<= (* (sin im) (exp re)) 0.0005) (* 1.0 (fma (* (* im im) -0.16666666666666666) im im)) (fma (* (* (* re re) im) 0.16666666666666666) re im)))
double code(double re, double im) {
double tmp;
if ((sin(im) * exp(re)) <= 0.0005) {
tmp = 1.0 * fma(((im * im) * -0.16666666666666666), im, im);
} else {
tmp = fma((((re * re) * im) * 0.16666666666666666), re, im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(sin(im) * exp(re)) <= 0.0005) tmp = Float64(1.0 * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); else tmp = fma(Float64(Float64(Float64(re * re) * im) * 0.16666666666666666), re, im); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.0005], N[(1.0 * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(re * re), $MachinePrecision] * im), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re + im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin im \cdot e^{re} \leq 0.0005:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666, re, im\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.0000000000000001e-4Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6453.9
Applied rewrites53.9%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6438.1
Applied rewrites38.1%
Applied rewrites38.1%
Taylor expanded in re around 0
Applied rewrites37.6%
if 5.0000000000000001e-4 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6439.2
Applied rewrites39.2%
Taylor expanded in re around 0
Applied rewrites24.5%
Taylor expanded in re around inf
Applied rewrites25.7%
Final simplification34.0%
(FPCore (re im) :precision binary64 (if (<= (* (sin im) (exp re)) 0.98) (fma (fma (* im re) 0.5 im) re im) (* (* (* (fma 0.16666666666666666 re 0.5) im) re) re)))
double code(double re, double im) {
double tmp;
if ((sin(im) * exp(re)) <= 0.98) {
tmp = fma(fma((im * re), 0.5, im), re, im);
} else {
tmp = ((fma(0.16666666666666666, re, 0.5) * im) * re) * re;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(sin(im) * exp(re)) <= 0.98) tmp = fma(fma(Float64(im * re), 0.5, im), re, im); else tmp = Float64(Float64(Float64(fma(0.16666666666666666, re, 0.5) * im) * re) * re); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.98], N[(N[(N[(im * re), $MachinePrecision] * 0.5 + im), $MachinePrecision] * re + im), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * im), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin im \cdot e^{re} \leq 0.98:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(im \cdot re, 0.5, im\right), re, im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot im\right) \cdot re\right) \cdot re\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.97999999999999998Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6462.0
Applied rewrites62.0%
Taylor expanded in re around 0
Applied rewrites32.7%
if 0.97999999999999998 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6476.9
Applied rewrites76.9%
Taylor expanded in re around 0
Applied rewrites46.8%
Taylor expanded in re around inf
Applied rewrites46.8%
Final simplification34.8%
(FPCore (re im)
:precision binary64
(if (<= (sin im) 0.0005)
(*
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)
(fma (* (* im im) -0.16666666666666666) im im))
(fma (* (* (* im re) re) 0.16666666666666666) re im)))
double code(double re, double im) {
double tmp;
if (sin(im) <= 0.0005) {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(((im * im) * -0.16666666666666666), im, im);
} else {
tmp = fma((((im * re) * re) * 0.16666666666666666), re, im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (sin(im) <= 0.0005) tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(Float64(Float64(im * im) * -0.16666666666666666), im, im)); else tmp = fma(Float64(Float64(Float64(im * re) * re) * 0.16666666666666666), re, im); end return tmp end
code[re_, im_] := If[LessEqual[N[Sin[im], $MachinePrecision], 0.0005], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * im + im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(im * re), $MachinePrecision] * re), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re + im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin im \leq 0.0005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \mathsf{fma}\left(\left(im \cdot im\right) \cdot -0.16666666666666666, im, im\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(im \cdot re\right) \cdot re\right) \cdot 0.16666666666666666, re, im\right)\\
\end{array}
\end{array}
if (sin.f64 im) < 5.0000000000000001e-4Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6454.2
Applied rewrites54.2%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6438.5
Applied rewrites38.5%
Applied rewrites38.5%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6449.9
Applied rewrites49.9%
if 5.0000000000000001e-4 < (sin.f64 im) Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6440.0
Applied rewrites40.0%
Taylor expanded in re around 0
Applied rewrites14.0%
Taylor expanded in re around inf
Applied rewrites14.0%
Applied rewrites14.0%
Final simplification38.8%
(FPCore (re im) :precision binary64 (fma (* (* (* re re) im) 0.16666666666666666) re im))
double code(double re, double im) {
return fma((((re * re) * im) * 0.16666666666666666), re, im);
}
function code(re, im) return fma(Float64(Float64(Float64(re * re) * im) * 0.16666666666666666), re, im) end
code[re_, im_] := N[(N[(N[(N[(re * re), $MachinePrecision] * im), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re + im), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666, re, im\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6464.2
Applied rewrites64.2%
Taylor expanded in re around 0
Applied rewrites35.4%
Taylor expanded in re around inf
Applied rewrites35.0%
(FPCore (re im) :precision binary64 (fma (* (* (* im re) re) 0.16666666666666666) re im))
double code(double re, double im) {
return fma((((im * re) * re) * 0.16666666666666666), re, im);
}
function code(re, im) return fma(Float64(Float64(Float64(im * re) * re) * 0.16666666666666666), re, im) end
code[re_, im_] := N[(N[(N[(N[(im * re), $MachinePrecision] * re), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re + im), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\left(im \cdot re\right) \cdot re\right) \cdot 0.16666666666666666, re, im\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6464.2
Applied rewrites64.2%
Taylor expanded in re around 0
Applied rewrites35.4%
Taylor expanded in re around inf
Applied rewrites35.0%
Applied rewrites34.6%
(FPCore (re im) :precision binary64 (* (fma (fma 0.5 re 1.0) re 1.0) im))
double code(double re, double im) {
return fma(fma(0.5, re, 1.0), re, 1.0) * im;
}
function code(re, im) return Float64(fma(fma(0.5, re, 1.0), re, 1.0) * im) end
code[re_, im_] := N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot im
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6464.2
Applied rewrites64.2%
Taylor expanded in re around 0
Applied rewrites33.6%
(FPCore (re im) :precision binary64 (fma (fma (* im re) 0.5 im) re im))
double code(double re, double im) {
return fma(fma((im * re), 0.5, im), re, im);
}
function code(re, im) return fma(fma(Float64(im * re), 0.5, im), re, im) end
code[re_, im_] := N[(N[(N[(im * re), $MachinePrecision] * 0.5 + im), $MachinePrecision] * re + im), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(im \cdot re, 0.5, im\right), re, im\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6464.2
Applied rewrites64.2%
Taylor expanded in re around 0
Applied rewrites31.4%
Final simplification31.4%
(FPCore (re im) :precision binary64 (if (<= im 2.6e+50) (* 1.0 im) (* im re)))
double code(double re, double im) {
double tmp;
if (im <= 2.6e+50) {
tmp = 1.0 * im;
} else {
tmp = im * re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2.6d+50) then
tmp = 1.0d0 * im
else
tmp = im * re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.6e+50) {
tmp = 1.0 * im;
} else {
tmp = im * re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.6e+50: tmp = 1.0 * im else: tmp = im * re return tmp
function code(re, im) tmp = 0.0 if (im <= 2.6e+50) tmp = Float64(1.0 * im); else tmp = Float64(im * re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.6e+50) tmp = 1.0 * im; else tmp = im * re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.6e+50], N[(1.0 * im), $MachinePrecision], N[(im * re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.6 \cdot 10^{+50}:\\
\;\;\;\;1 \cdot im\\
\mathbf{else}:\\
\;\;\;\;im \cdot re\\
\end{array}
\end{array}
if im < 2.6000000000000002e50Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6473.3
Applied rewrites73.3%
Taylor expanded in re around 0
Applied rewrites33.7%
if 2.6000000000000002e50 < im Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6440.1
Applied rewrites40.1%
Taylor expanded in re around 0
Applied rewrites9.5%
Taylor expanded in re around inf
Applied rewrites10.2%
(FPCore (re im) :precision binary64 (fma re im im))
double code(double re, double im) {
return fma(re, im, im);
}
function code(re, im) return fma(re, im, im) end
code[re_, im_] := N[(re * im + im), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(re, im, im\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6464.2
Applied rewrites64.2%
Taylor expanded in re around 0
Applied rewrites28.2%
(FPCore (re im) :precision binary64 (* im re))
double code(double re, double im) {
return im * re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im * re
end function
public static double code(double re, double im) {
return im * re;
}
def code(re, im): return im * re
function code(re, im) return Float64(im * re) end
function tmp = code(re, im) tmp = im * re; end
code[re_, im_] := N[(im * re), $MachinePrecision]
\begin{array}{l}
\\
im \cdot re
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6464.2
Applied rewrites64.2%
Taylor expanded in re around 0
Applied rewrites28.2%
Taylor expanded in re around inf
Applied rewrites6.7%
herbie shell --seed 2024259
(FPCore (re im)
:name "math.exp on complex, imaginary part"
:precision binary64
(* (exp re) (sin im)))