
(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 (fma (* (sin re) (exp (- im))) 0.5 (* (sin re) (* 0.5 (exp im)))))
double code(double re, double im) {
return fma((sin(re) * exp(-im)), 0.5, (sin(re) * (0.5 * exp(im))));
}
function code(re, im) return fma(Float64(sin(re) * exp(Float64(-im))), 0.5, Float64(sin(re) * Float64(0.5 * exp(im)))) end
code[re_, im_] := N[(N[(N[Sin[re], $MachinePrecision] * N[Exp[(-im)], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin re \cdot e^{-im}, 0.5, \sin re \cdot \left(0.5 \cdot e^{im}\right)\right)
\end{array}
Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
distribute-rgt-inN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub0-negN/A
lower-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64100.0
Applied egg-rr100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* (sin re) 0.5) (+ (exp (- im)) (exp im)))))
(if (<= t_0 (- INFINITY))
(*
(fma
(* im im)
(fma
im
(* im (fma (* im im) 0.001388888888888889 0.041666666666666664))
0.5)
1.0)
(* re (* -0.16666666666666666 (* re re))))
(if (<= t_0 1.0)
(* (sin re) (fma 0.5 (* im im) 1.0))
(fma
re
(*
im
(*
im
(fma
(* im im)
(fma im (* im 0.001388888888888889) 0.041666666666666664)
0.5)))
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 = fma((im * im), fma(im, (im * fma((im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0) * (re * (-0.16666666666666666 * (re * re)));
} else if (t_0 <= 1.0) {
tmp = sin(re) * fma(0.5, (im * im), 1.0);
} else {
tmp = fma(re, (im * (im * fma((im * im), fma(im, (im * 0.001388888888888889), 0.041666666666666664), 0.5))), 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(fma(Float64(im * im), fma(im, Float64(im * fma(Float64(im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0) * Float64(re * Float64(-0.16666666666666666 * Float64(re * re)))); elseif (t_0 <= 1.0) tmp = Float64(sin(re) * fma(0.5, Float64(im * im), 1.0)); else tmp = fma(re, Float64(im * Float64(im * fma(Float64(im * im), fma(im, Float64(im * 0.001388888888888889), 0.041666666666666664), 0.5))), 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[(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] * N[(re * N[(-0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(re * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $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:\\
\;\;\;\;\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) \cdot \left(re \cdot \left(-0.16666666666666666 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, im \cdot \left(im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot 0.001388888888888889, 0.041666666666666664\right), 0.5\right)\right), 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))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
Simplified88.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6478.2
Simplified78.2%
Taylor expanded in re around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Simplified28.9%
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
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
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%
Taylor expanded in im around 0
Simplified76.4%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.5
Simplified67.5%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
Simplified54.7%
Taylor expanded in im around 0
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6454.7
Simplified54.7%
Final simplification72.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* (sin re) 0.5) (+ (exp (- im)) (exp im)))))
(if (<= t_0 (- INFINITY))
(*
(fma
(* im im)
(fma
im
(* im (fma (* im im) 0.001388888888888889 0.041666666666666664))
0.5)
1.0)
(* re (* -0.16666666666666666 (* re re))))
(if (<= t_0 1.0)
(sin re)
(fma
re
(*
im
(*
im
(fma
(* im im)
(fma im (* im 0.001388888888888889) 0.041666666666666664)
0.5)))
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 = fma((im * im), fma(im, (im * fma((im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0) * (re * (-0.16666666666666666 * (re * re)));
} else if (t_0 <= 1.0) {
tmp = sin(re);
} else {
tmp = fma(re, (im * (im * fma((im * im), fma(im, (im * 0.001388888888888889), 0.041666666666666664), 0.5))), 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(fma(Float64(im * im), fma(im, Float64(im * fma(Float64(im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0) * Float64(re * Float64(-0.16666666666666666 * Float64(re * re)))); elseif (t_0 <= 1.0) tmp = sin(re); else tmp = fma(re, Float64(im * Float64(im * fma(Float64(im * im), fma(im, Float64(im * 0.001388888888888889), 0.041666666666666664), 0.5))), 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[(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] * N[(re * N[(-0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[re], $MachinePrecision], N[(re * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $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:\\
\;\;\;\;\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) \cdot \left(re \cdot \left(-0.16666666666666666 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, im \cdot \left(im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot 0.001388888888888889, 0.041666666666666664\right), 0.5\right)\right), 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))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
Simplified88.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6478.2
Simplified78.2%
Taylor expanded in re around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Simplified28.9%
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
lower-sin.f6499.7
Simplified99.7%
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%
Taylor expanded in im around 0
Simplified76.4%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.5
Simplified67.5%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
Simplified54.7%
Taylor expanded in im around 0
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6454.7
Simplified54.7%
Final simplification72.7%
(FPCore (re im)
:precision binary64
(if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001)
(*
(fma (* im im) (fma (* im im) 0.041666666666666664 0.5) 1.0)
(fma re (* -0.16666666666666666 (* re re)) re))
(fma
re
(*
im
(*
im
(fma
(* im im)
(fma im (* im 0.001388888888888889) 0.041666666666666664)
0.5)))
re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma((im * im), fma((im * im), 0.041666666666666664, 0.5), 1.0) * fma(re, (-0.16666666666666666 * (re * re)), re);
} else {
tmp = fma(re, (im * (im * fma((im * im), fma(im, (im * 0.001388888888888889), 0.041666666666666664), 0.5))), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.0001) tmp = Float64(fma(Float64(im * im), fma(Float64(im * im), 0.041666666666666664, 0.5), 1.0) * fma(re, Float64(-0.16666666666666666 * Float64(re * re)), re)); else tmp = fma(re, Float64(im * Float64(im * fma(Float64(im * im), fma(im, Float64(im * 0.001388888888888889), 0.041666666666666664), 0.5))), 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.0001], N[(N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * N[(-0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision], N[(re * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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.0001:\\
\;\;\;\;\mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, 0.041666666666666664, 0.5\right), 1\right) \cdot \mathsf{fma}\left(re, -0.16666666666666666 \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, im \cdot \left(im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot 0.001388888888888889, 0.041666666666666664\right), 0.5\right)\right), 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))) < 1.00000000000000005e-4Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sin.f64N/A
Simplified91.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.3
Simplified65.3%
if 1.00000000000000005e-4 < (*.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
Simplified84.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6444.6
Simplified44.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
Simplified36.7%
Taylor expanded in im around 0
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6436.7
Simplified36.7%
Final simplification54.7%
(FPCore (re im)
:precision binary64
(if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001)
(* (fma 0.5 (* im im) 1.0) (fma re (* -0.16666666666666666 (* re re)) re))
(fma
re
(*
im
(*
im
(fma
(* im im)
(fma im (* im 0.001388888888888889) 0.041666666666666664)
0.5)))
re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma(0.5, (im * im), 1.0) * fma(re, (-0.16666666666666666 * (re * re)), re);
} else {
tmp = fma(re, (im * (im * fma((im * im), fma(im, (im * 0.001388888888888889), 0.041666666666666664), 0.5))), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.0001) tmp = Float64(fma(0.5, Float64(im * im), 1.0) * fma(re, Float64(-0.16666666666666666 * Float64(re * re)), re)); else tmp = fma(re, Float64(im * Float64(im * fma(Float64(im * im), fma(im, Float64(im * 0.001388888888888889), 0.041666666666666664), 0.5))), 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.0001], N[(N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * N[(-0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision], N[(re * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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.0001:\\
\;\;\;\;\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \mathsf{fma}\left(re, -0.16666666666666666 \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, im \cdot \left(im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot 0.001388888888888889, 0.041666666666666664\right), 0.5\right)\right), 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))) < 1.00000000000000005e-4Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.4
Simplified80.4%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.1
Simplified58.1%
if 1.00000000000000005e-4 < (*.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
Simplified84.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6444.6
Simplified44.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
Simplified36.7%
Taylor expanded in im around 0
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6436.7
Simplified36.7%
Final simplification50.2%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001) (* (fma 0.5 (* im im) 1.0) (fma re (* -0.16666666666666666 (* re re)) re)) (fma re (* (* im im) (* (* im im) (* (* im im) 0.001388888888888889))) re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma(0.5, (im * im), 1.0) * fma(re, (-0.16666666666666666 * (re * re)), re);
} else {
tmp = fma(re, ((im * im) * ((im * im) * ((im * im) * 0.001388888888888889))), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.0001) tmp = Float64(fma(0.5, Float64(im * im), 1.0) * fma(re, Float64(-0.16666666666666666 * Float64(re * re)), re)); else tmp = fma(re, Float64(Float64(im * im) * Float64(Float64(im * im) * Float64(Float64(im * im) * 0.001388888888888889))), 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.0001], N[(N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * N[(-0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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.0001:\\
\;\;\;\;\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \mathsf{fma}\left(re, -0.16666666666666666 \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.001388888888888889\right)\right), 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))) < 1.00000000000000005e-4Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.4
Simplified80.4%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.1
Simplified58.1%
if 1.00000000000000005e-4 < (*.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
Simplified84.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6444.6
Simplified44.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
Simplified36.7%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6436.7
Simplified36.7%
Final simplification50.2%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001) (* (fma 0.5 (* im im) 1.0) (fma re (* -0.16666666666666666 (* re re)) re)) (fma (* im (* im (fma im (* im 0.041666666666666664) 0.5))) re re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma(0.5, (im * im), 1.0) * fma(re, (-0.16666666666666666 * (re * re)), re);
} else {
tmp = fma((im * (im * fma(im, (im * 0.041666666666666664), 0.5))), 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.0001) tmp = Float64(fma(0.5, Float64(im * im), 1.0) * fma(re, Float64(-0.16666666666666666 * Float64(re * re)), re)); else tmp = fma(Float64(im * Float64(im * fma(im, Float64(im * 0.041666666666666664), 0.5))), 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.0001], N[(N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * N[(-0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision], N[(N[(im * N[(im * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $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.0001:\\
\;\;\;\;\mathsf{fma}\left(0.5, im \cdot im, 1\right) \cdot \mathsf{fma}\left(re, -0.16666666666666666 \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im \cdot \left(im \cdot \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right)\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))) < 1.00000000000000005e-4Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.4
Simplified80.4%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.1
Simplified58.1%
if 1.00000000000000005e-4 < (*.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-lft-inN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sin.f64N/A
Simplified84.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6429.7
Simplified29.7%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.7
Applied egg-rr36.7%
Final simplification50.2%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001) (fma -0.16666666666666666 (* re (* re re)) re) (fma (* im (* im (fma im (* im 0.041666666666666664) 0.5))) re re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma(-0.16666666666666666, (re * (re * re)), re);
} else {
tmp = fma((im * (im * fma(im, (im * 0.041666666666666664), 0.5))), 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.0001) tmp = fma(-0.16666666666666666, Float64(re * Float64(re * re)), re); else tmp = fma(Float64(im * Float64(im * fma(im, Float64(im * 0.041666666666666664), 0.5))), 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.0001], N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision], N[(N[(im * N[(im * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $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.0001:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im \cdot \left(im \cdot \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right)\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))) < 1.00000000000000005e-4Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.3
Simplified71.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.2
Simplified45.2%
if 1.00000000000000005e-4 < (*.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-lft-inN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sin.f64N/A
Simplified84.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6429.7
Simplified29.7%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.7
Applied egg-rr36.7%
Final simplification42.0%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001) (fma -0.16666666666666666 (* re (* re re)) re) (fma (* im im) (* re (fma im (* im 0.041666666666666664) 0.5)) re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma(-0.16666666666666666, (re * (re * re)), re);
} else {
tmp = fma((im * im), (re * fma(im, (im * 0.041666666666666664), 0.5)), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.0001) tmp = fma(-0.16666666666666666, Float64(re * Float64(re * re)), re); else tmp = fma(Float64(im * im), Float64(re * fma(im, Float64(im * 0.041666666666666664), 0.5)), 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.0001], N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * N[(re * N[(im * N[(im * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + 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.0001:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im \cdot im, re \cdot \mathsf{fma}\left(im, im \cdot 0.041666666666666664, 0.5\right), 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))) < 1.00000000000000005e-4Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.3
Simplified71.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.2
Simplified45.2%
if 1.00000000000000005e-4 < (*.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-lft-inN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sin.f64N/A
Simplified84.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6429.7
Simplified29.7%
Final simplification39.5%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001) (fma -0.16666666666666666 (* re (* re re)) re) (fma (* im im) (* re (* (* im im) 0.041666666666666664)) re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma(-0.16666666666666666, (re * (re * re)), re);
} else {
tmp = fma((im * im), (re * ((im * im) * 0.041666666666666664)), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.0001) tmp = fma(-0.16666666666666666, Float64(re * Float64(re * re)), re); else tmp = fma(Float64(im * im), Float64(re * Float64(Float64(im * im) * 0.041666666666666664)), 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.0001], N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * N[(re * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision] + 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.0001:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im \cdot im, re \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right), 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))) < 1.00000000000000005e-4Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.3
Simplified71.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.2
Simplified45.2%
if 1.00000000000000005e-4 < (*.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-lft-inN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sin.f64N/A
Simplified84.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6429.7
Simplified29.7%
Taylor expanded in im around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6429.7
Simplified29.7%
Final simplification39.5%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001) (fma -0.16666666666666666 (* re (* re re)) 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.0001) {
tmp = fma(-0.16666666666666666, (re * (re * re)), 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.0001) tmp = fma(-0.16666666666666666, Float64(re * Float64(re * re)), 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.0001], N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $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.0001:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), 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))) < 1.00000000000000005e-4Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.3
Simplified71.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.2
Simplified45.2%
if 1.00000000000000005e-4 < (*.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-lft-inN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sin.f64N/A
Simplified84.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6429.7
Simplified29.7%
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
associate-*r*N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6429.2
Simplified29.2%
Final simplification39.3%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001) (fma -0.16666666666666666 (* re (* re re)) re) (fma re (* 0.5 (* im im)) re)))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma(-0.16666666666666666, (re * (re * re)), re);
} else {
tmp = fma(re, (0.5 * (im * im)), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(sin(re) * 0.5) * Float64(exp(Float64(-im)) + exp(im))) <= 0.0001) tmp = fma(-0.16666666666666666, Float64(re * Float64(re * re)), re); else tmp = fma(re, Float64(0.5 * Float64(im * im)), 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.0001], N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision], N[(re * N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + 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.0001:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, 0.5 \cdot \left(im \cdot im\right), 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))) < 1.00000000000000005e-4Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.3
Simplified71.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.2
Simplified45.2%
if 1.00000000000000005e-4 < (*.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
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.6
Simplified64.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6421.7
Simplified21.7%
Final simplification36.5%
(FPCore (re im) :precision binary64 (if (<= (* (* (sin re) 0.5) (+ (exp (- im)) (exp im))) 0.0001) (fma -0.16666666666666666 (* re (* re re)) re) (* (* im im) (* re 0.5))))
double code(double re, double im) {
double tmp;
if (((sin(re) * 0.5) * (exp(-im) + exp(im))) <= 0.0001) {
tmp = fma(-0.16666666666666666, (re * (re * re)), re);
} else {
tmp = (im * im) * (re * 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.0001) tmp = fma(-0.16666666666666666, Float64(re * Float64(re * re)), re); else tmp = Float64(Float64(im * im) * Float64(re * 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.0001], N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * N[(re * 0.5), $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.0001:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5\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))) < 1.00000000000000005e-4Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.3
Simplified71.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.2
Simplified45.2%
if 1.00000000000000005e-4 < (*.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
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.6
Simplified64.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6421.7
Simplified21.7%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6421.3
Simplified21.3%
Final simplification36.3%
(FPCore (re im) :precision binary64 (* (sin re) (cosh im)))
double code(double re, double im) {
return sin(re) * cosh(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * cosh(im)
end function
public static double code(double re, double im) {
return Math.sin(re) * Math.cosh(im);
}
def code(re, im): return math.sin(re) * math.cosh(im)
function code(re, im) return Float64(sin(re) * cosh(im)) end
function tmp = code(re, im) tmp = sin(re) * cosh(im); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[Cosh[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \cosh im
\end{array}
Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (fma 0.5 (* im im) 1.0)))
(if (<= im 3.4e-5)
(* (sin re) t_0)
(if (<= im 7e+51)
(* (cosh im) (fma -0.16666666666666666 (* re (* re re)) re))
(*
(sin re)
(fma
(fma im (* im 0.001388888888888889) 0.041666666666666664)
(* im (* im (* im im)))
t_0))))))
double code(double re, double im) {
double t_0 = fma(0.5, (im * im), 1.0);
double tmp;
if (im <= 3.4e-5) {
tmp = sin(re) * t_0;
} else if (im <= 7e+51) {
tmp = cosh(im) * fma(-0.16666666666666666, (re * (re * re)), re);
} else {
tmp = sin(re) * fma(fma(im, (im * 0.001388888888888889), 0.041666666666666664), (im * (im * (im * im))), t_0);
}
return tmp;
}
function code(re, im) t_0 = fma(0.5, Float64(im * im), 1.0) tmp = 0.0 if (im <= 3.4e-5) tmp = Float64(sin(re) * t_0); elseif (im <= 7e+51) tmp = Float64(cosh(im) * fma(-0.16666666666666666, Float64(re * Float64(re * re)), re)); else tmp = Float64(sin(re) * fma(fma(im, Float64(im * 0.001388888888888889), 0.041666666666666664), Float64(im * Float64(im * Float64(im * im))), t_0)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[im, 3.4e-5], N[(N[Sin[re], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[im, 7e+51], N[(N[Cosh[im], $MachinePrecision] * N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(im * N[(im * 0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(im * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\
\mathbf{if}\;im \leq 3.4 \cdot 10^{-5}:\\
\;\;\;\;\sin re \cdot t\_0\\
\mathbf{elif}\;im \leq 7 \cdot 10^{+51}:\\
\;\;\;\;\cosh im \cdot \mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(im, im \cdot 0.001388888888888889, 0.041666666666666664\right), im \cdot \left(im \cdot \left(im \cdot im\right)\right), t\_0\right)\\
\end{array}
\end{array}
if im < 3.4e-5Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.7
Simplified84.7%
if 3.4e-5 < im < 7e51Initial program 99.9%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr99.9%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.2
Simplified83.2%
lift-cosh.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f6483.2
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
cube-unmultN/A
*-commutativeN/A
lower-fma.f64N/A
cube-unmultN/A
lift-*.f64N/A
lower-*.f6483.2
lift-*.f64N/A
*-lft-identity83.2
Applied egg-rr83.2%
if 7e51 < im Initial program 100.0%
Taylor expanded in im around 0
Simplified100.0%
Final simplification87.5%
(FPCore (re im)
:precision binary64
(if (<= (sin re) 0.0001)
(*
re
(*
(fma (* re re) -0.16666666666666666 1.0)
(fma
im
(*
im
(fma
(* im im)
(fma (* im im) 0.001388888888888889 0.041666666666666664)
0.5))
1.0)))
(fma re (* (* im im) (* (* im im) (* (* im im) 0.001388888888888889))) re)))
double code(double re, double im) {
double tmp;
if (sin(re) <= 0.0001) {
tmp = re * (fma((re * re), -0.16666666666666666, 1.0) * fma(im, (im * fma((im * im), fma((im * im), 0.001388888888888889, 0.041666666666666664), 0.5)), 1.0));
} else {
tmp = fma(re, ((im * im) * ((im * im) * ((im * im) * 0.001388888888888889))), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (sin(re) <= 0.0001) tmp = Float64(re * Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * fma(im, Float64(im * fma(Float64(im * im), fma(Float64(im * im), 0.001388888888888889, 0.041666666666666664), 0.5)), 1.0))); else tmp = fma(re, Float64(Float64(im * im) * Float64(Float64(im * im) * Float64(Float64(im * im) * 0.001388888888888889))), re); end return tmp end
code[re_, im_] := If[LessEqual[N[Sin[re], $MachinePrecision], 0.0001], N[(re * N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq 0.0001:\\
\;\;\;\;re \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.001388888888888889\right)\right), re\right)\\
\end{array}
\end{array}
if (sin.f64 re) < 1.00000000000000005e-4Initial program 100.0%
Taylor expanded in im around 0
Simplified92.9%
Taylor expanded in re around 0
Simplified69.7%
if 1.00000000000000005e-4 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
Simplified88.3%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6429.5
Simplified29.5%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
Simplified18.0%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6418.0
Simplified18.0%
(FPCore (re im)
:precision binary64
(if (<= (sin re) -0.01)
(*
(fma
(* im im)
(fma
im
(* im (fma (* im im) 0.001388888888888889 0.041666666666666664))
0.5)
1.0)
(* re (* -0.16666666666666666 (* re re))))
(fma
re
(*
im
(*
im
(fma
(* im im)
(fma im (* im 0.001388888888888889) 0.041666666666666664)
0.5)))
re)))
double code(double re, double im) {
double tmp;
if (sin(re) <= -0.01) {
tmp = fma((im * im), fma(im, (im * fma((im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0) * (re * (-0.16666666666666666 * (re * re)));
} else {
tmp = fma(re, (im * (im * fma((im * im), fma(im, (im * 0.001388888888888889), 0.041666666666666664), 0.5))), re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (sin(re) <= -0.01) tmp = Float64(fma(Float64(im * im), fma(im, Float64(im * fma(Float64(im * im), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0) * Float64(re * Float64(-0.16666666666666666 * Float64(re * re)))); else tmp = fma(re, Float64(im * Float64(im * fma(Float64(im * im), fma(im, Float64(im * 0.001388888888888889), 0.041666666666666664), 0.5))), re); end return tmp end
code[re_, im_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.01], N[(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] * N[(re * N[(-0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * 0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.01:\\
\;\;\;\;\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) \cdot \left(re \cdot \left(-0.16666666666666666 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, im \cdot \left(im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot 0.001388888888888889, 0.041666666666666664\right), 0.5\right)\right), re\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0100000000000000002Initial program 100.0%
Taylor expanded in im around 0
Simplified97.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6428.3
Simplified28.3%
Taylor expanded in re around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Simplified28.3%
if -0.0100000000000000002 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
Simplified90.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.7
Simplified69.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
Simplified66.1%
Taylor expanded in im around 0
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6466.1
Simplified66.1%
Final simplification56.8%
(FPCore (re im)
:precision binary64
(if (<= im 3.4e-5)
(* (sin re) (fma 0.5 (* im im) 1.0))
(if (<= im 2.5e+77)
(* (cosh im) (fma -0.16666666666666666 (* re (* re re)) re))
(*
(sin re)
(fma (* im im) (fma (* im im) 0.041666666666666664 0.5) 1.0)))))
double code(double re, double im) {
double tmp;
if (im <= 3.4e-5) {
tmp = sin(re) * fma(0.5, (im * im), 1.0);
} else if (im <= 2.5e+77) {
tmp = cosh(im) * fma(-0.16666666666666666, (re * (re * re)), re);
} else {
tmp = sin(re) * fma((im * im), fma((im * im), 0.041666666666666664, 0.5), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 3.4e-5) tmp = Float64(sin(re) * fma(0.5, Float64(im * im), 1.0)); elseif (im <= 2.5e+77) tmp = Float64(cosh(im) * fma(-0.16666666666666666, Float64(re * Float64(re * re)), re)); else tmp = Float64(sin(re) * fma(Float64(im * im), fma(Float64(im * im), 0.041666666666666664, 0.5), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[im, 3.4e-5], N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.5e+77], N[(N[Cosh[im], $MachinePrecision] * N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.4 \cdot 10^{-5}:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\
\mathbf{elif}\;im \leq 2.5 \cdot 10^{+77}:\\
\;\;\;\;\cosh im \cdot \mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, 0.041666666666666664, 0.5\right), 1\right)\\
\end{array}
\end{array}
if im < 3.4e-5Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.7
Simplified84.7%
if 3.4e-5 < im < 2.50000000000000002e77Initial program 99.9%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr99.9%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.3
Simplified71.3%
lift-cosh.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f6471.3
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
cube-unmultN/A
*-commutativeN/A
lower-fma.f64N/A
cube-unmultN/A
lift-*.f64N/A
lower-*.f6471.3
lift-*.f64N/A
*-lft-identity71.3
Applied egg-rr71.3%
if 2.50000000000000002e77 < im Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sin.f64N/A
Simplified100.0%
Final simplification86.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin re) (fma 0.5 (* im im) 1.0))))
(if (<= im 3.4e-5)
t_0
(if (<= im 1.35e+154)
(* (cosh im) (fma -0.16666666666666666 (* re (* re re)) re))
t_0))))
double code(double re, double im) {
double t_0 = sin(re) * fma(0.5, (im * im), 1.0);
double tmp;
if (im <= 3.4e-5) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = cosh(im) * fma(-0.16666666666666666, (re * (re * re)), re);
} else {
tmp = t_0;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(re) * fma(0.5, Float64(im * im), 1.0)) tmp = 0.0 if (im <= 3.4e-5) tmp = t_0; elseif (im <= 1.35e+154) tmp = Float64(cosh(im) * fma(-0.16666666666666666, Float64(re * Float64(re * re)), re)); else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 3.4e-5], t$95$0, If[LessEqual[im, 1.35e+154], N[(N[Cosh[im], $MachinePrecision] * N[(-0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin re \cdot \mathsf{fma}\left(0.5, im \cdot im, 1\right)\\
\mathbf{if}\;im \leq 3.4 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\cosh im \cdot \mathsf{fma}\left(-0.16666666666666666, re \cdot \left(re \cdot re\right), re\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 3.4e-5 or 1.35000000000000003e154 < im Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.3
Simplified86.3%
if 3.4e-5 < im < 1.35000000000000003e154Initial program 100.0%
lift-sin.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.3
Simplified76.3%
lift-cosh.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f6476.3
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
cube-unmultN/A
*-commutativeN/A
lower-fma.f64N/A
cube-unmultN/A
lift-*.f64N/A
lower-*.f6476.3
lift-*.f64N/A
*-lft-identity76.3
Applied egg-rr76.3%
Final simplification84.8%
(FPCore (re im) :precision binary64 (* (* im im) (* re 0.5)))
double code(double re, double im) {
return (im * im) * (re * 0.5);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (im * im) * (re * 0.5d0)
end function
public static double code(double re, double im) {
return (im * im) * (re * 0.5);
}
def code(re, im): return (im * im) * (re * 0.5)
function code(re, im) return Float64(Float64(im * im) * Float64(re * 0.5)) end
function tmp = code(re, im) tmp = (im * im) * (re * 0.5); end
code[re_, im_] := N[(N[(im * im), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(im \cdot im\right) \cdot \left(re \cdot 0.5\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.5
Simplified74.5%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6440.4
Simplified40.4%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6417.4
Simplified17.4%
Final simplification17.4%
herbie shell --seed 2024207
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))