
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
(FPCore (re im) :precision binary64 (* (cosh im) (sin re)))
double code(double re, double im) {
return cosh(im) * sin(re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cosh(im) * sin(re)
end function
public static double code(double re, double im) {
return Math.cosh(im) * Math.sin(re);
}
def code(re, im): return math.cosh(im) * math.sin(re)
function code(re, im) return Float64(cosh(im) * sin(re)) end
function tmp = code(re, im) tmp = cosh(im) * sin(re); end
code[re_, im_] := N[(N[Cosh[im], $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cosh im \cdot \sin re
\end{array}
Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
*-lowering-*.f64N/A
exp-0N/A
cosh-lowering-cosh.f64N/A
sin-lowering-sin.f64100.0
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* (sin re) 0.5) (+ (exp (- im)) (exp im)))))
(if (<= t_0 (- INFINITY))
(* (* re (* re re)) (* (* (* im im) (* im im)) -0.006944444444444444))
(if (<= t_0 1.0)
(*
(sin re)
(fma (* im im) (fma im (* im 0.041666666666666664) 0.5) 1.0))
(* (cosh im) re)))))
double code(double re, double im) {
double t_0 = (sin(re) * 0.5) * (exp(-im) + exp(im));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (re * (re * re)) * (((im * im) * (im * im)) * -0.006944444444444444);
} else if (t_0 <= 1.0) {
tmp = sin(re) * fma((im * im), fma(im, (im * 0.041666666666666664), 0.5), 1.0);
} else {
tmp = cosh(im) * re;
}
return tmp;
}
function code(re, im) t_0 = Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(Float64(im * im) * Float64(im * im)) * -0.006944444444444444)); elseif (t_0 <= 1.0) tmp = Float64(sin(re) * fma(Float64(im * im), fma(im, Float64(im * 0.041666666666666664), 0.5), 1.0)); else tmp = Float64(cosh(im) * re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.006944444444444444), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[im], $MachinePrecision] * re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot -0.006944444444444444\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im \cdot re\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6478.2
Simplified78.2%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
Simplified66.2%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
Simplified25.5%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6425.5
Simplified25.5%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
Simplified100.0%
if 1 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
*-lowering-*.f64N/A
exp-0N/A
cosh-lowering-cosh.f64N/A
sin-lowering-sin.f64100.0
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified78.7%
*-lft-identityN/A
cosh-lowering-cosh.f6478.7
Applied egg-rr78.7%
Final simplification71.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin re) 0.5)) (t_1 (* t_0 (+ (exp (- im)) (exp im)))))
(if (<= t_1 (- INFINITY))
(* (* re (* re re)) (* (* (* im im) (* im im)) -0.006944444444444444))
(if (<= t_1 1.0) (* t_0 (fma im im 2.0)) (* (cosh im) re)))))
double code(double re, double im) {
double t_0 = sin(re) * 0.5;
double t_1 = t_0 * (exp(-im) + exp(im));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (re * (re * re)) * (((im * im) * (im * im)) * -0.006944444444444444);
} else if (t_1 <= 1.0) {
tmp = t_0 * fma(im, im, 2.0);
} else {
tmp = cosh(im) * re;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(re) * 0.5) t_1 = Float64(t_0 * Float64(exp(Float64(-im)) + exp(im))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(Float64(im * im) * Float64(im * im)) * -0.006944444444444444)); elseif (t_1 <= 1.0) tmp = Float64(t_0 * fma(im, im, 2.0)); else tmp = Float64(cosh(im) * re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.006944444444444444), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[(t$95$0 * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[im], $MachinePrecision] * re), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin re \cdot 0.5\\
t_1 := t\_0 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot -0.006944444444444444\right)\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(im, im, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im \cdot re\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6478.2
Simplified78.2%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
Simplified66.2%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
Simplified25.5%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6425.5
Simplified25.5%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6499.9
Simplified99.9%
if 1 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
*-lowering-*.f64N/A
exp-0N/A
cosh-lowering-cosh.f64N/A
sin-lowering-sin.f64100.0
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified78.7%
*-lft-identityN/A
cosh-lowering-cosh.f6478.7
Applied egg-rr78.7%
Final simplification71.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* (sin re) 0.5) (+ (exp (- im)) (exp im)))))
(if (<= t_0 (- INFINITY))
(* (* re (* re re)) (* (* (* im im) (* im im)) -0.006944444444444444))
(if (<= t_0 1.0) (sin re) (* (cosh im) re)))))
double code(double re, double im) {
double t_0 = (sin(re) * 0.5) * (exp(-im) + exp(im));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (re * (re * re)) * (((im * im) * (im * im)) * -0.006944444444444444);
} else if (t_0 <= 1.0) {
tmp = sin(re);
} else {
tmp = cosh(im) * re;
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = (Math.sin(re) * 0.5) * (Math.exp(-im) + Math.exp(im));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (re * (re * re)) * (((im * im) * (im * im)) * -0.006944444444444444);
} else if (t_0 <= 1.0) {
tmp = Math.sin(re);
} else {
tmp = Math.cosh(im) * re;
}
return tmp;
}
def code(re, im): t_0 = (math.sin(re) * 0.5) * (math.exp(-im) + math.exp(im)) tmp = 0 if t_0 <= -math.inf: tmp = (re * (re * re)) * (((im * im) * (im * im)) * -0.006944444444444444) elif t_0 <= 1.0: tmp = math.sin(re) else: tmp = math.cosh(im) * re return tmp
function code(re, im) t_0 = Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(Float64(im * im) * Float64(im * im)) * -0.006944444444444444)); elseif (t_0 <= 1.0) tmp = sin(re); else tmp = Float64(cosh(im) * re); end return tmp end
function tmp_2 = code(re, im) t_0 = (sin(re) * 0.5) * (exp(-im) + exp(im)); tmp = 0.0; if (t_0 <= -Inf) tmp = (re * (re * re)) * (((im * im) * (im * im)) * -0.006944444444444444); elseif (t_0 <= 1.0) tmp = sin(re); else tmp = cosh(im) * re; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.006944444444444444), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[re], $MachinePrecision], N[(N[Cosh[im], $MachinePrecision] * re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot -0.006944444444444444\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;\cosh im \cdot re\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6478.2
Simplified78.2%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
Simplified66.2%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
Simplified25.5%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6425.5
Simplified25.5%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6499.1
Simplified99.1%
if 1 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
*-lowering-*.f64N/A
exp-0N/A
cosh-lowering-cosh.f64N/A
sin-lowering-sin.f64100.0
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified78.7%
*-lft-identityN/A
cosh-lowering-cosh.f6478.7
Applied egg-rr78.7%
Final simplification71.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* (sin re) 0.5) (+ (exp (- im)) (exp im)))))
(if (<= t_0 (- INFINITY))
(* (* re (* re re)) (* (* (* im im) (* im im)) -0.006944444444444444))
(if (<= t_0 1.0)
(sin re)
(*
re
(fma
(* im im)
(fma
im
(* im (fma (* im im) 0.001388888888888889 0.041666666666666664))
0.5)
1.0))))))
double code(double re, double im) {
double t_0 = (sin(re) * 0.5) * (exp(-im) + exp(im));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (re * (re * re)) * (((im * im) * (im * im)) * -0.006944444444444444);
} else if (t_0 <= 1.0) {
tmp = sin(re);
} else {
tmp = re * fma((im * im), fma(im, (im * fma((im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(Float64(im * im) * Float64(im * im)) * -0.006944444444444444)); elseif (t_0 <= 1.0) tmp = sin(re); else tmp = Float64(re * fma(Float64(im * im), fma(im, Float64(im * fma(Float64(im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.006944444444444444), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[re], $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot -0.006944444444444444\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;re \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6478.2
Simplified78.2%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
Simplified66.2%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
Simplified25.5%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6425.5
Simplified25.5%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6499.1
Simplified99.1%
if 1 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
*-lowering-*.f64N/A
exp-0N/A
cosh-lowering-cosh.f64N/A
sin-lowering-sin.f64100.0
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified78.7%
Taylor expanded in im around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6474.0
Simplified74.0%
Final simplification70.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* (sin re) 0.5) (+ (exp (- im)) (exp im)))))
(if (<= t_0 (- INFINITY))
(* (fma im im 2.0) (* re (* (* re re) -0.08333333333333333)))
(if (<= t_0 0.001)
(fma re (* (* re re) -0.16666666666666666) re)
(* re (* (* im im) (fma im (* im 0.041666666666666664) 0.5)))))))
double code(double re, double im) {
double t_0 = (sin(re) * 0.5) * (exp(-im) + exp(im));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(im, im, 2.0) * (re * ((re * re) * -0.08333333333333333));
} else if (t_0 <= 0.001) {
tmp = fma(re, ((re * re) * -0.16666666666666666), re);
} else {
tmp = re * ((im * im) * fma(im, (im * 0.041666666666666664), 0.5));
}
return tmp;
}
function code(re, im) t_0 = Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(im, im, 2.0) * Float64(re * Float64(Float64(re * re) * -0.08333333333333333))); elseif (t_0 <= 0.001) tmp = fma(re, Float64(Float64(re * re) * -0.16666666666666666), re); else tmp = Float64(re * Float64(Float64(im * im) * fma(im, Float64(im * 0.041666666666666664), 0.5))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(im * im + 2.0), $MachinePrecision] * N[(re * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.001], N[(re * N[(N[(re * re), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(re \cdot \left(\left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(re, \left(re \cdot re\right) \cdot -0.16666666666666666, re\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(\left(im \cdot im\right) \cdot \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6446.5
Simplified46.5%
Taylor expanded in re around 0
distribute-rgt-inN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6446.5
Simplified46.5%
Taylor expanded in re around inf
associate-*r*N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6424.6
Simplified24.6%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6498.9
Simplified98.9%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6461.2
Simplified61.2%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
Simplified82.2%
Taylor expanded in re around 0
Simplified48.6%
Taylor expanded in im around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
associate-*l/N/A
associate-/l*N/A
metadata-evalN/A
pow-sqrN/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
Simplified48.8%
Final simplification46.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* (sin re) 0.5) (+ (exp (- im)) (exp im)))))
(if (<= t_0 (- INFINITY))
(* (* im im) (* re (fma -0.08333333333333333 (* re re) 0.5)))
(if (<= t_0 0.001)
(fma re (* (* re re) -0.16666666666666666) re)
(* re (* (* im im) (fma im (* im 0.041666666666666664) 0.5)))))))
double code(double re, double im) {
double t_0 = (sin(re) * 0.5) * (exp(-im) + exp(im));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (im * im) * (re * fma(-0.08333333333333333, (re * re), 0.5));
} else if (t_0 <= 0.001) {
tmp = fma(re, ((re * re) * -0.16666666666666666), re);
} else {
tmp = re * ((im * im) * fma(im, (im * 0.041666666666666664), 0.5));
}
return tmp;
}
function code(re, im) t_0 = Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(im * im) * Float64(re * fma(-0.08333333333333333, Float64(re * re), 0.5))); elseif (t_0 <= 0.001) tmp = fma(re, Float64(Float64(re * re) * -0.16666666666666666), re); else tmp = Float64(re * Float64(Float64(im * im) * fma(im, Float64(im * 0.041666666666666664), 0.5))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(im * im), $MachinePrecision] * N[(re * N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.001], N[(re * N[(N[(re * re), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot \mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(re, \left(re \cdot re\right) \cdot -0.16666666666666666, re\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(\left(im \cdot im\right) \cdot \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6446.5
Simplified46.5%
Taylor expanded in re around 0
distribute-rgt-inN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6446.5
Simplified46.5%
Taylor expanded in im around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6446.5
Simplified46.5%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6498.9
Simplified98.9%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6461.2
Simplified61.2%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
Simplified82.2%
Taylor expanded in re around 0
Simplified48.6%
Taylor expanded in im around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
associate-*l/N/A
associate-/l*N/A
metadata-evalN/A
pow-sqrN/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
Simplified48.8%
Final simplification52.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin re) 0.5)))
(if (<= (* t_0 (+ (exp (- im)) (exp im))) 1.0)
(*
t_0
(fma
im
(fma
(fma (* im im) 0.002777777777777778 0.08333333333333333)
(* im (* im im))
im)
2.0))
(* (cosh im) re))))
double code(double re, double im) {
double t_0 = sin(re) * 0.5;
double tmp;
if ((t_0 * (exp(-im) + exp(im))) <= 1.0) {
tmp = t_0 * fma(im, fma(fma((im * im), 0.002777777777777778, 0.08333333333333333), (im * (im * im)), im), 2.0);
} else {
tmp = cosh(im) * re;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(re) * 0.5) tmp = 0.0 if (Float64(t_0 * Float64(exp(Float64(-im)) + exp(im))) <= 1.0) tmp = Float64(t_0 * fma(im, fma(fma(Float64(im * im), 0.002777777777777778, 0.08333333333333333), Float64(im * Float64(im * im)), im), 2.0)); else tmp = Float64(cosh(im) * re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0], N[(t$95$0 * N[(im * N[(N[(N[(im * im), $MachinePrecision] * 0.002777777777777778 + 0.08333333333333333), $MachinePrecision] * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[im], $MachinePrecision] * re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin re \cdot 0.5\\
\mathbf{if}\;t\_0 \cdot \left(e^{-im} + e^{im}\right) \leq 1:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(im, \mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, 0.002777777777777778, 0.08333333333333333\right), im \cdot \left(im \cdot im\right), im\right), 2\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im \cdot re\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
Simplified95.5%
if 1 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
*-lowering-*.f64N/A
exp-0N/A
cosh-lowering-cosh.f64N/A
sin-lowering-sin.f64100.0
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified78.7%
*-lft-identityN/A
cosh-lowering-cosh.f6478.7
Applied egg-rr78.7%
Final simplification91.5%
(FPCore (re im)
:precision binary64
(if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.001)
(*
(fma (* im im) (fma (* im im) 0.08333333333333333 1.0) 2.0)
(* re (fma -0.08333333333333333 (* re re) 0.5)))
(*
re
(fma
(* im im)
(fma
im
(* im (fma (* im im) 0.001388888888888889 0.041666666666666664))
0.5)
1.0))))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.001) {
tmp = fma((im * im), fma((im * im), 0.08333333333333333, 1.0), 2.0) * (re * fma(-0.08333333333333333, (re * re), 0.5));
} else {
tmp = re * fma((im * im), fma(im, (im * fma((im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.001) tmp = Float64(fma(Float64(im * im), fma(Float64(im * im), 0.08333333333333333, 1.0), 2.0) * Float64(re * fma(-0.08333333333333333, Float64(re * re), 0.5))); else tmp = Float64(re * fma(Float64(im * im), fma(im, Float64(im * fma(Float64(im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.001], N[(N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.08333333333333333 + 1.0), $MachinePrecision] + 2.0), $MachinePrecision] * N[(re * N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, 0.08333333333333333, 1\right), 2\right) \cdot \left(re \cdot \mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6490.2
Simplified90.2%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
Simplified63.7%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
*-lowering-*.f64N/A
exp-0N/A
cosh-lowering-cosh.f64N/A
sin-lowering-sin.f64100.0
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified60.6%
Taylor expanded in im around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6457.0
Simplified57.0%
Final simplification61.6%
(FPCore (re im)
:precision binary64
(if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.001)
(* (fma -0.08333333333333333 (* re re) 0.5) (* re (fma im im 2.0)))
(*
re
(fma
(* im im)
(fma
im
(* im (fma (* im im) 0.001388888888888889 0.041666666666666664))
0.5)
1.0))))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.001) {
tmp = fma(-0.08333333333333333, (re * re), 0.5) * (re * fma(im, im, 2.0));
} else {
tmp = re * fma((im * im), fma(im, (im * fma((im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.001) tmp = Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * Float64(re * fma(im, im, 2.0))); else tmp = Float64(re * fma(Float64(im * im), fma(im, Float64(im * fma(Float64(im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.001], N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * N[(re * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot \left(re \cdot \mathsf{fma}\left(im, im, 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6476.0
Simplified76.0%
Taylor expanded in re around 0
distribute-rgt-inN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6454.9
Simplified54.9%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
*-lowering-*.f64N/A
exp-0N/A
cosh-lowering-cosh.f64N/A
sin-lowering-sin.f64100.0
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified60.6%
Taylor expanded in im around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6457.0
Simplified57.0%
Final simplification55.5%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.001) (* (fma -0.08333333333333333 (* re re) 0.5) (* re (fma im im 2.0))) (* re (* (* im im) (fma im (* im 0.041666666666666664) 0.5)))))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.001) {
tmp = fma(-0.08333333333333333, (re * re), 0.5) * (re * fma(im, im, 2.0));
} else {
tmp = re * ((im * im) * fma(im, (im * 0.041666666666666664), 0.5));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.001) tmp = Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * Float64(re * fma(im, im, 2.0))); else tmp = Float64(re * Float64(Float64(im * im) * fma(im, Float64(im * 0.041666666666666664), 0.5))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.001], N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * N[(re * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot \left(re \cdot \mathsf{fma}\left(im, im, 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(\left(im \cdot im\right) \cdot \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6476.0
Simplified76.0%
Taylor expanded in re around 0
distribute-rgt-inN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6454.9
Simplified54.9%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
Simplified82.2%
Taylor expanded in re around 0
Simplified48.6%
Taylor expanded in im around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
associate-*l/N/A
associate-/l*N/A
metadata-evalN/A
pow-sqrN/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
Simplified48.8%
Final simplification53.0%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.001) (fma re (* (* re re) -0.16666666666666666) re) (* re (* (* im im) (fma im (* im 0.041666666666666664) 0.5)))))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.001) {
tmp = fma(re, ((re * re) * -0.16666666666666666), re);
} else {
tmp = re * ((im * im) * fma(im, (im * 0.041666666666666664), 0.5));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.001) tmp = fma(re, Float64(Float64(re * re) * -0.16666666666666666), re); else tmp = Float64(re * Float64(Float64(im * im) * fma(im, Float64(im * 0.041666666666666664), 0.5))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.001], N[(re * N[(N[(re * re), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(re, \left(re \cdot re\right) \cdot -0.16666666666666666, re\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(\left(im \cdot im\right) \cdot \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6455.7
Simplified55.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6442.4
Simplified42.4%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
Simplified82.2%
Taylor expanded in re around 0
Simplified48.6%
Taylor expanded in im around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
associate-*l/N/A
associate-/l*N/A
metadata-evalN/A
pow-sqrN/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
Simplified48.8%
Final simplification44.4%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.001) (fma re (* (* re re) -0.16666666666666666) re) (* re (* (* im im) (* im (* im 0.041666666666666664))))))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.001) {
tmp = fma(re, ((re * re) * -0.16666666666666666), re);
} else {
tmp = re * ((im * im) * (im * (im * 0.041666666666666664)));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.001) tmp = fma(re, Float64(Float64(re * re) * -0.16666666666666666), re); else tmp = Float64(re * Float64(Float64(im * im) * Float64(im * Float64(im * 0.041666666666666664)))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.001], N[(re * N[(N[(re * re), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(re, \left(re \cdot re\right) \cdot -0.16666666666666666, re\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot \left(im \cdot 0.041666666666666664\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6455.7
Simplified55.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6442.4
Simplified42.4%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
Simplified82.2%
Taylor expanded in re around 0
Simplified48.6%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6448.8
Simplified48.8%
Final simplification44.4%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.001) (fma re (* (* re re) -0.16666666666666666) re) (* im (* im (* 0.041666666666666664 (* re (* im im)))))))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.001) {
tmp = fma(re, ((re * re) * -0.16666666666666666), re);
} else {
tmp = im * (im * (0.041666666666666664 * (re * (im * im))));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.001) tmp = fma(re, Float64(Float64(re * re) * -0.16666666666666666), re); else tmp = Float64(im * Float64(im * Float64(0.041666666666666664 * Float64(re * Float64(im * im))))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.001], N[(re * N[(N[(re * re), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision], N[(im * N[(im * N[(0.041666666666666664 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(re, \left(re \cdot re\right) \cdot -0.16666666666666666, re\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(im \cdot \left(0.041666666666666664 \cdot \left(re \cdot \left(im \cdot im\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6455.7
Simplified55.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6442.4
Simplified42.4%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6482.2
Simplified82.2%
Taylor expanded in re around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-rgt-inN/A
unpow2N/A
associate-+r+N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-+r+N/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified48.6%
Taylor expanded in im around inf
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6442.9
Simplified42.9%
Final simplification42.5%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.001) (fma re (* (* re re) -0.16666666666666666) re) (fma (* 0.5 (* im im)) re re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.001) {
tmp = fma(re, ((re * re) * -0.16666666666666666), re);
} else {
tmp = fma((0.5 * (im * im)), re, re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.001) tmp = fma(re, Float64(Float64(re * re) * -0.16666666666666666), re); else tmp = fma(Float64(0.5 * Float64(im * im)), re, re); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.001], N[(re * N[(N[(re * re), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision], N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] * re + re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\sin re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(re, \left(re \cdot re\right) \cdot -0.16666666666666666, re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot \left(im \cdot im\right), re, re\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 1e-3Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6455.7
Simplified55.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6442.4
Simplified42.4%
if 1e-3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6462.9
Simplified62.9%
Taylor expanded in re around 0
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft1-inN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.7
Simplified37.7%
Final simplification40.9%
(FPCore (re im)
:precision binary64
(if (<= (sin re) -0.01)
(* (* re (* re re)) (* (* (* im im) (* im im)) -0.006944444444444444))
(if (<= (sin re) 5e-14)
(* re (fma (* im im) (fma im (* im 0.041666666666666664) 0.5) 1.0))
(*
re
(*
(fma im im 2.0)
(fma
(* re re)
(fma (* re re) 0.004166666666666667 -0.08333333333333333)
0.5))))))
double code(double re, double im) {
double tmp;
if (sin(re) <= -0.01) {
tmp = (re * (re * re)) * (((im * im) * (im * im)) * -0.006944444444444444);
} else if (sin(re) <= 5e-14) {
tmp = re * fma((im * im), fma(im, (im * 0.041666666666666664), 0.5), 1.0);
} else {
tmp = re * (fma(im, im, 2.0) * fma((re * re), fma((re * re), 0.004166666666666667, -0.08333333333333333), 0.5));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (sin(re) <= -0.01) tmp = Float64(Float64(re * Float64(re * re)) * Float64(Float64(Float64(im * im) * Float64(im * im)) * -0.006944444444444444)); elseif (sin(re) <= 5e-14) tmp = Float64(re * fma(Float64(im * im), fma(im, Float64(im * 0.041666666666666664), 0.5), 1.0)); else tmp = Float64(re * Float64(fma(im, im, 2.0) * fma(Float64(re * re), fma(Float64(re * re), 0.004166666666666667, -0.08333333333333333), 0.5))); end return tmp end
code[re_, im_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.01], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.006944444444444444), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[re], $MachinePrecision], 5e-14], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(im * im + 2.0), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * 0.004166666666666667 + -0.08333333333333333), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.01:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot -0.006944444444444444\right)\\
\mathbf{elif}\;\sin re \leq 5 \cdot 10^{-14}:\\
\;\;\;\;re \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(\mathsf{fma}\left(im, im, 2\right) \cdot \mathsf{fma}\left(re \cdot re, \mathsf{fma}\left(re \cdot re, 0.004166666666666667, -0.08333333333333333\right), 0.5\right)\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0100000000000000002Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6487.7
Simplified87.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
Simplified28.5%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
Simplified27.2%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6426.6
Simplified26.6%
if -0.0100000000000000002 < (sin.f64 re) < 5.0000000000000002e-14Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
Simplified88.9%
Taylor expanded in re around 0
Simplified87.8%
if 5.0000000000000002e-14 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6467.1
Simplified67.1%
Taylor expanded in re around 0
*-lowering-*.f64N/A
*-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
Simplified33.4%
(FPCore (re im) :precision binary64 (if (<= (sin re) -0.01) (* (fma im im 2.0) (* re (* (* re re) -0.08333333333333333))) (* re (fma (* im im) (fma im (* im 0.041666666666666664) 0.5) 1.0))))
double code(double re, double im) {
double tmp;
if (sin(re) <= -0.01) {
tmp = fma(im, im, 2.0) * (re * ((re * re) * -0.08333333333333333));
} else {
tmp = re * fma((im * im), fma(im, (im * 0.041666666666666664), 0.5), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (sin(re) <= -0.01) tmp = Float64(fma(im, im, 2.0) * Float64(re * Float64(Float64(re * re) * -0.08333333333333333))); else tmp = Float64(re * fma(Float64(im * im), fma(im, Float64(im * 0.041666666666666664), 0.5), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.01], N[(N[(im * im + 2.0), $MachinePrecision] * N[(re * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(re \cdot \left(\left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right), 1\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0100000000000000002Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6474.1
Simplified74.1%
Taylor expanded in re around 0
distribute-rgt-inN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6427.3
Simplified27.3%
Taylor expanded in re around inf
associate-*r*N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6426.0
Simplified26.0%
if -0.0100000000000000002 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
Simplified87.7%
Taylor expanded in re around 0
Simplified71.5%
Final simplification57.8%
(FPCore (re im) :precision binary64 (if (<= (sin re) -0.01) (* (* re (* re re)) -0.16666666666666666) re))
double code(double re, double im) {
double tmp;
if (sin(re) <= -0.01) {
tmp = (re * (re * re)) * -0.16666666666666666;
} else {
tmp = re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (sin(re) <= (-0.01d0)) then
tmp = (re * (re * re)) * (-0.16666666666666666d0)
else
tmp = re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.sin(re) <= -0.01) {
tmp = (re * (re * re)) * -0.16666666666666666;
} else {
tmp = re;
}
return tmp;
}
def code(re, im): tmp = 0 if math.sin(re) <= -0.01: tmp = (re * (re * re)) * -0.16666666666666666 else: tmp = re return tmp
function code(re, im) tmp = 0.0 if (sin(re) <= -0.01) tmp = Float64(Float64(re * Float64(re * re)) * -0.16666666666666666); else tmp = re; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (sin(re) <= -0.01) tmp = (re * (re * re)) * -0.16666666666666666; else tmp = re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.01], N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision], re]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.01:\\
\;\;\;\;\left(re \cdot \left(re \cdot re\right)\right) \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;re\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0100000000000000002Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6448.9
Simplified48.9%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6419.9
Simplified19.9%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6419.8
Simplified19.8%
if -0.0100000000000000002 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6445.2
Simplified45.2%
Taylor expanded in re around 0
Simplified33.6%
Final simplification29.4%
(FPCore (re im) :precision binary64 (fma re (* (* re re) -0.16666666666666666) re))
double code(double re, double im) {
return fma(re, ((re * re) * -0.16666666666666666), re);
}
function code(re, im) return fma(re, Float64(Float64(re * re) * -0.16666666666666666), re) end
code[re_, im_] := N[(re * N[(N[(re * re), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + re), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(re, \left(re \cdot re\right) \cdot -0.16666666666666666, re\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6446.3
Simplified46.3%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6433.6
Simplified33.6%
(FPCore (re im) :precision binary64 re)
double code(double re, double im) {
return re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re
end function
public static double code(double re, double im) {
return re;
}
def code(re, im): return re
function code(re, im) return re end
function tmp = code(re, im) tmp = re; end
code[re_, im_] := re
\begin{array}{l}
\\
re
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
sin-lowering-sin.f6446.3
Simplified46.3%
Taylor expanded in re around 0
Simplified24.3%
herbie shell --seed 2024204
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))