
(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 (/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25) 1.0)
1.0)
(fma
(* im im)
(*
im
(fma
(* im im)
(fma (* im im) -0.0001984126984126984 0.008333333333333333)
-0.16666666666666666))
im))
(if (<= t_0 -5e-22)
(* (sin im) (fma re (fma re 0.5 1.0) 1.0))
(if (<= t_0 5e-100)
t_1
(if (<= t_0 4e+19)
(*
(sin im)
(fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))
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, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma((im * im), (im * fma((im * im), fma((im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im);
} else if (t_0 <= -5e-22) {
tmp = sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0);
} else if (t_0 <= 5e-100) {
tmp = t_1;
} else if (t_0 <= 4e+19) {
tmp = sin(im) * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
} 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, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma(Float64(im * im), Float64(im * fma(Float64(im * im), fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im)); elseif (t_0 <= -5e-22) tmp = Float64(sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0)); elseif (t_0 <= 5e-100) tmp = t_1; elseif (t_0 <= 4e+19) tmp = Float64(sin(im) * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0)); 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 * N[(N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629 + 0.125), $MachinePrecision] / 0.25), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -5e-22], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-100], t$95$1, If[LessEqual[t$95$0, 4e+19], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $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, \frac{\mathsf{fma}\left(re \cdot \left(re \cdot re\right), 0.004629629629629629, 0.125\right)}{0.25}, 1\right), 1\right) \cdot \mathsf{fma}\left(im \cdot im, im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im\right)\\
\mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-22}:\\
\;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+19}:\\
\;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\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
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.6
Applied rewrites73.6%
Taylor expanded in im around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites62.5%
Applied rewrites21.1%
Taylor expanded in re around 0
Applied rewrites65.8%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -4.99999999999999954e-22Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6497.6
Applied rewrites97.6%
if -4.99999999999999954e-22 < (*.f64 (exp.f64 re) (sin.f64 im)) < 5.0000000000000001e-100 or 4e19 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6497.2
Applied rewrites97.2%
if 5.0000000000000001e-100 < (*.f64 (exp.f64 re) (sin.f64 im)) < 4e19Initial program 100.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.f6496.4
Applied rewrites96.4%
Final simplification93.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin im) (fma re (fma re 0.5 1.0) 1.0)))
(t_1 (* (exp re) (sin im)))
(t_2 (* (exp re) im)))
(if (<= t_1 (- INFINITY))
(*
(fma
re
(fma re (/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25) 1.0)
1.0)
(fma
(* im im)
(*
im
(fma
(* im im)
(fma (* im im) -0.0001984126984126984 0.008333333333333333)
-0.16666666666666666))
im))
(if (<= t_1 -5e-22)
t_0
(if (<= t_1 5e-100) t_2 (if (<= t_1 4e+19) t_0 t_2))))))
double code(double re, double im) {
double t_0 = sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0);
double t_1 = exp(re) * sin(im);
double t_2 = exp(re) * im;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(re, fma(re, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma((im * im), (im * fma((im * im), fma((im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im);
} else if (t_1 <= -5e-22) {
tmp = t_0;
} else if (t_1 <= 5e-100) {
tmp = t_2;
} else if (t_1 <= 4e+19) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0)) t_1 = Float64(exp(re) * sin(im)) t_2 = Float64(exp(re) * im) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(fma(re, fma(re, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma(Float64(im * im), Float64(im * fma(Float64(im * im), fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im)); elseif (t_1 <= -5e-22) tmp = t_0; elseif (t_1 <= 5e-100) tmp = t_2; elseif (t_1 <= 4e+19) tmp = t_0; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(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] * N[(N[(im * im), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-22], t$95$0, If[LessEqual[t$95$1, 5e-100], t$95$2, If[LessEqual[t$95$1, 4e+19], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
t_1 := e^{re} \cdot \sin im\\
t_2 := e^{re} \cdot im\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\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) \cdot \mathsf{fma}\left(im \cdot im, im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im\right)\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-100}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+19}:\\
\;\;\;\;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
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.6
Applied rewrites73.6%
Taylor expanded in im around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites62.5%
Applied rewrites21.1%
Taylor expanded in re around 0
Applied rewrites65.8%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -4.99999999999999954e-22 or 5.0000000000000001e-100 < (*.f64 (exp.f64 re) (sin.f64 im)) < 4e19Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6496.9
Applied rewrites96.9%
if -4.99999999999999954e-22 < (*.f64 (exp.f64 re) (sin.f64 im)) < 5.0000000000000001e-100 or 4e19 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6497.2
Applied rewrites97.2%
Final simplification93.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin im) (+ re 1.0)))
(t_1 (* (exp re) (sin im)))
(t_2 (* (exp re) im)))
(if (<= t_1 (- INFINITY))
(*
(fma
re
(fma re (/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25) 1.0)
1.0)
(fma
(* im im)
(*
im
(fma
(* im im)
(fma (* im im) -0.0001984126984126984 0.008333333333333333)
-0.16666666666666666))
im))
(if (<= t_1 -5e-22)
t_0
(if (<= t_1 5e-100) t_2 (if (<= t_1 4e+19) t_0 t_2))))))
double code(double re, double im) {
double t_0 = sin(im) * (re + 1.0);
double t_1 = exp(re) * sin(im);
double t_2 = exp(re) * im;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(re, fma(re, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma((im * im), (im * fma((im * im), fma((im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im);
} else if (t_1 <= -5e-22) {
tmp = t_0;
} else if (t_1 <= 5e-100) {
tmp = t_2;
} else if (t_1 <= 4e+19) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(im) * Float64(re + 1.0)) t_1 = Float64(exp(re) * sin(im)) t_2 = Float64(exp(re) * im) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(fma(re, fma(re, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma(Float64(im * im), Float64(im * fma(Float64(im * im), fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im)); elseif (t_1 <= -5e-22) tmp = t_0; elseif (t_1 <= 5e-100) tmp = t_2; elseif (t_1 <= 4e+19) tmp = t_0; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(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] * N[(N[(im * im), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-22], t$95$0, If[LessEqual[t$95$1, 5e-100], t$95$2, If[LessEqual[t$95$1, 4e+19], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin im \cdot \left(re + 1\right)\\
t_1 := e^{re} \cdot \sin im\\
t_2 := e^{re} \cdot im\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\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) \cdot \mathsf{fma}\left(im \cdot im, im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im\right)\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-100}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+19}:\\
\;\;\;\;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
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.6
Applied rewrites73.6%
Taylor expanded in im around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites62.5%
Applied rewrites21.1%
Taylor expanded in re around 0
Applied rewrites65.8%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -4.99999999999999954e-22 or 5.0000000000000001e-100 < (*.f64 (exp.f64 re) (sin.f64 im)) < 4e19Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6496.8
Applied rewrites96.8%
if -4.99999999999999954e-22 < (*.f64 (exp.f64 re) (sin.f64 im)) < 5.0000000000000001e-100 or 4e19 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6497.2
Applied rewrites97.2%
Final simplification93.5%
(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 (/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25) 1.0)
1.0)
(fma
(* im im)
(*
im
(fma
(* im im)
(fma (* im im) -0.0001984126984126984 0.008333333333333333)
-0.16666666666666666))
im))
(if (<= t_0 -5e-22)
(sin im)
(if (<= t_0 5e-73) t_1 (if (<= t_0 4e+19) (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, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma((im * im), (im * fma((im * im), fma((im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im);
} else if (t_0 <= -5e-22) {
tmp = sin(im);
} else if (t_0 <= 5e-73) {
tmp = t_1;
} else if (t_0 <= 4e+19) {
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, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma(Float64(im * im), Float64(im * fma(Float64(im * im), fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im)); elseif (t_0 <= -5e-22) tmp = sin(im); elseif (t_0 <= 5e-73) tmp = t_1; elseif (t_0 <= 4e+19) 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 * N[(N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629 + 0.125), $MachinePrecision] / 0.25), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -5e-22], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$0, 5e-73], t$95$1, If[LessEqual[t$95$0, 4e+19], 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, \frac{\mathsf{fma}\left(re \cdot \left(re \cdot re\right), 0.004629629629629629, 0.125\right)}{0.25}, 1\right), 1\right) \cdot \mathsf{fma}\left(im \cdot im, im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im\right)\\
\mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-22}:\\
\;\;\;\;\sin im\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+19}:\\
\;\;\;\;\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
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.6
Applied rewrites73.6%
Taylor expanded in im around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites62.5%
Applied rewrites21.1%
Taylor expanded in re around 0
Applied rewrites65.8%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -4.99999999999999954e-22 or 4.9999999999999998e-73 < (*.f64 (exp.f64 re) (sin.f64 im)) < 4e19Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6496.4
Applied rewrites96.4%
if -4.99999999999999954e-22 < (*.f64 (exp.f64 re) (sin.f64 im)) < 4.9999999999999998e-73 or 4e19 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6497.2
Applied rewrites97.2%
Final simplification93.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))))
(if (<= t_0 (- INFINITY))
(*
(fma
re
(fma re (/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25) 1.0)
1.0)
(fma
(* im im)
(*
im
(fma
(* im im)
(fma (* im im) -0.0001984126984126984 0.008333333333333333)
-0.16666666666666666))
im))
(if (<= t_0 -5e-22)
(sin im)
(if (<= t_0 0.0)
(/ (- (* im im) (* re (* re (* im im)))) (- im (* re im)))
(if (<= t_0 4e+19)
(sin im)
(*
im
(fma re (fma re (fma re 0.16666666666666666 0.5) 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, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma((im * im), (im * fma((im * im), fma((im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im);
} else if (t_0 <= -5e-22) {
tmp = sin(im);
} else if (t_0 <= 0.0) {
tmp = ((im * im) - (re * (re * (im * im)))) / (im - (re * im));
} else if (t_0 <= 4e+19) {
tmp = sin(im);
} else {
tmp = im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 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, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma(Float64(im * im), Float64(im * fma(Float64(im * im), fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im)); elseif (t_0 <= -5e-22) tmp = sin(im); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(im * im) - Float64(re * Float64(re * Float64(im * im)))) / Float64(im - Float64(re * im))); elseif (t_0 <= 4e+19) tmp = sin(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_] := 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 * N[(N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629 + 0.125), $MachinePrecision] / 0.25), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -5e-22], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(im * im), $MachinePrecision] - N[(re * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im - N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+19], N[Sin[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}
t_0 := e^{re} \cdot \sin im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\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) \cdot \mathsf{fma}\left(im \cdot im, im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im\right)\\
\mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-22}:\\
\;\;\;\;\sin im\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{im \cdot im - re \cdot \left(re \cdot \left(im \cdot im\right)\right)}{im - re \cdot im}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+19}:\\
\;\;\;\;\sin im\\
\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)) < -inf.0Initial program 100.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.f6473.6
Applied rewrites73.6%
Taylor expanded in im around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites62.5%
Applied rewrites21.1%
Taylor expanded in re around 0
Applied rewrites65.8%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -4.99999999999999954e-22 or 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < 4e19Initial program 100.0%
Taylor expanded in re around 0
lower-sin.f6496.3
Applied rewrites96.3%
if -4.99999999999999954e-22 < (*.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
Applied rewrites100.0%
Taylor expanded in re around 0
Applied rewrites40.7%
Taylor expanded in re around 0
Applied rewrites40.1%
Applied rewrites41.8%
if 4e19 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6486.7
Applied rewrites86.7%
Taylor expanded in re around 0
Applied rewrites73.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))))
(if (<= t_0 -5e-22)
(*
(fma
re
(fma re (/ (fma (* re (* re re)) 0.004629629629629629 0.125) 0.25) 1.0)
1.0)
(fma
(* im im)
(*
im
(fma
(* im im)
(fma (* im im) -0.0001984126984126984 0.008333333333333333)
-0.16666666666666666))
im))
(if (<= t_0 0.0)
(/ (- (* im im) (* re (* re (* im im)))) (- im (* re im)))
(* im (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double tmp;
if (t_0 <= -5e-22) {
tmp = fma(re, fma(re, (fma((re * (re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma((im * im), (im * fma((im * im), fma((im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im);
} else if (t_0 <= 0.0) {
tmp = ((im * im) - (re * (re * (im * im)))) / (im - (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) t_0 = Float64(exp(re) * sin(im)) tmp = 0.0 if (t_0 <= -5e-22) tmp = Float64(fma(re, fma(re, Float64(fma(Float64(re * Float64(re * re)), 0.004629629629629629, 0.125) / 0.25), 1.0), 1.0) * fma(Float64(im * im), Float64(im * fma(Float64(im * im), fma(Float64(im * im), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666)), im)); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(im * im) - Float64(re * Float64(re * Float64(im * im)))) / Float64(im - Float64(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_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-22], N[(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] * N[(N[(im * im), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(im * im), $MachinePrecision] - N[(re * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im - N[(re * im), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := e^{re} \cdot \sin im\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-22}:\\
\;\;\;\;\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) \cdot \mathsf{fma}\left(im \cdot im, im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), im\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{im \cdot im - re \cdot \left(re \cdot \left(im \cdot im\right)\right)}{im - re \cdot im}\\
\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)) < -4.99999999999999954e-22Initial program 100.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.f6487.0
Applied rewrites87.0%
Taylor expanded in im around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites32.9%
Applied rewrites14.7%
Taylor expanded in re around 0
Applied rewrites34.3%
if -4.99999999999999954e-22 < (*.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
Applied rewrites100.0%
Taylor expanded in re around 0
Applied rewrites40.7%
Taylor expanded in re around 0
Applied rewrites40.1%
Applied rewrites41.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.8
Applied rewrites55.8%
Taylor expanded in re around 0
Applied rewrites51.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im)))
(t_1 (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0)))
(if (<= t_0 -5e-22)
(* t_1 (fma im (* (* im im) -0.16666666666666666) im))
(if (<= t_0 0.0)
(/ (- (* im im) (* re (* re (* im im)))) (- im (* re im)))
(* im t_1)))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double t_1 = fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
double tmp;
if (t_0 <= -5e-22) {
tmp = t_1 * fma(im, ((im * im) * -0.16666666666666666), im);
} else if (t_0 <= 0.0) {
tmp = ((im * im) - (re * (re * (im * im)))) / (im - (re * im));
} else {
tmp = im * t_1;
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) t_1 = fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0) tmp = 0.0 if (t_0 <= -5e-22) tmp = Float64(t_1 * fma(im, Float64(Float64(im * im) * -0.16666666666666666), im)); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(im * im) - Float64(re * Float64(re * Float64(im * im)))) / Float64(im - Float64(re * im))); else tmp = Float64(im * 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[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-22], N[(t$95$1 * N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(im * im), $MachinePrecision] - N[(re * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im - N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
t_1 := \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-22}:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{im \cdot im - re \cdot \left(re \cdot \left(im \cdot im\right)\right)}{im - re \cdot im}\\
\mathbf{else}:\\
\;\;\;\;im \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -4.99999999999999954e-22Initial program 100.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.f6487.0
Applied rewrites87.0%
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-*.f6433.0
Applied rewrites33.0%
if -4.99999999999999954e-22 < (*.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
Applied rewrites100.0%
Taylor expanded in re around 0
Applied rewrites40.7%
Taylor expanded in re around 0
Applied rewrites40.1%
Applied rewrites41.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.8
Applied rewrites55.8%
Taylor expanded in re around 0
Applied rewrites51.6%
Final simplification43.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im)))
(t_1 (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))
(t_2 (- (* re im) im)))
(if (<= t_0 -0.05)
(* t_1 (fma im (* (* im im) -0.16666666666666666) im))
(if (<= t_0 0.0) (/ (* (fma re im im) t_2) t_2) (* im t_1)))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double t_1 = fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
double t_2 = (re * im) - im;
double tmp;
if (t_0 <= -0.05) {
tmp = t_1 * fma(im, ((im * im) * -0.16666666666666666), im);
} else if (t_0 <= 0.0) {
tmp = (fma(re, im, im) * t_2) / t_2;
} else {
tmp = im * t_1;
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) t_1 = fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0) t_2 = Float64(Float64(re * im) - im) tmp = 0.0 if (t_0 <= -0.05) tmp = Float64(t_1 * fma(im, Float64(Float64(im * im) * -0.16666666666666666), im)); elseif (t_0 <= 0.0) tmp = Float64(Float64(fma(re, im, im) * t_2) / t_2); else tmp = Float64(im * 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[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(re * im), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[t$95$0, -0.05], N[(t$95$1 * N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(re * im + im), $MachinePrecision] * t$95$2), $MachinePrecision] / t$95$2), $MachinePrecision], N[(im * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
t_1 := \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
t_2 := re \cdot im - im\\
\mathbf{if}\;t\_0 \leq -0.05:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(re, im, im\right) \cdot t\_2}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;im \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.050000000000000003Initial program 100.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.f6486.2
Applied rewrites86.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-*.f6430.2
Applied rewrites30.2%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6498.9
Applied rewrites98.9%
Taylor expanded in re around 0
Applied rewrites42.1%
Taylor expanded in re around 0
Applied rewrites41.5%
Applied rewrites34.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.8
Applied rewrites55.8%
Taylor expanded in re around 0
Applied rewrites51.6%
Final simplification39.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))) (t_1 (- (* re im) im)))
(if (<= t_0 -0.05)
(*
(fma re (fma re 0.5 1.0) 1.0)
(fma im (* (* im im) -0.16666666666666666) im))
(if (<= t_0 0.0)
(/ (* (fma re im im) t_1) t_1)
(* im (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double t_1 = (re * im) - im;
double tmp;
if (t_0 <= -0.05) {
tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, ((im * im) * -0.16666666666666666), im);
} else if (t_0 <= 0.0) {
tmp = (fma(re, im, im) * t_1) / t_1;
} else {
tmp = im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) t_1 = Float64(Float64(re * im) - im) tmp = 0.0 if (t_0 <= -0.05) tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, Float64(Float64(im * im) * -0.16666666666666666), im)); elseif (t_0 <= 0.0) tmp = Float64(Float64(fma(re, im, im) * t_1) / t_1); 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_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(re * im), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[t$95$0, -0.05], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(re * im + im), $MachinePrecision] * t$95$1), $MachinePrecision] / t$95$1), $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}
t_0 := e^{re} \cdot \sin im\\
t_1 := re \cdot im - im\\
\mathbf{if}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(re, im, im\right) \cdot t\_1}{t\_1}\\
\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.050000000000000003Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6480.0
Applied rewrites80.0%
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-*.f6425.6
Applied rewrites25.6%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6498.9
Applied rewrites98.9%
Taylor expanded in re around 0
Applied rewrites42.1%
Taylor expanded in re around 0
Applied rewrites41.5%
Applied rewrites34.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.8
Applied rewrites55.8%
Taylor expanded in re around 0
Applied rewrites51.6%
Final simplification38.8%
(FPCore (re im)
:precision binary64
(if (<= (* (exp re) (sin im)) 5e-5)
(*
(fma re (fma re 0.5 1.0) 1.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)) <= 5e-5) {
tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * 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)) <= 5e-5) tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * 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], 5e-5], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision]), $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 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \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)) < 5.00000000000000024e-5Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6463.1
Applied rewrites63.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-*.f6444.5
Applied rewrites44.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.f6439.3
Applied rewrites39.3%
Taylor expanded in re around 0
Applied rewrites33.7%
Final simplification41.6%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 0.0) (* (+ re 1.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 = (re + 1.0) * 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 = Float64(Float64(re + 1.0) * 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[(N[(re + 1.0), $MachinePrecision] * N[(im * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + im), $MachinePrecision]), $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:\\
\;\;\;\;\left(re + 1\right) \cdot \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
+-commutativeN/A
lower-+.f6447.1
Applied rewrites47.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-*.f6429.2
Applied rewrites29.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.8
Applied rewrites55.8%
Taylor expanded in re around 0
Applied rewrites51.6%
Final simplification37.8%
(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.f6447.2
Applied rewrites47.2%
Taylor expanded in im around 0
Applied rewrites28.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.8
Applied rewrites55.8%
Taylor expanded in re around 0
Applied rewrites51.6%
Final simplification37.5%
(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.f6454.4
Applied rewrites54.4%
Taylor expanded in im around 0
Applied rewrites38.8%
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.f6439.3
Applied rewrites39.3%
Taylor expanded in re around 0
Applied rewrites31.1%
Taylor expanded in re around inf
Applied rewrites31.1%
Taylor expanded in re around inf
Applied rewrites34.0%
Final simplification37.5%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 0.0) (fma im (* (* im im) -0.16666666666666666) im) (* im (fma re (fma re 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, 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, 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 * 0.5 + 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, 0.5, 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.f6447.2
Applied rewrites47.2%
Taylor expanded in im around 0
Applied rewrites28.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.8
Applied rewrites55.8%
Taylor expanded in re around 0
Applied rewrites46.6%
Final simplification35.6%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 0.0) (fma im (* (* im im) -0.16666666666666666) im) (fma re (fma (* re im) 0.5 im) 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(re, fma((re * im), 0.5, im), 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(re, fma(Float64(re * im), 0.5, im), 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[(re * N[(N[(re * im), $MachinePrecision] * 0.5 + im), $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(re, \mathsf{fma}\left(re \cdot im, 0.5, im\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.f6447.2
Applied rewrites47.2%
Taylor expanded in im around 0
Applied rewrites28.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.8
Applied rewrites55.8%
Taylor expanded in re around 0
Applied rewrites49.8%
Taylor expanded in re around 0
Applied rewrites40.9%
Final simplification33.4%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 5e-5) (fma im (* (* im im) -0.16666666666666666) im) (* re (fma re (* im 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 = re * fma(re, (im * 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 = Float64(re * fma(re, Float64(im * 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[(re * N[(re * N[(im * 0.5), $MachinePrecision] + im), $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}:\\
\;\;\;\;re \cdot \mathsf{fma}\left(re, im \cdot 0.5, 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.f6454.4
Applied rewrites54.4%
Taylor expanded in im around 0
Applied rewrites38.8%
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.f6439.3
Applied rewrites39.3%
Taylor expanded in re around 0
Applied rewrites31.1%
Taylor expanded in re around -inf
Applied rewrites32.7%
Taylor expanded in re around 0
Applied rewrites19.0%
Final simplification33.5%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 5e-5) (fma im (* (* im im) -0.16666666666666666) im) (* im (+ re 1.0))))
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 + 1.0);
}
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 + 1.0)); 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 + 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(im, \left(im \cdot im\right) \cdot -0.16666666666666666, im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(re + 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
lower-sin.f6454.4
Applied rewrites54.4%
Taylor expanded in im around 0
Applied rewrites38.8%
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.f6439.3
Applied rewrites39.3%
Taylor expanded in re around 0
Applied rewrites11.4%
Final simplification31.5%
(FPCore (re im) :precision binary64 (if (<= im 2e+93) (* im 1.0) (* re im)))
double code(double re, double im) {
double tmp;
if (im <= 2e+93) {
tmp = im * 1.0;
} else {
tmp = re * im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2d+93) then
tmp = im * 1.0d0
else
tmp = re * im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2e+93) {
tmp = im * 1.0;
} else {
tmp = re * im;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2e+93: tmp = im * 1.0 else: tmp = re * im return tmp
function code(re, im) tmp = 0.0 if (im <= 2e+93) tmp = Float64(im * 1.0); else tmp = Float64(re * im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2e+93) tmp = im * 1.0; else tmp = re * im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2e+93], N[(im * 1.0), $MachinePrecision], N[(re * im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2 \cdot 10^{+93}:\\
\;\;\;\;im \cdot 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot im\\
\end{array}
\end{array}
if im < 2.00000000000000009e93Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6472.9
Applied rewrites72.9%
Taylor expanded in re around 0
Applied rewrites32.8%
if 2.00000000000000009e93 < im Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6440.9
Applied rewrites40.9%
Taylor expanded in re around 0
Applied rewrites20.3%
Taylor expanded in re around -inf
Applied rewrites19.3%
Taylor expanded in re around 0
Applied rewrites16.4%
(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.f6467.5
Applied rewrites67.5%
Taylor expanded in re around 0
Applied rewrites32.2%
(FPCore (re im) :precision binary64 (* re im))
double code(double re, double im) {
return re * im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re * im
end function
public static double code(double re, double im) {
return re * im;
}
def code(re, im): return re * im
function code(re, im) return Float64(re * im) end
function tmp = code(re, im) tmp = re * im; end
code[re_, im_] := N[(re * im), $MachinePrecision]
\begin{array}{l}
\\
re \cdot im
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
lower-*.f64N/A
lower-exp.f6467.5
Applied rewrites67.5%
Taylor expanded in re around 0
Applied rewrites40.6%
Taylor expanded in re around -inf
Applied rewrites17.8%
Taylor expanded in re around 0
Applied rewrites8.4%
herbie shell --seed 2024221
(FPCore (re im)
:name "math.exp on complex, imaginary part"
:precision binary64
(* (exp re) (sin im)))