
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
Initial program 100.0%
(FPCore (re im) :precision binary64 (if (<= (exp re) 0.99999995) (exp re) (if (<= (exp re) 1.0) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.99999995) {
tmp = exp(re);
} else if (exp(re) <= 1.0) {
tmp = cos(im) * (re + 1.0);
} else {
tmp = exp(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (exp(re) <= 0.99999995d0) then
tmp = exp(re)
else if (exp(re) <= 1.0d0) then
tmp = cos(im) * (re + 1.0d0)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.exp(re) <= 0.99999995) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 1.0) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.99999995: tmp = math.exp(re) elif math.exp(re) <= 1.0: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.99999995) tmp = exp(re); elseif (exp(re) <= 1.0) tmp = Float64(cos(im) * Float64(re + 1.0)); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.99999995) tmp = exp(re); elseif (exp(re) <= 1.0) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.99999995], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.99999995:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.999999949999999971 or 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6488.0%
Simplified88.0%
if 0.999999949999999971 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Final simplification94.1%
(FPCore (re im) :precision binary64 (if (<= (exp re) 0.99999995) (exp re) (if (<= (exp re) 1.0) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.99999995) {
tmp = exp(re);
} else if (exp(re) <= 1.0) {
tmp = cos(im);
} else {
tmp = exp(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (exp(re) <= 0.99999995d0) then
tmp = exp(re)
else if (exp(re) <= 1.0d0) then
tmp = cos(im)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.exp(re) <= 0.99999995) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 1.0) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.99999995: tmp = math.exp(re) elif math.exp(re) <= 1.0: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.99999995) tmp = exp(re); elseif (exp(re) <= 1.0) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.99999995) tmp = exp(re); elseif (exp(re) <= 1.0) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.99999995], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.99999995:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.999999949999999971 or 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6488.0%
Simplified88.0%
if 0.999999949999999971 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6499.7%
Simplified99.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 0.5 (* re 0.16666666666666666))) (t_1 (* re t_0)))
(if (<= re -75000000.0)
(* (* im im) (* (* im im) 0.041666666666666664))
(if (<= re 1.2e-20)
(cos im)
(if (<= re 3.6e+77)
(*
(+ 1.0 (/ (* re (- 1.0 (* t_0 (* re t_1)))) (- 1.0 t_1)))
(+ 1.0 (* im (* im -0.5))))
(+
(+ re 1.0)
(/
(* re (* re (+ 0.25 (* (* re re) -0.027777777777777776))))
(+ 0.5 (* re -0.16666666666666666)))))))))
double code(double re, double im) {
double t_0 = 0.5 + (re * 0.16666666666666666);
double t_1 = re * t_0;
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else if (re <= 1.2e-20) {
tmp = cos(im);
} else if (re <= 3.6e+77) {
tmp = (1.0 + ((re * (1.0 - (t_0 * (re * t_1)))) / (1.0 - t_1))) * (1.0 + (im * (im * -0.5)));
} else {
tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 + (re * 0.16666666666666666d0)
t_1 = re * t_0
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else if (re <= 1.2d-20) then
tmp = cos(im)
else if (re <= 3.6d+77) then
tmp = (1.0d0 + ((re * (1.0d0 - (t_0 * (re * t_1)))) / (1.0d0 - t_1))) * (1.0d0 + (im * (im * (-0.5d0))))
else
tmp = (re + 1.0d0) + ((re * (re * (0.25d0 + ((re * re) * (-0.027777777777777776d0))))) / (0.5d0 + (re * (-0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 + (re * 0.16666666666666666);
double t_1 = re * t_0;
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else if (re <= 1.2e-20) {
tmp = Math.cos(im);
} else if (re <= 3.6e+77) {
tmp = (1.0 + ((re * (1.0 - (t_0 * (re * t_1)))) / (1.0 - t_1))) * (1.0 + (im * (im * -0.5)));
} else {
tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666)));
}
return tmp;
}
def code(re, im): t_0 = 0.5 + (re * 0.16666666666666666) t_1 = re * t_0 tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) elif re <= 1.2e-20: tmp = math.cos(im) elif re <= 3.6e+77: tmp = (1.0 + ((re * (1.0 - (t_0 * (re * t_1)))) / (1.0 - t_1))) * (1.0 + (im * (im * -0.5))) else: tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666))) return tmp
function code(re, im) t_0 = Float64(0.5 + Float64(re * 0.16666666666666666)) t_1 = Float64(re * t_0) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); elseif (re <= 1.2e-20) tmp = cos(im); elseif (re <= 3.6e+77) tmp = Float64(Float64(1.0 + Float64(Float64(re * Float64(1.0 - Float64(t_0 * Float64(re * t_1)))) / Float64(1.0 - t_1))) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); else tmp = Float64(Float64(re + 1.0) + Float64(Float64(re * Float64(re * Float64(0.25 + Float64(Float64(re * re) * -0.027777777777777776)))) / Float64(0.5 + Float64(re * -0.16666666666666666)))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 + (re * 0.16666666666666666); t_1 = re * t_0; tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); elseif (re <= 1.2e-20) tmp = cos(im); elseif (re <= 3.6e+77) tmp = (1.0 + ((re * (1.0 - (t_0 * (re * t_1)))) / (1.0 - t_1))) * (1.0 + (im * (im * -0.5))); else tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * t$95$0), $MachinePrecision]}, If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.2e-20], N[Cos[im], $MachinePrecision], If[LessEqual[re, 3.6e+77], N[(N[(1.0 + N[(N[(re * N[(1.0 - N[(t$95$0 * N[(re * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re + 1.0), $MachinePrecision] + N[(N[(re * N[(re * N[(0.25 + N[(N[(re * re), $MachinePrecision] * -0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.5 + N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 + re \cdot 0.16666666666666666\\
t_1 := re \cdot t\_0\\
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{elif}\;re \leq 1.2 \cdot 10^{-20}:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 3.6 \cdot 10^{+77}:\\
\;\;\;\;\left(1 + \frac{re \cdot \left(1 - t\_0 \cdot \left(re \cdot t\_1\right)\right)}{1 - t\_1}\right) \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re + 1\right) + \frac{re \cdot \left(re \cdot \left(0.25 + \left(re \cdot re\right) \cdot -0.027777777777777776\right)\right)}{0.5 + re \cdot -0.16666666666666666}\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re < 1.19999999999999996e-20Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6496.9%
Simplified96.9%
if 1.19999999999999996e-20 < re < 3.5999999999999998e77Initial program 100.0%
Taylor expanded in im around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6487.5%
Simplified87.5%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6417.8%
Simplified17.8%
*-commutativeN/A
flip-+N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr47.3%
if 3.5999999999999998e77 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6474.5%
Simplified74.5%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6465.5%
Simplified65.5%
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6465.5%
Applied egg-rr65.5%
*-commutativeN/A
flip-+N/A
metadata-evalN/A
swap-sqrN/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr74.5%
Final simplification76.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re re))))
(if (<= re -75000000.0)
(* (* im im) (* (* im im) 0.041666666666666664))
(if (<= re 2.2e+107)
(+
(+ re 1.0)
(/
(* (* re re) (+ 0.125 (* t_0 0.004629629629629629)))
(+
0.25
(* (* re 0.16666666666666666) (- (* re 0.16666666666666666) 0.5)))))
(* t_0 (+ 0.16666666666666666 (* (* im im) -0.08333333333333333)))))))
double code(double re, double im) {
double t_0 = re * (re * re);
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else if (re <= 2.2e+107) {
tmp = (re + 1.0) + (((re * re) * (0.125 + (t_0 * 0.004629629629629629))) / (0.25 + ((re * 0.16666666666666666) * ((re * 0.16666666666666666) - 0.5))));
} else {
tmp = t_0 * (0.16666666666666666 + ((im * im) * -0.08333333333333333));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = re * (re * re)
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else if (re <= 2.2d+107) then
tmp = (re + 1.0d0) + (((re * re) * (0.125d0 + (t_0 * 0.004629629629629629d0))) / (0.25d0 + ((re * 0.16666666666666666d0) * ((re * 0.16666666666666666d0) - 0.5d0))))
else
tmp = t_0 * (0.16666666666666666d0 + ((im * im) * (-0.08333333333333333d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * re);
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else if (re <= 2.2e+107) {
tmp = (re + 1.0) + (((re * re) * (0.125 + (t_0 * 0.004629629629629629))) / (0.25 + ((re * 0.16666666666666666) * ((re * 0.16666666666666666) - 0.5))));
} else {
tmp = t_0 * (0.16666666666666666 + ((im * im) * -0.08333333333333333));
}
return tmp;
}
def code(re, im): t_0 = re * (re * re) tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) elif re <= 2.2e+107: tmp = (re + 1.0) + (((re * re) * (0.125 + (t_0 * 0.004629629629629629))) / (0.25 + ((re * 0.16666666666666666) * ((re * 0.16666666666666666) - 0.5)))) else: tmp = t_0 * (0.16666666666666666 + ((im * im) * -0.08333333333333333)) return tmp
function code(re, im) t_0 = Float64(re * Float64(re * re)) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); elseif (re <= 2.2e+107) tmp = Float64(Float64(re + 1.0) + Float64(Float64(Float64(re * re) * Float64(0.125 + Float64(t_0 * 0.004629629629629629))) / Float64(0.25 + Float64(Float64(re * 0.16666666666666666) * Float64(Float64(re * 0.16666666666666666) - 0.5))))); else tmp = Float64(t_0 * Float64(0.16666666666666666 + Float64(Float64(im * im) * -0.08333333333333333))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * re); tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); elseif (re <= 2.2e+107) tmp = (re + 1.0) + (((re * re) * (0.125 + (t_0 * 0.004629629629629629))) / (0.25 + ((re * 0.16666666666666666) * ((re * 0.16666666666666666) - 0.5)))); else tmp = t_0 * (0.16666666666666666 + ((im * im) * -0.08333333333333333)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.2e+107], N[(N[(re + 1.0), $MachinePrecision] + N[(N[(N[(re * re), $MachinePrecision] * N[(0.125 + N[(t$95$0 * 0.004629629629629629), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.25 + N[(N[(re * 0.16666666666666666), $MachinePrecision] * N[(N[(re * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(0.16666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{elif}\;re \leq 2.2 \cdot 10^{+107}:\\
\;\;\;\;\left(re + 1\right) + \frac{\left(re \cdot re\right) \cdot \left(0.125 + t\_0 \cdot 0.004629629629629629\right)}{0.25 + \left(re \cdot 0.16666666666666666\right) \cdot \left(re \cdot 0.16666666666666666 - 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re < 2.2e107Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6456.5%
Simplified56.5%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6444.9%
Simplified44.9%
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6444.9%
Applied egg-rr44.9%
associate-*r*N/A
flip3-+N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow-prod-downN/A
*-lowering-*.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-rgt-out--N/A
*-lowering-*.f64N/A
Applied egg-rr50.3%
if 2.2e107 < re Initial program 100.0%
Taylor expanded in im around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6473.3%
Simplified73.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6473.3%
Simplified73.3%
Taylor expanded in re around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
metadata-eval73.3%
Simplified73.3%
Final simplification51.7%
(FPCore (re im)
:precision binary64
(if (<= re -75000000.0)
(* (* im im) (* (* im im) 0.041666666666666664))
(+
(+ re 1.0)
(/
(* re (* re (+ 0.25 (* (* re re) -0.027777777777777776))))
(+ 0.5 (* re -0.16666666666666666))))))
double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else
tmp = (re + 1.0d0) + ((re * (re * (0.25d0 + ((re * re) * (-0.027777777777777776d0))))) / (0.5d0 + (re * (-0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) else: tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666))) return tmp
function code(re, im) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); else tmp = Float64(Float64(re + 1.0) + Float64(Float64(re * Float64(re * Float64(0.25 + Float64(Float64(re * re) * -0.027777777777777776)))) / Float64(0.5 + Float64(re * -0.16666666666666666)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); else tmp = (re + 1.0) + ((re * (re * (0.25 + ((re * re) * -0.027777777777777776)))) / (0.5 + (re * -0.16666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(N[(re + 1.0), $MachinePrecision] + N[(N[(re * N[(re * N[(0.25 + N[(N[(re * re), $MachinePrecision] * -0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.5 + N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re + 1\right) + \frac{re \cdot \left(re \cdot \left(0.25 + \left(re \cdot re\right) \cdot -0.027777777777777776\right)\right)}{0.5 + re \cdot -0.16666666666666666}\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6459.8%
Simplified59.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6450.8%
Simplified50.8%
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6450.8%
Applied egg-rr50.8%
*-commutativeN/A
flip-+N/A
metadata-evalN/A
swap-sqrN/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr53.1%
Final simplification49.8%
(FPCore (re im)
:precision binary64
(if (<= re -75000000.0)
(* (* im im) (* (* im im) 0.041666666666666664))
(if (<= re 1.82)
(+ re 1.0)
(* (+ 0.5 (* re 0.16666666666666666)) (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else if (re <= 1.82) {
tmp = re + 1.0;
} else {
tmp = (0.5 + (re * 0.16666666666666666)) * (re * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else if (re <= 1.82d0) then
tmp = re + 1.0d0
else
tmp = (0.5d0 + (re * 0.16666666666666666d0)) * (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else if (re <= 1.82) {
tmp = re + 1.0;
} else {
tmp = (0.5 + (re * 0.16666666666666666)) * (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) elif re <= 1.82: tmp = re + 1.0 else: tmp = (0.5 + (re * 0.16666666666666666)) * (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); elseif (re <= 1.82) tmp = Float64(re + 1.0); else tmp = Float64(Float64(0.5 + Float64(re * 0.16666666666666666)) * Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); elseif (re <= 1.82) tmp = re + 1.0; else tmp = (0.5 + (re * 0.16666666666666666)) * (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.82], N[(re + 1.0), $MachinePrecision], N[(N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{elif}\;re \leq 1.82:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re < 1.82000000000000006Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6452.0%
Simplified52.0%
Taylor expanded in re around 0
+-lowering-+.f6449.3%
Simplified49.3%
if 1.82000000000000006 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.6%
Simplified76.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.0%
Simplified53.0%
Taylor expanded in re around inf
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.0%
Simplified53.0%
Final simplification47.8%
(FPCore (re im) :precision binary64 (if (<= re -75000000.0) (* (* im im) (* (* im im) 0.041666666666666664)) (+ (* re (* re (+ 0.5 (* re 0.16666666666666666)))) (+ re 1.0))))
double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = (re * (re * (0.5 + (re * 0.16666666666666666)))) + (re + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else
tmp = (re * (re * (0.5d0 + (re * 0.16666666666666666d0)))) + (re + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = (re * (re * (0.5 + (re * 0.16666666666666666)))) + (re + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) else: tmp = (re * (re * (0.5 + (re * 0.16666666666666666)))) + (re + 1.0) return tmp
function code(re, im) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); else tmp = Float64(Float64(re * Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))) + Float64(re + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); else tmp = (re * (re * (0.5 + (re * 0.16666666666666666)))) + (re + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right) + \left(re + 1\right)\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6459.8%
Simplified59.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6450.8%
Simplified50.8%
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6450.8%
Applied egg-rr50.8%
Final simplification48.0%
(FPCore (re im) :precision binary64 (if (<= re -75000000.0) (* (* im im) (* (* im im) 0.041666666666666664)) (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else
tmp = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) else: tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) return tmp
function code(re, im) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); else tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6459.8%
Simplified59.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6450.8%
Simplified50.8%
(FPCore (re im) :precision binary64 (if (<= re -75000000.0) (* (* im im) (* (* im im) 0.041666666666666664)) (if (<= re 2.8) (+ re 1.0) (* re (* 0.16666666666666666 (* re re))))))
double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else if (re <= 2.8) {
tmp = re + 1.0;
} else {
tmp = re * (0.16666666666666666 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else if (re <= 2.8d0) then
tmp = re + 1.0d0
else
tmp = re * (0.16666666666666666d0 * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else if (re <= 2.8) {
tmp = re + 1.0;
} else {
tmp = re * (0.16666666666666666 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) elif re <= 2.8: tmp = re + 1.0 else: tmp = re * (0.16666666666666666 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); elseif (re <= 2.8) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(0.16666666666666666 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); elseif (re <= 2.8) tmp = re + 1.0; else tmp = re * (0.16666666666666666 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.8], N[(re + 1.0), $MachinePrecision], N[(re * N[(0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{elif}\;re \leq 2.8:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re < 2.7999999999999998Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6452.0%
Simplified52.0%
Taylor expanded in re around 0
+-lowering-+.f6449.3%
Simplified49.3%
if 2.7999999999999998 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.6%
Simplified76.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.0%
Simplified53.0%
Taylor expanded in re around inf
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.0%
Simplified53.0%
Final simplification47.8%
(FPCore (re im) :precision binary64 (if (<= re -75000000.0) (* (* im im) (* (* im im) 0.041666666666666664)) (+ 1.0 (* re (+ 1.0 (* re (* re 0.16666666666666666)))))))
double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = 1.0 + (re * (1.0 + (re * (re * 0.16666666666666666))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else
tmp = 1.0d0 + (re * (1.0d0 + (re * (re * 0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = 1.0 + (re * (1.0 + (re * (re * 0.16666666666666666))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) else: tmp = 1.0 + (re * (1.0 + (re * (re * 0.16666666666666666)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(re * 0.16666666666666666))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); else tmp = 1.0 + (re * (1.0 + (re * (re * 0.16666666666666666)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6459.8%
Simplified59.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6450.8%
Simplified50.8%
Taylor expanded in re around inf
*-commutativeN/A
*-lowering-*.f6450.5%
Simplified50.5%
(FPCore (re im) :precision binary64 (if (<= re -75000000.0) (* (* im im) (* (* im im) 0.041666666666666664)) (+ 1.0 (* re (+ 1.0 (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-75000000.0d0)) then
tmp = (im * im) * ((im * im) * 0.041666666666666664d0)
else
tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -75000000.0) {
tmp = (im * im) * ((im * im) * 0.041666666666666664);
} else {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -75000000.0: tmp = (im * im) * ((im * im) * 0.041666666666666664) else: tmp = 1.0 + (re * (1.0 + (re * 0.5))) return tmp
function code(re, im) tmp = 0.0 if (re <= -75000000.0) tmp = Float64(Float64(im * im) * Float64(Float64(im * im) * 0.041666666666666664)); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -75000000.0) tmp = (im * im) * ((im * im) * 0.041666666666666664); else tmp = 1.0 + (re * (1.0 + (re * 0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -75000000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -75000000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -7.5e7Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
if -7.5e7 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6459.8%
Simplified59.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6449.2%
Simplified49.2%
Final simplification46.8%
(FPCore (re im) :precision binary64 (if (<= re 2.8) (+ re 1.0) (* re (* 0.16666666666666666 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 2.8) {
tmp = re + 1.0;
} else {
tmp = re * (0.16666666666666666 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.8d0) then
tmp = re + 1.0d0
else
tmp = re * (0.16666666666666666d0 * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.8) {
tmp = re + 1.0;
} else {
tmp = re * (0.16666666666666666 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.8: tmp = re + 1.0 else: tmp = re * (0.16666666666666666 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.8) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(0.16666666666666666 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.8) tmp = re + 1.0; else tmp = re * (0.16666666666666666 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.8], N[(re + 1.0), $MachinePrecision], N[(re * N[(0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.8:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 2.7999999999999998Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6465.7%
Simplified65.7%
Taylor expanded in re around 0
+-lowering-+.f6435.8%
Simplified35.8%
if 2.7999999999999998 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.6%
Simplified76.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.0%
Simplified53.0%
Taylor expanded in re around inf
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.0%
Simplified53.0%
Final simplification40.1%
(FPCore (re im) :precision binary64 (if (<= re 2.3) (+ re 1.0) (* re (* re 0.5))))
double code(double re, double im) {
double tmp;
if (re <= 2.3) {
tmp = re + 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.3d0) then
tmp = re + 1.0d0
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.3) {
tmp = re + 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.3: tmp = re + 1.0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.3) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.3) tmp = re + 1.0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.3], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.3:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 2.2999999999999998Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6465.7%
Simplified65.7%
Taylor expanded in re around 0
+-lowering-+.f6435.8%
Simplified35.8%
if 2.2999999999999998 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.6%
Simplified76.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6448.3%
Simplified48.3%
Taylor expanded in re around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6448.3%
Simplified48.3%
Final simplification39.0%
(FPCore (re im) :precision binary64 (+ re 1.0))
double code(double re, double im) {
return re + 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re + 1.0d0
end function
public static double code(double re, double im) {
return re + 1.0;
}
def code(re, im): return re + 1.0
function code(re, im) return Float64(re + 1.0) end
function tmp = code(re, im) tmp = re + 1.0; end
code[re_, im_] := N[(re + 1.0), $MachinePrecision]
\begin{array}{l}
\\
re + 1
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6468.4%
Simplified68.4%
Taylor expanded in re around 0
+-lowering-+.f6428.0%
Simplified28.0%
Final simplification28.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 re around 0
cos-lowering-cos.f6453.0%
Simplified53.0%
Taylor expanded in im around 0
Simplified27.3%
herbie shell --seed 2024155
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))