
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
(FPCore (re im) :precision binary64 (* (cosh im) (cos re)))
double code(double re, double im) {
return cosh(im) * cos(re);
}
real(8) function code(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cosh(im) * cos(re)
end function
public static double code(double re, double im) {
return Math.cosh(im) * Math.cos(re);
}
def code(re, im): return math.cosh(im) * math.cos(re)
function code(re, im) return Float64(cosh(im) * cos(re)) end
function tmp = code(re, im) tmp = cosh(im) * cos(re); end
code[re_, im_] := N[(N[Cosh[im], $MachinePrecision] * N[Cos[re], $MachinePrecision]), $MachinePrecision]
\cosh im \cdot \cos re
Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
mult-flip-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
cosh-defN/A
lower-*.f64N/A
lower-cosh.f64100.0%
Applied rewrites100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (cos re))) (t_1 (* t_0 (+ (exp (- im)) (exp im)))))
(if (<= t_1 (- INFINITY))
(* (cosh im) (fma (* re re) -0.5 1.0))
(if (<= t_1 0.9999999801658838) (* t_0 2.0) (* (cosh im) 1.0)))))double code(double re, double im) {
double t_0 = 0.5 * cos(re);
double t_1 = t_0 * (exp(-im) + exp(im));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = cosh(im) * fma((re * re), -0.5, 1.0);
} else if (t_1 <= 0.9999999801658838) {
tmp = t_0 * 2.0;
} else {
tmp = cosh(im) * 1.0;
}
return tmp;
}
function code(re, im) t_0 = Float64(0.5 * cos(re)) t_1 = Float64(t_0 * Float64(exp(Float64(-im)) + exp(im))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(cosh(im) * fma(Float64(re * re), -0.5, 1.0)); elseif (t_1 <= 0.9999999801658838) tmp = Float64(t_0 * 2.0); else tmp = Float64(cosh(im) * 1.0); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[Cosh[im], $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.9999999801658838], N[(t$95$0 * 2.0), $MachinePrecision], N[(N[Cosh[im], $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := 0.5 \cdot \cos re\\
t_1 := t\_0 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\cosh im \cdot \mathsf{fma}\left(re \cdot re, -0.5, 1\right)\\
\mathbf{elif}\;t\_1 \leq 0.9999999801658838:\\
\;\;\;\;t\_0 \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\cosh im \cdot 1\\
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -inf.0Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
mult-flip-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
cosh-defN/A
lower-*.f64N/A
lower-cosh.f64100.0%
Applied rewrites100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6463.5%
Applied rewrites63.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6463.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6463.5%
Applied rewrites63.5%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < 0.99999998016588376Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites51.3%
if 0.99999998016588376 < (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
mult-flip-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
cosh-defN/A
lower-*.f64N/A
lower-cosh.f64100.0%
Applied rewrites100.0%
Taylor expanded in re around 0
Applied rewrites65.3%
(FPCore (re im) :precision binary64 (if (<= (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))) -0.005) (* (cosh im) (fma (* re re) -0.5 1.0)) (* (cosh im) 1.0)))
double code(double re, double im) {
double tmp;
if (((0.5 * cos(re)) * (exp(-im) + exp(im))) <= -0.005) {
tmp = cosh(im) * fma((re * re), -0.5, 1.0);
} else {
tmp = cosh(im) * 1.0;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) <= -0.005) tmp = Float64(cosh(im) * fma(Float64(re * re), -0.5, 1.0)); else tmp = Float64(cosh(im) * 1.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.005], N[(N[Cosh[im], $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[im], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -0.005:\\
\;\;\;\;\cosh im \cdot \mathsf{fma}\left(re \cdot re, -0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im \cdot 1\\
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -0.0050000000000000001Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
mult-flip-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
cosh-defN/A
lower-*.f64N/A
lower-cosh.f64100.0%
Applied rewrites100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6463.5%
Applied rewrites63.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6463.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6463.5%
Applied rewrites63.5%
if -0.0050000000000000001 < (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
mult-flip-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
cosh-defN/A
lower-*.f64N/A
lower-cosh.f64100.0%
Applied rewrites100.0%
Taylor expanded in re around 0
Applied rewrites65.3%
(FPCore (re im) :precision binary64 (if (<= (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))) -0.005) (* 2.0 (fma -0.25 (sqrt (* (* (* re re) re) re)) 0.5)) (* (cosh im) 1.0)))
double code(double re, double im) {
double tmp;
if (((0.5 * cos(re)) * (exp(-im) + exp(im))) <= -0.005) {
tmp = 2.0 * fma(-0.25, sqrt((((re * re) * re) * re)), 0.5);
} else {
tmp = cosh(im) * 1.0;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) <= -0.005) tmp = Float64(2.0 * fma(-0.25, sqrt(Float64(Float64(Float64(re * re) * re) * re)), 0.5)); else tmp = Float64(cosh(im) * 1.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.005], N[(2.0 * N[(-0.25 * N[Sqrt[N[(N[(N[(re * re), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[im], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -0.005:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-0.25, \sqrt{\left(\left(re \cdot re\right) \cdot re\right) \cdot re}, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im \cdot 1\\
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -0.0050000000000000001Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites51.3%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6433.1%
Applied rewrites33.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6433.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6433.1%
lift-pow.f64N/A
unpow2N/A
lower-*.f6433.1%
Applied rewrites33.1%
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
lift-sqrt.f6435.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6435.8%
Applied rewrites35.8%
if -0.0050000000000000001 < (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
mult-flip-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
cosh-defN/A
lower-*.f64N/A
lower-cosh.f64100.0%
Applied rewrites100.0%
Taylor expanded in re around 0
Applied rewrites65.3%
(FPCore (re im) :precision binary64 (if (<= (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))) -0.005) (* 2.0 (fma -0.25 (* re re) 0.0)) (* (cosh im) 1.0)))
double code(double re, double im) {
double tmp;
if (((0.5 * cos(re)) * (exp(-im) + exp(im))) <= -0.005) {
tmp = 2.0 * fma(-0.25, (re * re), 0.0);
} else {
tmp = cosh(im) * 1.0;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) <= -0.005) tmp = Float64(2.0 * fma(-0.25, Float64(re * re), 0.0)); else tmp = Float64(cosh(im) * 1.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.005], N[(2.0 * N[(-0.25 * N[(re * re), $MachinePrecision] + 0.0), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[im], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -0.005:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-0.25, re \cdot re, 0\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im \cdot 1\\
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -0.0050000000000000001Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites51.3%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6433.1%
Applied rewrites33.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6433.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6433.1%
lift-pow.f64N/A
unpow2N/A
lower-*.f6433.1%
Applied rewrites33.1%
Taylor expanded in undef-var around zero
Applied rewrites8.3%
if -0.0050000000000000001 < (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
mult-flip-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
cosh-defN/A
lower-*.f64N/A
lower-cosh.f64100.0%
Applied rewrites100.0%
Taylor expanded in re around 0
Applied rewrites65.3%
(FPCore (re im) :precision binary64 (if (<= (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))) -0.005) (* 2.0 (fma -0.25 (* re re) 0.0)) (* 0.5 2.0)))
double code(double re, double im) {
double tmp;
if (((0.5 * cos(re)) * (exp(-im) + exp(im))) <= -0.005) {
tmp = 2.0 * fma(-0.25, (re * re), 0.0);
} else {
tmp = 0.5 * 2.0;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) <= -0.005) tmp = Float64(2.0 * fma(-0.25, Float64(re * re), 0.0)); else tmp = Float64(0.5 * 2.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.005], N[(2.0 * N[(-0.25 * N[(re * re), $MachinePrecision] + 0.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * 2.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -0.005:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-0.25, re \cdot re, 0\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot 2\\
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -0.0050000000000000001Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites51.3%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6433.1%
Applied rewrites33.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6433.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6433.1%
lift-pow.f64N/A
unpow2N/A
lower-*.f6433.1%
Applied rewrites33.1%
Taylor expanded in undef-var around zero
Applied rewrites8.3%
if -0.0050000000000000001 < (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites51.3%
Taylor expanded in re around 0
Applied rewrites29.0%
(FPCore (re im) :precision binary64 (if (<= (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))) -0.005) (* 2.0 (fma -0.25 (* re re) 0.5)) (* 0.5 2.0)))
double code(double re, double im) {
double tmp;
if (((0.5 * cos(re)) * (exp(-im) + exp(im))) <= -0.005) {
tmp = 2.0 * fma(-0.25, (re * re), 0.5);
} else {
tmp = 0.5 * 2.0;
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) <= -0.005) tmp = Float64(2.0 * fma(-0.25, Float64(re * re), 0.5)); else tmp = Float64(0.5 * 2.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.005], N[(2.0 * N[(-0.25 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], N[(0.5 * 2.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -0.005:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-0.25, re \cdot re, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot 2\\
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -0.0050000000000000001Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites51.3%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6433.1%
Applied rewrites33.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6433.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6433.1%
lift-pow.f64N/A
unpow2N/A
lower-*.f6433.1%
Applied rewrites33.1%
if -0.0050000000000000001 < (*.f64 (*.f64 #s(literal 1/2 binary64) (cos.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites51.3%
Taylor expanded in re around 0
Applied rewrites29.0%
(FPCore (re im) :precision binary64 (* 0.5 2.0))
double code(double re, double im) {
return 0.5 * 2.0;
}
real(8) function code(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * 2.0d0
end function
public static double code(double re, double im) {
return 0.5 * 2.0;
}
def code(re, im): return 0.5 * 2.0
function code(re, im) return Float64(0.5 * 2.0) end
function tmp = code(re, im) tmp = 0.5 * 2.0; end
code[re_, im_] := N[(0.5 * 2.0), $MachinePrecision]
0.5 \cdot 2
Initial program 100.0%
Taylor expanded in im around 0
Applied rewrites51.3%
Taylor expanded in re around 0
Applied rewrites29.0%
herbie shell --seed 2025313 -o setup:search
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))