
(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 21 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 (* (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}
Initial program 100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))) (t_1 (* (exp re) im)))
(if (<= t_0 (- INFINITY))
(*
(fma re (fma re 0.5 1.0) 1.0)
(fma
(fma
im
(* im (fma (* im im) -0.0001984126984126984 0.008333333333333333))
-0.16666666666666666)
(* im (* im im))
im))
(if (<= t_0 -0.02)
(sin im)
(if (<= t_0 2e-92) t_1 (if (<= t_0 1.0) (sin im) t_1))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double t_1 = exp(re) * im;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, (im * fma((im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), (im * (im * im)), im);
} else if (t_0 <= -0.02) {
tmp = sin(im);
} else if (t_0 <= 2e-92) {
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(exp(re) * sin(im)) t_1 = Float64(exp(re) * im) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, Float64(im * fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), Float64(im * Float64(im * im)), im)); elseif (t_0 <= -0.02) tmp = sin(im); elseif (t_0 <= 2e-92) 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[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$0, 2e-92], 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 := e^{re} \cdot \sin im\\
t_1 := e^{re} \cdot im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im \cdot \left(im \cdot im\right), im\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\sin im\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-92}:\\
\;\;\;\;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
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6442.3
Simplified42.3%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
lower-fma.f64N/A
Simplified47.6%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004 or 1.99999999999999998e-92 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f64100.0
Simplified100.0%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.99999999999999998e-92 or 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6494.8
Simplified94.8%
Final simplification90.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (fma im (* im 0.008333333333333333) -0.16666666666666666))
(t_1 (* im (* im im)))
(t_2 (* (exp re) (sin im)))
(t_3 (fma t_1 t_0 (- im))))
(if (<= t_2 (- INFINITY))
(*
(fma re (fma re 0.5 1.0) 1.0)
(fma
(fma
im
(* im (fma (* im im) -0.0001984126984126984 0.008333333333333333))
-0.16666666666666666)
t_1
im))
(if (<= t_2 -0.02)
(sin im)
(if (<= t_2 0.0)
(/ (* (fma t_1 t_0 im) t_3) t_3)
(if (<= t_2 1.0)
(sin im)
(*
im
(fma
re
(fma
re
(/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25)
1.0)
1.0))))))))
double code(double re, double im) {
double t_0 = fma(im, (im * 0.008333333333333333), -0.16666666666666666);
double t_1 = im * (im * im);
double t_2 = exp(re) * sin(im);
double t_3 = fma(t_1, t_0, -im);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, (im * fma((im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), t_1, im);
} else if (t_2 <= -0.02) {
tmp = sin(im);
} else if (t_2 <= 0.0) {
tmp = (fma(t_1, t_0, im) * t_3) / t_3;
} else if (t_2 <= 1.0) {
tmp = sin(im);
} else {
tmp = im * fma(re, fma(re, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = fma(im, Float64(im * 0.008333333333333333), -0.16666666666666666) t_1 = Float64(im * Float64(im * im)) t_2 = Float64(exp(re) * sin(im)) t_3 = fma(t_1, t_0, Float64(-im)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, Float64(im * fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), t_1, im)); elseif (t_2 <= -0.02) tmp = sin(im); elseif (t_2 <= 0.0) tmp = Float64(Float64(fma(t_1, t_0, im) * t_3) / t_3); elseif (t_2 <= 1.0) tmp = sin(im); else tmp = Float64(im * fma(re, fma(re, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(im * 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * t$95$0 + (-im)), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * t$95$1 + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.02], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(N[(t$95$1 * t$95$0 + im), $MachinePrecision] * t$95$3), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$2, 1.0], N[Sin[im], $MachinePrecision], N[(im * N[(re * N[(re * N[(N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629 + 0.125), $MachinePrecision] / 0.25), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(im, im \cdot 0.008333333333333333, -0.16666666666666666\right)\\
t_1 := im \cdot \left(im \cdot im\right)\\
t_2 := e^{re} \cdot \sin im\\
t_3 := \mathsf{fma}\left(t\_1, t\_0, -im\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), t\_1, im\right)\\
\mathbf{elif}\;t\_2 \leq -0.02:\\
\;\;\;\;\sin im\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, t\_0, im\right) \cdot t\_3}{t\_3}\\
\mathbf{elif}\;t\_2 \leq 1:\\
\;\;\;\;\sin im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{\mathsf{fma}\left(re \cdot \left(re \cdot re\right), 0.004629629629629629, 0.125\right)}{0.25}, 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6442.3
Simplified42.3%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
lower-fma.f64N/A
Simplified47.6%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004 or 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6499.2
Simplified99.2%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6437.8
Simplified37.8%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6437.4
Simplified37.4%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
flip-+N/A
lower-/.f64N/A
Applied egg-rr32.3%
if 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6475.8
Simplified75.8%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6455.4
Simplified55.4%
flip3-+N/A
lower-/.f64N/A
unpow-prod-downN/A
lower-fma.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-+r-N/A
lower--.f64N/A
swap-sqrN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
metadata-eval19.0
Applied egg-rr19.0%
Taylor expanded in re around 0
Simplified58.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))))
(if (<= t_0 (- INFINITY))
(*
(fma re (fma re 0.5 1.0) 1.0)
(fma
(fma
im
(* im (fma (* im im) -0.0001984126984126984 0.008333333333333333))
-0.16666666666666666)
(* im (* im im))
im))
(if (<= t_0 1.0)
(sin im)
(*
im
(fma
re
(fma
re
(/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25)
1.0)
1.0))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, (im * fma((im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), (im * (im * im)), im);
} else if (t_0 <= 1.0) {
tmp = sin(im);
} else {
tmp = im * fma(re, fma(re, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, Float64(im * fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), Float64(im * Float64(im * im)), im)); elseif (t_0 <= 1.0) tmp = sin(im); else tmp = Float64(im * fma(re, fma(re, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[im], $MachinePrecision], N[(im * N[(re * N[(re * N[(N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629 + 0.125), $MachinePrecision] / 0.25), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im \cdot \left(im \cdot im\right), im\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{\mathsf{fma}\left(re \cdot \left(re \cdot re\right), 0.004629629629629629, 0.125\right)}{0.25}, 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6442.3
Simplified42.3%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
lower-fma.f64N/A
Simplified47.6%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6466.8
Simplified66.8%
if 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6475.8
Simplified75.8%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6455.4
Simplified55.4%
flip3-+N/A
lower-/.f64N/A
unpow-prod-downN/A
lower-fma.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-+r-N/A
lower--.f64N/A
swap-sqrN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
metadata-eval19.0
Applied egg-rr19.0%
Taylor expanded in re around 0
Simplified58.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im)))
(t_1 (fma 0.5 (* re re) re))
(t_2 (* im t_1)))
(if (<= t_0 -0.02)
(*
(fma re (fma re 0.5 1.0) 1.0)
(fma
(fma
im
(* im (fma (* im im) -0.0001984126984126984 0.008333333333333333))
-0.16666666666666666)
(* im (* im im))
im))
(if (<= t_0 0.0)
(/ (- (* im im) (* t_1 (* im t_2))) (- im t_2))
(*
im
(fma
re
(fma
re
(/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25)
1.0)
1.0))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double t_1 = fma(0.5, (re * re), re);
double t_2 = im * t_1;
double tmp;
if (t_0 <= -0.02) {
tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, (im * fma((im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), (im * (im * im)), im);
} else if (t_0 <= 0.0) {
tmp = ((im * im) - (t_1 * (im * t_2))) / (im - t_2);
} else {
tmp = im * fma(re, fma(re, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) t_1 = fma(0.5, Float64(re * re), re) t_2 = Float64(im * t_1) tmp = 0.0 if (t_0 <= -0.02) tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, Float64(im * fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), Float64(im * Float64(im * im)), im)); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(im * im) - Float64(t_1 * Float64(im * t_2))) / Float64(im - t_2)); else tmp = Float64(im * fma(re, fma(re, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(re * re), $MachinePrecision] + re), $MachinePrecision]}, Block[{t$95$2 = N[(im * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$0, -0.02], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(im * im), $MachinePrecision] - N[(t$95$1 * N[(im * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im - t$95$2), $MachinePrecision]), $MachinePrecision], N[(im * N[(re * N[(re * N[(N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629 + 0.125), $MachinePrecision] / 0.25), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
t_1 := \mathsf{fma}\left(0.5, re \cdot re, re\right)\\
t_2 := im \cdot t\_1\\
\mathbf{if}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im \cdot \left(im \cdot im\right), im\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{im \cdot im - t\_1 \cdot \left(im \cdot t\_2\right)}{im - t\_2}\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{\mathsf{fma}\left(re \cdot \left(re \cdot re\right), 0.004629629629629629, 0.125\right)}{0.25}, 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0200000000000000004Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6470.2
Simplified70.2%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
lower-fma.f64N/A
Simplified25.5%
if -0.0200000000000000004 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
associate-*r*N/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6437.0
Simplified37.0%
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
flip-+N/A
lower-/.f64N/A
Applied egg-rr21.2%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6455.0
Simplified55.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6448.0
Simplified48.0%
flip3-+N/A
lower-/.f64N/A
unpow-prod-downN/A
lower-fma.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-+r-N/A
lower--.f64N/A
swap-sqrN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
metadata-eval35.5
Applied egg-rr35.5%
Taylor expanded in re around 0
Simplified49.0%
(FPCore (re im)
:precision binary64
(if (<= (* (exp re) (sin im)) 5e-5)
(*
(fma re (fma re 0.5 1.0) 1.0)
(fma
(fma
im
(* im (fma (* im im) -0.0001984126984126984 0.008333333333333333))
-0.16666666666666666)
(* im (* im im))
im))
(*
im
(fma
re
(fma re (/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25) 1.0)
1.0))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 5e-5) {
tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, (im * fma((im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), (im * (im * im)), im);
} else {
tmp = im * fma(re, fma(re, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 5e-5) tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(fma(im, Float64(im * fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), Float64(im * Float64(im * im)), im)); else tmp = Float64(im * fma(re, fma(re, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 5e-5], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], N[(im * N[(re * N[(re * N[(N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629 + 0.125), $MachinePrecision] / 0.25), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im \cdot \left(im \cdot im\right), im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{\mathsf{fma}\left(re \cdot \left(re \cdot re\right), 0.004629629629629629, 0.125\right)}{0.25}, 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.00000000000000024e-5Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6456.4
Simplified56.4%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
lower-fma.f64N/A
Simplified42.5%
if 5.00000000000000024e-5 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6437.9
Simplified37.9%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6428.2
Simplified28.2%
flip3-+N/A
lower-/.f64N/A
unpow-prod-downN/A
lower-fma.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-+r-N/A
lower--.f64N/A
swap-sqrN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
metadata-eval10.8
Applied egg-rr10.8%
Taylor expanded in re around 0
Simplified29.6%
(FPCore (re im)
:precision binary64
(if (<= (* (exp re) (sin im)) 0.0)
(fma
(fma
im
(* im (fma (* im im) -0.0001984126984126984 0.008333333333333333))
-0.16666666666666666)
(* im (* im im))
im)
(*
im
(fma
re
(fma re (/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25) 1.0)
1.0))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = fma(fma(im, (im * fma((im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), (im * (im * im)), im);
} else {
tmp = im * fma(re, fma(re, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = fma(fma(im, Float64(im * fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), Float64(im * Float64(im * im)), im); else tmp = Float64(im * fma(re, fma(re, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(re * N[(re * N[(N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629 + 0.125), $MachinePrecision] / 0.25), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im \cdot \left(im \cdot im\right), im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{\mathsf{fma}\left(re \cdot \left(re \cdot re\right), 0.004629629629629629, 0.125\right)}{0.25}, 1\right), 1\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-sin.f6442.1
Simplified42.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
lower-fma.f64N/A
Simplified28.8%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6455.0
Simplified55.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6448.0
Simplified48.0%
flip3-+N/A
lower-/.f64N/A
unpow-prod-downN/A
lower-fma.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-+r-N/A
lower--.f64N/A
swap-sqrN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
metadata-eval35.5
Applied egg-rr35.5%
Taylor expanded in re around 0
Simplified49.0%
(FPCore (re im)
:precision binary64
(if (<= (* (exp re) (sin im)) 0.0)
(fma
(fma
im
(* im (fma (* im im) -0.0001984126984126984 0.008333333333333333))
-0.16666666666666666)
(* im (* im im))
im)
(* im (fma (fma re 0.16666666666666666 0.5) (* re re) (+ re 1.0)))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = fma(fma(im, (im * fma((im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), (im * (im * im)), im);
} else {
tmp = im * fma(fma(re, 0.16666666666666666, 0.5), (re * re), (re + 1.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = fma(fma(im, Float64(im * fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), Float64(im * Float64(im * im)), im); else tmp = Float64(im * fma(fma(re, 0.16666666666666666, 0.5), Float64(re * re), Float64(re + 1.0))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] * N[(re * re), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im \cdot \left(im \cdot im\right), im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re \cdot re, re + 1\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-sin.f6442.1
Simplified42.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
lower-fma.f64N/A
Simplified28.8%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6455.0
Simplified55.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6448.0
Simplified48.0%
lift-fma.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
associate-+l+N/A
lift-+.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6448.0
Applied egg-rr48.0%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 0.0) (fma (* im (* im (* im (* im -0.0001984126984126984)))) (* im (* im im)) im) (* im (fma (fma re 0.16666666666666666 0.5) (* re re) (+ re 1.0)))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = fma((im * (im * (im * (im * -0.0001984126984126984)))), (im * (im * im)), im);
} else {
tmp = im * fma(fma(re, 0.16666666666666666, 0.5), (re * re), (re + 1.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = fma(Float64(im * Float64(im * Float64(im * Float64(im * -0.0001984126984126984)))), Float64(im * Float64(im * im)), im); else tmp = Float64(im * fma(fma(re, 0.16666666666666666, 0.5), Float64(re * re), Float64(re + 1.0))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(im * N[(im * N[(im * N[(im * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] * N[(re * re), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im \cdot \left(im \cdot \left(im \cdot \left(im \cdot -0.0001984126984126984\right)\right)\right), im \cdot \left(im \cdot im\right), im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re \cdot re, re + 1\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-sin.f6442.1
Simplified42.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
lower-fma.f64N/A
Simplified28.8%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6428.8
Simplified28.8%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6455.0
Simplified55.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6448.0
Simplified48.0%
lift-fma.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
associate-+l+N/A
lift-+.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6448.0
Applied egg-rr48.0%
(FPCore (re im)
:precision binary64
(if (<= (* (exp re) (sin im)) 0.0)
(fma
im
(fma (* im im) (fma re -0.16666666666666666 -0.16666666666666666) re)
im)
(* im (fma (fma re 0.16666666666666666 0.5) (* re re) (+ re 1.0)))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = fma(im, fma((im * im), fma(re, -0.16666666666666666, -0.16666666666666666), re), im);
} else {
tmp = im * fma(fma(re, 0.16666666666666666, 0.5), (re * re), (re + 1.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = fma(im, fma(Float64(im * im), fma(re, -0.16666666666666666, -0.16666666666666666), re), im); else tmp = Float64(im * fma(fma(re, 0.16666666666666666, 0.5), Float64(re * re), Float64(re + 1.0))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(im * N[(N[(im * im), $MachinePrecision] * N[(re * -0.16666666666666666 + -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] * N[(re * re), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im, \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(re, -0.16666666666666666, -0.16666666666666666\right), re\right), im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re \cdot re, re + 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6441.9
Simplified41.9%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-rgt-identityN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
lower-fma.f6428.6
Simplified28.6%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6455.0
Simplified55.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6448.0
Simplified48.0%
lift-fma.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
associate-+l+N/A
lift-+.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6448.0
Applied egg-rr48.0%
(FPCore (re im)
:precision binary64
(if (<= (* (exp re) (sin im)) 0.0)
(fma
im
(fma (* im im) (fma re -0.16666666666666666 -0.16666666666666666) re)
im)
(* im (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = fma(im, fma((im * im), fma(re, -0.16666666666666666, -0.16666666666666666), re), im);
} else {
tmp = im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = fma(im, fma(Float64(im * im), fma(re, -0.16666666666666666, -0.16666666666666666), re), im); else tmp = Float64(im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(im * N[(N[(im * im), $MachinePrecision] * N[(re * -0.16666666666666666 + -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im, \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(re, -0.16666666666666666, -0.16666666666666666\right), re\right), im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6441.9
Simplified41.9%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-rgt-identityN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
lower-fma.f6428.6
Simplified28.6%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6455.0
Simplified55.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6448.0
Simplified48.0%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 0.0) (fma im (* (* im im) -0.16666666666666666) im) (* im (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = fma(im, ((im * im) * -0.16666666666666666), im);
} else {
tmp = im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = fma(im, Float64(Float64(im * im) * -0.16666666666666666), im); else tmp = Float64(im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\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-sin.f6442.1
Simplified42.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.1
Simplified27.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6427.1
Simplified27.1%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6455.0
Simplified55.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6448.0
Simplified48.0%
Final simplification35.0%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 5e-5) (fma im (* (* im im) -0.16666666666666666) im) (* im (* re (* re (fma re 0.16666666666666666 0.5))))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 5e-5) {
tmp = fma(im, ((im * im) * -0.16666666666666666), im);
} else {
tmp = im * (re * (re * fma(re, 0.16666666666666666, 0.5)));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 5e-5) tmp = fma(im, Float64(Float64(im * im) * -0.16666666666666666), im); else tmp = Float64(im * Float64(re * Float64(re * fma(re, 0.16666666666666666, 0.5)))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 5e-5], N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(re \cdot \left(re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.00000000000000024e-5Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6450.1
Simplified50.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6437.2
Simplified37.2%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.3
Simplified37.3%
if 5.00000000000000024e-5 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6437.9
Simplified37.9%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6428.2
Simplified28.2%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6428.1
Simplified28.1%
Final simplification34.8%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 5e-5) (fma im (* (* im im) -0.16666666666666666) im) (* 0.16666666666666666 (* im (* re (* re re))))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 5e-5) {
tmp = fma(im, ((im * im) * -0.16666666666666666), im);
} else {
tmp = 0.16666666666666666 * (im * (re * (re * re)));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 5e-5) tmp = fma(im, Float64(Float64(im * im) * -0.16666666666666666), im); else tmp = Float64(0.16666666666666666 * Float64(im * Float64(re * Float64(re * re)))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 5e-5], N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision], N[(0.16666666666666666 * N[(im * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(im \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.00000000000000024e-5Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6450.1
Simplified50.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6437.2
Simplified37.2%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.3
Simplified37.3%
if 5.00000000000000024e-5 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6437.9
Simplified37.9%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6428.2
Simplified28.2%
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f6428.2
Applied egg-rr28.2%
Taylor expanded in re around inf
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6428.3
Simplified28.3%
Final simplification34.9%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 0.0) (fma im (* (* im im) -0.16666666666666666) im) (fma im (fma 0.5 (* re re) re) im)))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = fma(im, ((im * im) * -0.16666666666666666), im);
} else {
tmp = fma(im, fma(0.5, (re * re), re), im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = fma(im, Float64(Float64(im * im) * -0.16666666666666666), im); else tmp = fma(im, fma(0.5, Float64(re * re), re), im); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(0.5 * N[(re * re), $MachinePrecision] + re), $MachinePrecision] + im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im, \mathsf{fma}\left(0.5, re \cdot re, re\right), 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-sin.f6442.1
Simplified42.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.1
Simplified27.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6427.1
Simplified27.1%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6455.0
Simplified55.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
associate-*r*N/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6443.2
Simplified43.2%
Final simplification33.1%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 5e-5) (fma im (* (* im im) -0.16666666666666666) im) (fma im (* re (* re 0.5)) im)))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 5e-5) {
tmp = fma(im, ((im * im) * -0.16666666666666666), im);
} else {
tmp = fma(im, (re * (re * 0.5)), im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 5e-5) tmp = fma(im, Float64(Float64(im * im) * -0.16666666666666666), im); else tmp = fma(im, Float64(re * Float64(re * 0.5)), im); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 5e-5], N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im, re \cdot \left(re \cdot 0.5\right), im\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.00000000000000024e-5Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6450.1
Simplified50.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6437.2
Simplified37.2%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.3
Simplified37.3%
if 5.00000000000000024e-5 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6437.9
Simplified37.9%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
associate-*r*N/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6421.4
Simplified21.4%
Taylor expanded in re around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6421.4
Simplified21.4%
Final simplification33.0%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 5e-5) (fma im (* (* im im) -0.16666666666666666) im) (* im (fma 0.5 (* re re) re))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 5e-5) {
tmp = fma(im, ((im * im) * -0.16666666666666666), im);
} else {
tmp = im * fma(0.5, (re * re), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 5e-5) tmp = fma(im, Float64(Float64(im * im) * -0.16666666666666666), im); else tmp = Float64(im * fma(0.5, Float64(re * re), re)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 5e-5], N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(0.5 * N[(re * re), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(0.5, re \cdot re, re\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.00000000000000024e-5Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6450.1
Simplified50.1%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6437.2
Simplified37.2%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.3
Simplified37.3%
if 5.00000000000000024e-5 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6437.9
Simplified37.9%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6428.2
Simplified28.2%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified28.8%
Taylor expanded in re around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6422.0
Simplified22.0%
Final simplification33.2%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 1.0) (fma im re im) (* re (* 0.5 (* re im)))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 1.0) {
tmp = fma(im, re, im);
} else {
tmp = re * (0.5 * (re * im));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 1.0) tmp = fma(im, re, im); else tmp = Float64(re * Float64(0.5 * Float64(re * im))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 1.0], N[(im * re + im), $MachinePrecision], N[(re * N[(0.5 * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 1:\\
\;\;\;\;\mathsf{fma}\left(im, re, im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.5 \cdot \left(re \cdot im\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 1Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6468.6
Simplified68.6%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f6431.1
Simplified31.1%
if 1 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6475.8
Simplified75.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
associate-*r*N/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6441.1
Simplified41.1%
Taylor expanded in re around inf
unpow2N/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6427.1
Simplified27.1%
Final simplification30.6%
(FPCore (re im) :precision binary64 (if (<= (exp re) 2.0) (fma im re im) (* im (fma 0.5 (* re re) re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 2.0) {
tmp = fma(im, re, im);
} else {
tmp = im * fma(0.5, (re * re), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (exp(re) <= 2.0) tmp = fma(im, re, im); else tmp = Float64(im * fma(0.5, Float64(re * re), re)); end return tmp end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 2.0], N[(im * re + im), $MachinePrecision], N[(im * N[(0.5 * N[(re * re), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 2:\\
\;\;\;\;\mathsf{fma}\left(im, re, im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(0.5, re \cdot re, re\right)\\
\end{array}
\end{array}
if (exp.f64 re) < 2Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6467.7
Simplified67.7%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f6434.7
Simplified34.7%
if 2 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6475.0
Simplified75.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.7
Simplified52.7%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified52.7%
Taylor expanded in re around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6437.8
Simplified37.8%
(FPCore (re im) :precision binary64 (fma im re im))
double code(double re, double im) {
return fma(im, re, im);
}
function code(re, im) return fma(im, re, im) end
code[re_, im_] := N[(im * re + im), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(im, re, im\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6469.5
Simplified69.5%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f6427.9
Simplified27.9%
(FPCore (re im) :precision binary64 im)
double code(double re, double im) {
return im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im
end function
public static double code(double re, double im) {
return im;
}
def code(re, im): return im
function code(re, im) return im end
function tmp = code(re, im) tmp = im; end
code[re_, im_] := im
\begin{array}{l}
\\
im
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6469.5
Simplified69.5%
Taylor expanded in re around 0
Simplified26.6%
*-rgt-identity26.6
Applied egg-rr26.6%
herbie shell --seed 2024207
(FPCore (re im)
:name "math.exp on complex, imaginary part"
:precision binary64
(* (exp re) (sin im)))