
(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)
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]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 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)
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]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
(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)
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]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Initial program 100.0%
(FPCore (re im)
:precision binary64
(if (<= im 0.0007)
(* (cos re) (+ (* 0.5 (pow im 2.0)) 1.0))
(if (<= im 1.2e+77)
(* 0.5 (+ (exp (- im)) (exp im)))
(* 0.041666666666666664 (* (cos re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 0.0007) {
tmp = cos(re) * ((0.5 * pow(im, 2.0)) + 1.0);
} else if (im <= 1.2e+77) {
tmp = 0.5 * (exp(-im) + exp(im));
} else {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.0007d0) then
tmp = cos(re) * ((0.5d0 * (im ** 2.0d0)) + 1.0d0)
else if (im <= 1.2d+77) then
tmp = 0.5d0 * (exp(-im) + exp(im))
else
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.0007) {
tmp = Math.cos(re) * ((0.5 * Math.pow(im, 2.0)) + 1.0);
} else if (im <= 1.2e+77) {
tmp = 0.5 * (Math.exp(-im) + Math.exp(im));
} else {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.0007: tmp = math.cos(re) * ((0.5 * math.pow(im, 2.0)) + 1.0) elif im <= 1.2e+77: tmp = 0.5 * (math.exp(-im) + math.exp(im)) else: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.0007) tmp = Float64(cos(re) * Float64(Float64(0.5 * (im ^ 2.0)) + 1.0)); elseif (im <= 1.2e+77) tmp = Float64(0.5 * Float64(exp(Float64(-im)) + exp(im))); else tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.0007) tmp = cos(re) * ((0.5 * (im ^ 2.0)) + 1.0); elseif (im <= 1.2e+77) tmp = 0.5 * (exp(-im) + exp(im)); else tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.0007], N[(N[Cos[re], $MachinePrecision] * N[(N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.2e+77], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.0007:\\
\;\;\;\;\cos re \cdot \left(0.5 \cdot {im}^{2} + 1\right)\\
\mathbf{elif}\;im \leq 1.2 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 6.99999999999999993e-4Initial program 100.0%
Taylor expanded in im around 0 81.9%
associate-*r*81.9%
distribute-rgt1-in81.9%
Simplified81.9%
if 6.99999999999999993e-4 < im < 1.1999999999999999e77Initial program 100.0%
Taylor expanded in re around 0 62.5%
if 1.1999999999999999e77 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
fma-define100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification84.2%
(FPCore (re im)
:precision binary64
(if (<= im 0.00026)
(cos re)
(if (<= im 1.2e+77)
(* 0.5 (+ (exp (- im)) (exp im)))
(* 0.041666666666666664 (* (cos re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 0.00026) {
tmp = cos(re);
} else if (im <= 1.2e+77) {
tmp = 0.5 * (exp(-im) + exp(im));
} else {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.00026d0) then
tmp = cos(re)
else if (im <= 1.2d+77) then
tmp = 0.5d0 * (exp(-im) + exp(im))
else
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.00026) {
tmp = Math.cos(re);
} else if (im <= 1.2e+77) {
tmp = 0.5 * (Math.exp(-im) + Math.exp(im));
} else {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.00026: tmp = math.cos(re) elif im <= 1.2e+77: tmp = 0.5 * (math.exp(-im) + math.exp(im)) else: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.00026) tmp = cos(re); elseif (im <= 1.2e+77) tmp = Float64(0.5 * Float64(exp(Float64(-im)) + exp(im))); else tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.00026) tmp = cos(re); elseif (im <= 1.2e+77) tmp = 0.5 * (exp(-im) + exp(im)); else tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.00026], N[Cos[re], $MachinePrecision], If[LessEqual[im, 1.2e+77], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.00026:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 1.2 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 2.59999999999999977e-4Initial program 100.0%
Taylor expanded in im around 0 64.4%
if 2.59999999999999977e-4 < im < 1.1999999999999999e77Initial program 100.0%
Taylor expanded in re around 0 64.7%
if 1.1999999999999999e77 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
fma-define100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification71.4%
(FPCore (re im)
:precision binary64
(if (<= im 8500000000.0)
(cos re)
(if (<= im 6.6e+76)
(+ 0.25 (pow re -6.0))
(* 0.041666666666666664 (* (cos re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 8500000000.0) {
tmp = cos(re);
} else if (im <= 6.6e+76) {
tmp = 0.25 + pow(re, -6.0);
} else {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 8500000000.0d0) then
tmp = cos(re)
else if (im <= 6.6d+76) then
tmp = 0.25d0 + (re ** (-6.0d0))
else
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 8500000000.0) {
tmp = Math.cos(re);
} else if (im <= 6.6e+76) {
tmp = 0.25 + Math.pow(re, -6.0);
} else {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 8500000000.0: tmp = math.cos(re) elif im <= 6.6e+76: tmp = 0.25 + math.pow(re, -6.0) else: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 8500000000.0) tmp = cos(re); elseif (im <= 6.6e+76) tmp = Float64(0.25 + (re ^ -6.0)); else tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 8500000000.0) tmp = cos(re); elseif (im <= 6.6e+76) tmp = 0.25 + (re ^ -6.0); else tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 8500000000.0], N[Cos[re], $MachinePrecision], If[LessEqual[im, 6.6e+76], N[(0.25 + N[Power[re, -6.0], $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 8500000000:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 6.6 \cdot 10^{+76}:\\
\;\;\;\;0.25 + {re}^{-6}\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 8.5e9Initial program 100.0%
Taylor expanded in im around 0 63.8%
if 8.5e9 < im < 6.6000000000000001e76Initial program 100.0%
Applied egg-rr2.1%
Taylor expanded in re around 0 2.0%
*-commutative2.0%
Simplified2.0%
Applied egg-rr30.8%
if 6.6000000000000001e76 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
fma-define100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification69.1%
(FPCore (re im)
:precision binary64
(if (<= im 8500000000.0)
(cos re)
(if (<= im 6.6e+76)
(+ 0.25 (pow re -6.0))
(* 0.041666666666666664 (pow im 4.0)))))
double code(double re, double im) {
double tmp;
if (im <= 8500000000.0) {
tmp = cos(re);
} else if (im <= 6.6e+76) {
tmp = 0.25 + pow(re, -6.0);
} else {
tmp = 0.041666666666666664 * pow(im, 4.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 8500000000.0d0) then
tmp = cos(re)
else if (im <= 6.6d+76) then
tmp = 0.25d0 + (re ** (-6.0d0))
else
tmp = 0.041666666666666664d0 * (im ** 4.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 8500000000.0) {
tmp = Math.cos(re);
} else if (im <= 6.6e+76) {
tmp = 0.25 + Math.pow(re, -6.0);
} else {
tmp = 0.041666666666666664 * Math.pow(im, 4.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 8500000000.0: tmp = math.cos(re) elif im <= 6.6e+76: tmp = 0.25 + math.pow(re, -6.0) else: tmp = 0.041666666666666664 * math.pow(im, 4.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 8500000000.0) tmp = cos(re); elseif (im <= 6.6e+76) tmp = Float64(0.25 + (re ^ -6.0)); else tmp = Float64(0.041666666666666664 * (im ^ 4.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 8500000000.0) tmp = cos(re); elseif (im <= 6.6e+76) tmp = 0.25 + (re ^ -6.0); else tmp = 0.041666666666666664 * (im ^ 4.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 8500000000.0], N[Cos[re], $MachinePrecision], If[LessEqual[im, 6.6e+76], N[(0.25 + N[Power[re, -6.0], $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 8500000000:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 6.6 \cdot 10^{+76}:\\
\;\;\;\;0.25 + {re}^{-6}\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot {im}^{4}\\
\end{array}
\end{array}
if im < 8.5e9Initial program 100.0%
Taylor expanded in im around 0 63.8%
if 8.5e9 < im < 6.6000000000000001e76Initial program 100.0%
Applied egg-rr2.1%
Taylor expanded in re around 0 2.0%
*-commutative2.0%
Simplified2.0%
Applied egg-rr30.8%
if 6.6000000000000001e76 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
fma-define100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Taylor expanded in re around 0 64.0%
(FPCore (re im) :precision binary64 (if (<= im 2e+67) (cos re) (* 0.041666666666666664 (pow im 4.0))))
double code(double re, double im) {
double tmp;
if (im <= 2e+67) {
tmp = cos(re);
} else {
tmp = 0.041666666666666664 * pow(im, 4.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2d+67) then
tmp = cos(re)
else
tmp = 0.041666666666666664d0 * (im ** 4.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2e+67) {
tmp = Math.cos(re);
} else {
tmp = 0.041666666666666664 * Math.pow(im, 4.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2e+67: tmp = math.cos(re) else: tmp = 0.041666666666666664 * math.pow(im, 4.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 2e+67) tmp = cos(re); else tmp = Float64(0.041666666666666664 * (im ^ 4.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2e+67) tmp = cos(re); else tmp = 0.041666666666666664 * (im ^ 4.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2e+67], N[Cos[re], $MachinePrecision], N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2 \cdot 10^{+67}:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot {im}^{4}\\
\end{array}
\end{array}
if im < 1.99999999999999997e67Initial program 100.0%
Taylor expanded in im around 0 60.5%
if 1.99999999999999997e67 < im Initial program 100.0%
Taylor expanded in im around 0 94.9%
+-commutative94.9%
fma-define94.9%
associate-*r*94.9%
distribute-rgt-out94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in im around inf 94.9%
Taylor expanded in re around 0 60.8%
(FPCore (re im) :precision binary64 (cos re))
double code(double re, double im) {
return cos(re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cos(re)
end function
public static double code(double re, double im) {
return Math.cos(re);
}
def code(re, im): return math.cos(re)
function code(re, im) return cos(re) end
function tmp = code(re, im) tmp = cos(re); end
code[re_, im_] := N[Cos[re], $MachinePrecision]
\begin{array}{l}
\\
\cos re
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 48.6%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Applied egg-rr28.0%
+-inverses28.0%
+-rgt-identity28.0%
*-inverses28.0%
Simplified28.0%
(FPCore (re im) :precision binary64 0.5)
double code(double re, double im) {
return 0.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0
end function
public static double code(double re, double im) {
return 0.5;
}
def code(re, im): return 0.5
function code(re, im) return 0.5 end
function tmp = code(re, im) tmp = 0.5; end
code[re_, im_] := 0.5
\begin{array}{l}
\\
0.5
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 84.6%
+-commutative84.6%
fma-define84.6%
associate-*r*84.6%
distribute-rgt-out84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in im around inf 39.1%
Applied egg-rr8.4%
(FPCore (re im) :precision binary64 0.25)
double code(double re, double im) {
return 0.25;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.25d0
end function
public static double code(double re, double im) {
return 0.25;
}
def code(re, im): return 0.25
function code(re, im) return 0.25 end
function tmp = code(re, im) tmp = 0.25; end
code[re_, im_] := 0.25
\begin{array}{l}
\\
0.25
\end{array}
Initial program 100.0%
Applied egg-rr7.8%
Taylor expanded in re around 0 7.9%
(FPCore (re im) :precision binary64 0.125)
double code(double re, double im) {
return 0.125;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.125d0
end function
public static double code(double re, double im) {
return 0.125;
}
def code(re, im): return 0.125
function code(re, im) return 0.125 end
function tmp = code(re, im) tmp = 0.125; end
code[re_, im_] := 0.125
\begin{array}{l}
\\
0.125
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 84.6%
+-commutative84.6%
fma-define84.6%
associate-*r*84.6%
distribute-rgt-out84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in im around inf 39.1%
Applied egg-rr7.6%
(FPCore (re im) :precision binary64 0.041666666666666664)
double code(double re, double im) {
return 0.041666666666666664;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.041666666666666664d0
end function
public static double code(double re, double im) {
return 0.041666666666666664;
}
def code(re, im): return 0.041666666666666664
function code(re, im) return 0.041666666666666664 end
function tmp = code(re, im) tmp = 0.041666666666666664; end
code[re_, im_] := 0.041666666666666664
\begin{array}{l}
\\
0.041666666666666664
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 84.6%
+-commutative84.6%
fma-define84.6%
associate-*r*84.6%
distribute-rgt-out84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in im around inf 39.1%
Applied egg-rr7.2%
(FPCore (re im) :precision binary64 0.015625)
double code(double re, double im) {
return 0.015625;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.015625d0
end function
public static double code(double re, double im) {
return 0.015625;
}
def code(re, im): return 0.015625
function code(re, im) return 0.015625 end
function tmp = code(re, im) tmp = 0.015625; end
code[re_, im_] := 0.015625
\begin{array}{l}
\\
0.015625
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 84.6%
+-commutative84.6%
fma-define84.6%
associate-*r*84.6%
distribute-rgt-out84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in im around inf 39.1%
Applied egg-rr7.0%
(FPCore (re im) :precision binary64 -1.0)
double code(double re, double im) {
return -1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -1.0d0
end function
public static double code(double re, double im) {
return -1.0;
}
def code(re, im): return -1.0
function code(re, im) return -1.0 end
function tmp = code(re, im) tmp = -1.0; end
code[re_, im_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 84.6%
+-commutative84.6%
fma-define84.6%
associate-*r*84.6%
distribute-rgt-out84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in im around inf 39.1%
Applied egg-rr3.5%
(FPCore (re im) :precision binary64 -4.0)
double code(double re, double im) {
return -4.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -4.0d0
end function
public static double code(double re, double im) {
return -4.0;
}
def code(re, im): return -4.0
function code(re, im) return -4.0 end
function tmp = code(re, im) tmp = -4.0; end
code[re_, im_] := -4.0
\begin{array}{l}
\\
-4
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 84.6%
+-commutative84.6%
fma-define84.6%
associate-*r*84.6%
distribute-rgt-out84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in im around inf 39.1%
Applied egg-rr3.1%
herbie shell --seed 2024089
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))