
(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 17 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}
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (fma (/ 0.5 (exp im_m)) (sin re) (* (* (exp im_m) 0.5) (sin re))))
im_m = fabs(im);
double code(double re, double im_m) {
return fma((0.5 / exp(im_m)), sin(re), ((exp(im_m) * 0.5) * sin(re)));
}
im_m = abs(im) function code(re, im_m) return fma(Float64(0.5 / exp(im_m)), sin(re), Float64(Float64(exp(im_m) * 0.5) * sin(re))) end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(N[(0.5 / N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision] * N[Sin[re], $MachinePrecision] + N[(N[(N[Exp[im$95$m], $MachinePrecision] * 0.5), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
\mathsf{fma}\left(\frac{0.5}{e^{im\_m}}, \sin re, \left(e^{im\_m} \cdot 0.5\right) \cdot \sin re\right)
\end{array}
Initial program 100.0%
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-inN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lift-exp.f64N/A
lift--.f64N/A
exp-diffN/A
lift-exp.f64N/A
associate-*l/N/A
exp-0N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* (* 0.5 (sin re)) (+ (exp (- im_m)) (exp im_m)))))
(if (<= t_0 (- INFINITY))
(*
(*
(fma
(fma
(fma -9.92063492063492e-5 (* re re) 0.004166666666666667)
(* re re)
-0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(if (<= t_0 1.0)
(*
(fma
(fma
(fma 0.001388888888888889 (* im_m im_m) 0.041666666666666664)
(* im_m im_m)
0.5)
(* im_m im_m)
1.0)
(sin re))
(*
(* 0.5 re)
(fma
(pow im_m 4.0)
(fma 0.002777777777777778 (* im_m im_m) 0.08333333333333333)
(fma im_m im_m 2.0)))))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = (0.5 * sin(re)) * (exp(-im_m) + exp(im_m));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (fma(fma(fma(-9.92063492063492e-5, (re * re), 0.004166666666666667), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else if (t_0 <= 1.0) {
tmp = fma(fma(fma(0.001388888888888889, (im_m * im_m), 0.041666666666666664), (im_m * im_m), 0.5), (im_m * im_m), 1.0) * sin(re);
} else {
tmp = (0.5 * re) * fma(pow(im_m, 4.0), fma(0.002777777777777778, (im_m * im_m), 0.08333333333333333), fma(im_m, im_m, 2.0));
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im_m)) + exp(im_m))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(fma(fma(fma(-9.92063492063492e-5, Float64(re * re), 0.004166666666666667), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); elseif (t_0 <= 1.0) tmp = Float64(fma(fma(fma(0.001388888888888889, Float64(im_m * im_m), 0.041666666666666664), Float64(im_m * im_m), 0.5), Float64(im_m * im_m), 1.0) * sin(re)); else tmp = Float64(Float64(0.5 * re) * fma((im_m ^ 4.0), fma(0.002777777777777778, Float64(im_m * im_m), 0.08333333333333333), fma(im_m, im_m, 2.0))); end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision] + 0.004166666666666667), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(N[(N[(N[(0.001388888888888889 * N[(im$95$m * im$95$m), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision] + 0.5), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Power[im$95$m, 4.0], $MachinePrecision] * N[(0.002777777777777778 * N[(im$95$m * im$95$m), $MachinePrecision] + 0.08333333333333333), $MachinePrecision] + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im\_m} + e^{im\_m}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889, im\_m \cdot im\_m, 0.041666666666666664\right), im\_m \cdot im\_m, 0.5\right), im\_m \cdot im\_m, 1\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left({im\_m}^{4}, \mathsf{fma}\left(0.002777777777777778, im\_m \cdot im\_m, 0.08333333333333333\right), \mathsf{fma}\left(im\_m, im\_m, 2\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
lower-fma.f6452.2
Applied rewrites52.2%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6447.6
Applied rewrites47.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))) < 1Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
lower-*.f64N/A
exp-0N/A
lower-cosh.f64100.0
Applied rewrites100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.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
Applied rewrites2.8%
Taylor expanded in re around 0
lower-*.f642.3
Applied rewrites2.3%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6462.6
Applied rewrites62.6%
Final simplification78.8%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* (* 0.5 (sin re)) (+ (exp (- im_m)) (exp im_m)))))
(if (<= t_0 (- INFINITY))
(*
(*
(fma
(fma
(fma -9.92063492063492e-5 (* re re) 0.004166666666666667)
(* re re)
-0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(if (<= t_0 1.0)
(*
(fma (fma 0.041666666666666664 (* im_m im_m) 0.5) (* im_m im_m) 1.0)
(sin re))
(*
(* 0.5 re)
(fma
(pow im_m 4.0)
(fma 0.002777777777777778 (* im_m im_m) 0.08333333333333333)
(fma im_m im_m 2.0)))))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = (0.5 * sin(re)) * (exp(-im_m) + exp(im_m));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (fma(fma(fma(-9.92063492063492e-5, (re * re), 0.004166666666666667), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else if (t_0 <= 1.0) {
tmp = fma(fma(0.041666666666666664, (im_m * im_m), 0.5), (im_m * im_m), 1.0) * sin(re);
} else {
tmp = (0.5 * re) * fma(pow(im_m, 4.0), fma(0.002777777777777778, (im_m * im_m), 0.08333333333333333), fma(im_m, im_m, 2.0));
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im_m)) + exp(im_m))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(fma(fma(fma(-9.92063492063492e-5, Float64(re * re), 0.004166666666666667), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); elseif (t_0 <= 1.0) tmp = Float64(fma(fma(0.041666666666666664, Float64(im_m * im_m), 0.5), Float64(im_m * im_m), 1.0) * sin(re)); else tmp = Float64(Float64(0.5 * re) * fma((im_m ^ 4.0), fma(0.002777777777777778, Float64(im_m * im_m), 0.08333333333333333), fma(im_m, im_m, 2.0))); end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision] + 0.004166666666666667), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(N[(N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision] + 0.5), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Power[im$95$m, 4.0], $MachinePrecision] * N[(0.002777777777777778 * N[(im$95$m * im$95$m), $MachinePrecision] + 0.08333333333333333), $MachinePrecision] + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im\_m} + e^{im\_m}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im\_m \cdot im\_m, 0.5\right), im\_m \cdot im\_m, 1\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left({im\_m}^{4}, \mathsf{fma}\left(0.002777777777777778, im\_m \cdot im\_m, 0.08333333333333333\right), \mathsf{fma}\left(im\_m, im\_m, 2\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
lower-fma.f6452.2
Applied rewrites52.2%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6447.6
Applied rewrites47.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))) < 1Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
lower-*.f64N/A
exp-0N/A
lower-cosh.f64100.0
Applied rewrites100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.8
Applied rewrites99.8%
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
Applied rewrites2.8%
Taylor expanded in re around 0
lower-*.f642.3
Applied rewrites2.3%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6462.6
Applied rewrites62.6%
Final simplification78.7%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* (* 0.5 (sin re)) (+ (exp (- im_m)) (exp im_m)))))
(if (<= t_0 (- INFINITY))
(*
(*
(fma
(fma
(fma -9.92063492063492e-5 (* re re) 0.004166666666666667)
(* re re)
-0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(if (<= t_0 1.0)
(*
(fma (fma 0.041666666666666664 (* im_m im_m) 0.5) (* im_m im_m) 1.0)
(sin re))
(*
(* 0.5 re)
(fma
(* im_m im_m)
(* (* im_m im_m) 0.08333333333333333)
(fma im_m im_m 2.0)))))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = (0.5 * sin(re)) * (exp(-im_m) + exp(im_m));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (fma(fma(fma(-9.92063492063492e-5, (re * re), 0.004166666666666667), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else if (t_0 <= 1.0) {
tmp = fma(fma(0.041666666666666664, (im_m * im_m), 0.5), (im_m * im_m), 1.0) * sin(re);
} else {
tmp = (0.5 * re) * fma((im_m * im_m), ((im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0));
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im_m)) + exp(im_m))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(fma(fma(fma(-9.92063492063492e-5, Float64(re * re), 0.004166666666666667), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); elseif (t_0 <= 1.0) tmp = Float64(fma(fma(0.041666666666666664, Float64(im_m * im_m), 0.5), Float64(im_m * im_m), 1.0) * sin(re)); else tmp = Float64(Float64(0.5 * re) * fma(Float64(im_m * im_m), Float64(Float64(im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0))); end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision] + 0.004166666666666667), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(N[(N[(0.041666666666666664 * N[(im$95$m * im$95$m), $MachinePrecision] + 0.5), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.08333333333333333), $MachinePrecision] + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im\_m} + e^{im\_m}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im\_m \cdot im\_m, 0.5\right), im\_m \cdot im\_m, 1\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m \cdot im\_m, \left(im\_m \cdot im\_m\right) \cdot 0.08333333333333333, \mathsf{fma}\left(im\_m, im\_m, 2\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
lower-fma.f6452.2
Applied rewrites52.2%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6447.6
Applied rewrites47.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))) < 1Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
lower-*.f64N/A
exp-0N/A
lower-cosh.f64100.0
Applied rewrites100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.8
Applied rewrites99.8%
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
Applied rewrites2.8%
Taylor expanded in re around 0
lower-*.f642.3
Applied rewrites2.3%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6459.5
Applied rewrites59.5%
Applied rewrites59.5%
Final simplification78.0%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))) (t_1 (* t_0 (+ (exp (- im_m)) (exp im_m)))))
(if (<= t_1 (- INFINITY))
(*
(*
(fma
(fma
(fma -9.92063492063492e-5 (* re re) 0.004166666666666667)
(* re re)
-0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(if (<= t_1 1.0)
(* t_0 (fma im_m im_m 2.0))
(*
(* 0.5 re)
(fma
(* im_m im_m)
(* (* im_m im_m) 0.08333333333333333)
(fma im_m im_m 2.0)))))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = 0.5 * sin(re);
double t_1 = t_0 * (exp(-im_m) + exp(im_m));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (fma(fma(fma(-9.92063492063492e-5, (re * re), 0.004166666666666667), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else if (t_1 <= 1.0) {
tmp = t_0 * fma(im_m, im_m, 2.0);
} else {
tmp = (0.5 * re) * fma((im_m * im_m), ((im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0));
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(0.5 * sin(re)) t_1 = Float64(t_0 * Float64(exp(Float64(-im_m)) + exp(im_m))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(fma(fma(fma(-9.92063492063492e-5, Float64(re * re), 0.004166666666666667), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); elseif (t_1 <= 1.0) tmp = Float64(t_0 * fma(im_m, im_m, 2.0)); else tmp = Float64(Float64(0.5 * re) * fma(Float64(im_m * im_m), Float64(Float64(im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0))); end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision] + 0.004166666666666667), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[(t$95$0 * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.08333333333333333), $MachinePrecision] + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
t_1 := t\_0 \cdot \left(e^{-im\_m} + e^{im\_m}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m \cdot im\_m, \left(im\_m \cdot im\_m\right) \cdot 0.08333333333333333, \mathsf{fma}\left(im\_m, im\_m, 2\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
lower-fma.f6452.2
Applied rewrites52.2%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6447.6
Applied rewrites47.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))) < 1Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6499.5
Applied rewrites99.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%
Taylor expanded in im around 0
Applied rewrites2.8%
Taylor expanded in re around 0
lower-*.f642.3
Applied rewrites2.3%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6459.5
Applied rewrites59.5%
Applied rewrites59.5%
Final simplification77.8%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* (* 0.5 (sin re)) (+ (exp (- im_m)) (exp im_m)))))
(if (<= t_0 (- INFINITY))
(*
(*
(fma
(fma
(fma -9.92063492063492e-5 (* re re) 0.004166666666666667)
(* re re)
-0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(if (<= t_0 1.0)
(sin re)
(*
(* 0.5 re)
(fma
(* im_m im_m)
(* (* im_m im_m) 0.08333333333333333)
(fma im_m im_m 2.0)))))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = (0.5 * sin(re)) * (exp(-im_m) + exp(im_m));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (fma(fma(fma(-9.92063492063492e-5, (re * re), 0.004166666666666667), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else if (t_0 <= 1.0) {
tmp = sin(re);
} else {
tmp = (0.5 * re) * fma((im_m * im_m), ((im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0));
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im_m)) + exp(im_m))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(fma(fma(fma(-9.92063492063492e-5, Float64(re * re), 0.004166666666666667), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); elseif (t_0 <= 1.0) tmp = sin(re); else tmp = Float64(Float64(0.5 * re) * fma(Float64(im_m * im_m), Float64(Float64(im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0))); end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision] + 0.004166666666666667), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[re], $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.08333333333333333), $MachinePrecision] + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im\_m} + e^{im\_m}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m \cdot im\_m, \left(im\_m \cdot im\_m\right) \cdot 0.08333333333333333, \mathsf{fma}\left(im\_m, im\_m, 2\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
lower-fma.f6452.2
Applied rewrites52.2%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6447.6
Applied rewrites47.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))) < 1Initial program 100.0%
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-inN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lift-exp.f64N/A
lift--.f64N/A
exp-diffN/A
lift-exp.f64N/A
associate-*l/N/A
exp-0N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in im around 0
distribute-rgt-outN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt-outN/A
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
mul0-rgtN/A
+-rgt-identityN/A
lower-sin.f6498.8
Applied rewrites98.8%
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
Applied rewrites2.8%
Taylor expanded in re around 0
lower-*.f642.3
Applied rewrites2.3%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6459.5
Applied rewrites59.5%
Applied rewrites59.5%
Final simplification77.4%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (fma (* (sin re) 0.5) (exp (- im_m)) (* (* (exp im_m) 0.5) (sin re))))
im_m = fabs(im);
double code(double re, double im_m) {
return fma((sin(re) * 0.5), exp(-im_m), ((exp(im_m) * 0.5) * sin(re)));
}
im_m = abs(im) function code(re, im_m) return fma(Float64(sin(re) * 0.5), exp(Float64(-im_m)), Float64(Float64(exp(im_m) * 0.5) * sin(re))) end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[Exp[(-im$95$m)], $MachinePrecision] + N[(N[(N[Exp[im$95$m], $MachinePrecision] * 0.5), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
\mathsf{fma}\left(\sin re \cdot 0.5, e^{-im\_m}, \left(e^{im\_m} \cdot 0.5\right) \cdot \sin re\right)
\end{array}
Initial program 100.0%
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub0-negN/A
lower-neg.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(if (<= (* (* 0.5 (sin re)) (+ (exp (- im_m)) (exp im_m))) -0.05)
(*
(*
(fma
(fma
(fma -9.92063492063492e-5 (* re re) 0.004166666666666667)
(* re re)
-0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(*
(* 0.5 re)
(fma
(* im_m im_m)
(* (* im_m im_m) 0.08333333333333333)
(fma im_m im_m 2.0)))))im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (((0.5 * sin(re)) * (exp(-im_m) + exp(im_m))) <= -0.05) {
tmp = (fma(fma(fma(-9.92063492063492e-5, (re * re), 0.004166666666666667), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else {
tmp = (0.5 * re) * fma((im_m * im_m), ((im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0));
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im_m)) + exp(im_m))) <= -0.05) tmp = Float64(Float64(fma(fma(fma(-9.92063492063492e-5, Float64(re * re), 0.004166666666666667), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); else tmp = Float64(Float64(0.5 * re) * fma(Float64(im_m * im_m), Float64(Float64(im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0))); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision] + 0.004166666666666667), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.08333333333333333), $MachinePrecision] + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im\_m} + e^{im\_m}\right) \leq -0.05:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m \cdot im\_m, \left(im\_m \cdot im\_m\right) \cdot 0.08333333333333333, \mathsf{fma}\left(im\_m, im\_m, 2\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))) < -0.050000000000000003Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6465.4
Applied rewrites65.4%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6435.4
Applied rewrites35.4%
if -0.050000000000000003 < (*.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
Applied rewrites64.8%
Taylor expanded in re around 0
lower-*.f6441.4
Applied rewrites41.4%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6462.1
Applied rewrites62.1%
Applied rewrites62.1%
Final simplification53.4%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (* (sin re) (cosh im_m)))
im_m = fabs(im);
double code(double re, double im_m) {
return sin(re) * cosh(im_m);
}
im_m = abs(im)
real(8) function code(re, im_m)
real(8), intent (in) :: re
real(8), intent (in) :: im_m
code = sin(re) * cosh(im_m)
end function
im_m = Math.abs(im);
public static double code(double re, double im_m) {
return Math.sin(re) * Math.cosh(im_m);
}
im_m = math.fabs(im) def code(re, im_m): return math.sin(re) * math.cosh(im_m)
im_m = abs(im) function code(re, im_m) return Float64(sin(re) * cosh(im_m)) end
im_m = abs(im); function tmp = code(re, im_m) tmp = sin(re) * cosh(im_m); end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(N[Sin[re], $MachinePrecision] * N[Cosh[im$95$m], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
\sin re \cdot \cosh im\_m
\end{array}
Initial program 100.0%
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-inN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lift-exp.f64N/A
lift--.f64N/A
exp-diffN/A
lift-exp.f64N/A
associate-*l/N/A
exp-0N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
lift-fma.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
1-expN/A
lift-exp.f64N/A
exp-diffN/A
distribute-rgt-inN/A
lift-exp.f64N/A
neg-sub0N/A
cosh-undefN/A
lift-cosh.f64N/A
*-lft-identityN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites100.0%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(if (<= (sin re) -0.004)
(*
(*
(fma
(fma (* -9.92063492063492e-5 (* re re)) (* re re) -0.08333333333333333)
(* re re)
0.5)
re)
2.0)
(*
(* 0.5 re)
(fma
(* im_m im_m)
(* (* im_m im_m) 0.08333333333333333)
(fma im_m im_m 2.0)))))im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (sin(re) <= -0.004) {
tmp = (fma(fma((-9.92063492063492e-5 * (re * re)), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * 2.0;
} else {
tmp = (0.5 * re) * fma((im_m * im_m), ((im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0));
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (sin(re) <= -0.004) tmp = Float64(Float64(fma(fma(Float64(-9.92063492063492e-5 * Float64(re * re)), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * 2.0); else tmp = Float64(Float64(0.5 * re) * fma(Float64(im_m * im_m), Float64(Float64(im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0))); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.004], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.08333333333333333), $MachinePrecision] + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.004:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5} \cdot \left(re \cdot re\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m \cdot im\_m, \left(im\_m \cdot im\_m\right) \cdot 0.08333333333333333, \mathsf{fma}\left(im\_m, im\_m, 2\right)\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0040000000000000001Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites45.6%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6422.9
Applied rewrites22.9%
Taylor expanded in re around inf
Applied rewrites22.7%
if -0.0040000000000000001 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites55.6%
Taylor expanded in re around 0
lower-*.f6436.2
Applied rewrites36.2%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6465.1
Applied rewrites65.1%
Applied rewrites65.1%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(if (<= (sin re) -0.004)
(* (* (* (* re re) -0.08333333333333333) re) (fma im_m im_m 2.0))
(*
(* 0.5 re)
(fma
(* im_m im_m)
(* (* im_m im_m) 0.08333333333333333)
(fma im_m im_m 2.0)))))im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (sin(re) <= -0.004) {
tmp = (((re * re) * -0.08333333333333333) * re) * fma(im_m, im_m, 2.0);
} else {
tmp = (0.5 * re) * fma((im_m * im_m), ((im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0));
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (sin(re) <= -0.004) tmp = Float64(Float64(Float64(Float64(re * re) * -0.08333333333333333) * re) * fma(im_m, im_m, 2.0)); else tmp = Float64(Float64(0.5 * re) * fma(Float64(im_m * im_m), Float64(Float64(im_m * im_m) * 0.08333333333333333), fma(im_m, im_m, 2.0))); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.004], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.08333333333333333), $MachinePrecision] + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.004:\\
\;\;\;\;\left(\left(\left(re \cdot re\right) \cdot -0.08333333333333333\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m \cdot im\_m, \left(im\_m \cdot im\_m\right) \cdot 0.08333333333333333, \mathsf{fma}\left(im\_m, im\_m, 2\right)\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0040000000000000001Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.0
Applied rewrites75.0%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6426.0
Applied rewrites26.0%
Taylor expanded in re around inf
Applied rewrites25.6%
if -0.0040000000000000001 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites55.6%
Taylor expanded in re around 0
lower-*.f6436.2
Applied rewrites36.2%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6465.1
Applied rewrites65.1%
Applied rewrites65.1%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(if (<= (sin re) 2e-9)
(* (* (fma -0.08333333333333333 (* re re) 0.5) re) (fma im_m im_m 2.0))
(*
(*
(fma
(fma 0.004166666666666667 (* re re) -0.08333333333333333)
(* re re)
0.5)
re)
2.0)))im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (sin(re) <= 2e-9) {
tmp = (fma(-0.08333333333333333, (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else {
tmp = (fma(fma(0.004166666666666667, (re * re), -0.08333333333333333), (re * re), 0.5) * re) * 2.0;
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (sin(re) <= 2e-9) tmp = Float64(Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); else tmp = Float64(Float64(fma(fma(0.004166666666666667, Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * 2.0); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[Sin[re], $MachinePrecision], 2e-9], N[(N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.004166666666666667 * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.004166666666666667, re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot 2\\
\end{array}
\end{array}
if (sin.f64 re) < 2.00000000000000012e-9Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.3
Applied rewrites75.3%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.2
Applied rewrites60.2%
if 2.00000000000000012e-9 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites58.5%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6418.1
Applied rewrites18.1%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (if (<= (sin re) 1e-213) (* (* (fma -0.08333333333333333 (* re re) 0.5) re) (fma im_m im_m 2.0)) (* (* 0.5 re) (fma im_m im_m 2.0))))
im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (sin(re) <= 1e-213) {
tmp = (fma(-0.08333333333333333, (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else {
tmp = (0.5 * re) * fma(im_m, im_m, 2.0);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (sin(re) <= 1e-213) tmp = Float64(Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); else tmp = Float64(Float64(0.5 * re) * fma(im_m, im_m, 2.0)); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[Sin[re], $MachinePrecision], 1e-213], N[(N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq 10^{-213}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\end{array}
\end{array}
if (sin.f64 re) < 9.9999999999999995e-214Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.7
Applied rewrites75.7%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6456.8
Applied rewrites56.8%
if 9.9999999999999995e-214 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.2
Applied rewrites75.2%
Taylor expanded in re around 0
lower-*.f6435.0
Applied rewrites35.0%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (if (<= (sin re) -0.004) (* (* (* (* re re) -0.08333333333333333) re) (fma im_m im_m 2.0)) (* (* 0.5 re) (fma im_m im_m 2.0))))
im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (sin(re) <= -0.004) {
tmp = (((re * re) * -0.08333333333333333) * re) * fma(im_m, im_m, 2.0);
} else {
tmp = (0.5 * re) * fma(im_m, im_m, 2.0);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (sin(re) <= -0.004) tmp = Float64(Float64(Float64(Float64(re * re) * -0.08333333333333333) * re) * fma(im_m, im_m, 2.0)); else tmp = Float64(Float64(0.5 * re) * fma(im_m, im_m, 2.0)); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.004], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.004:\\
\;\;\;\;\left(\left(\left(re \cdot re\right) \cdot -0.08333333333333333\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0040000000000000001Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.0
Applied rewrites75.0%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6426.0
Applied rewrites26.0%
Taylor expanded in re around inf
Applied rewrites25.6%
if -0.0040000000000000001 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.6
Applied rewrites75.6%
Taylor expanded in re around 0
lower-*.f6453.8
Applied rewrites53.8%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (if (<= (sin re) -0.004) (* (* (fma -0.08333333333333333 (* re re) 0.5) re) 2.0) (* (* 0.5 re) (fma im_m im_m 2.0))))
im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (sin(re) <= -0.004) {
tmp = (fma(-0.08333333333333333, (re * re), 0.5) * re) * 2.0;
} else {
tmp = (0.5 * re) * fma(im_m, im_m, 2.0);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (sin(re) <= -0.004) tmp = Float64(Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * re) * 2.0); else tmp = Float64(Float64(0.5 * re) * fma(im_m, im_m, 2.0)); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.004], N[(N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.004:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0040000000000000001Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites45.6%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6416.0
Applied rewrites16.0%
if -0.0040000000000000001 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.6
Applied rewrites75.6%
Taylor expanded in re around 0
lower-*.f6453.8
Applied rewrites53.8%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (* (* 0.5 re) (fma im_m im_m 2.0)))
im_m = fabs(im);
double code(double re, double im_m) {
return (0.5 * re) * fma(im_m, im_m, 2.0);
}
im_m = abs(im) function code(re, im_m) return Float64(Float64(0.5 * re) * fma(im_m, im_m, 2.0)) end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(N[(0.5 * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.5
Applied rewrites75.5%
Taylor expanded in re around 0
lower-*.f6447.4
Applied rewrites47.4%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (* (* 0.5 re) 2.0))
im_m = fabs(im);
double code(double re, double im_m) {
return (0.5 * re) * 2.0;
}
im_m = abs(im)
real(8) function code(re, im_m)
real(8), intent (in) :: re
real(8), intent (in) :: im_m
code = (0.5d0 * re) * 2.0d0
end function
im_m = Math.abs(im);
public static double code(double re, double im_m) {
return (0.5 * re) * 2.0;
}
im_m = math.fabs(im) def code(re, im_m): return (0.5 * re) * 2.0
im_m = abs(im) function code(re, im_m) return Float64(Float64(0.5 * re) * 2.0) end
im_m = abs(im); function tmp = code(re, im_m) tmp = (0.5 * re) * 2.0; end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(N[(0.5 * re), $MachinePrecision] * 2.0), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
\left(0.5 \cdot re\right) \cdot 2
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites53.4%
Taylor expanded in re around 0
lower-*.f6428.9
Applied rewrites28.9%
herbie shell --seed 2024313
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))