
(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 18 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.99999999999) (exp re) (if (<= (exp re) 1.0) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.99999999999) {
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.99999999999d0) 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.99999999999) {
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.99999999999: 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.99999999999) 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.99999999999) 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.99999999999], 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.99999999999:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.99999999999 or 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6489.5%
Simplified89.5%
if 0.99999999999 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6499.9%
Simplified99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (+ 0.5 (* re 0.16666666666666666))))
(t_1 (* re (+ 1.0 t_0)))
(t_2 (* re t_0)))
(if (<= re -0.105)
(exp re)
(if (<= re 4.4e+51)
(/
(* (cos im) (+ 1.0 (* t_1 (* t_1 t_1))))
(+ 1.0 (* t_1 (+ t_1 -1.0))))
(if (<= re 1e+103)
(+ 1.0 (/ (- (* re re) (* t_2 t_2)) (- re t_2)))
(* (cos im) (+ 1.0 t_1)))))))
double code(double re, double im) {
double t_0 = re * (0.5 + (re * 0.16666666666666666));
double t_1 = re * (1.0 + t_0);
double t_2 = re * t_0;
double tmp;
if (re <= -0.105) {
tmp = exp(re);
} else if (re <= 4.4e+51) {
tmp = (cos(im) * (1.0 + (t_1 * (t_1 * t_1)))) / (1.0 + (t_1 * (t_1 + -1.0)));
} else if (re <= 1e+103) {
tmp = 1.0 + (((re * re) - (t_2 * t_2)) / (re - t_2));
} else {
tmp = cos(im) * (1.0 + t_1);
}
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) :: t_2
real(8) :: tmp
t_0 = re * (0.5d0 + (re * 0.16666666666666666d0))
t_1 = re * (1.0d0 + t_0)
t_2 = re * t_0
if (re <= (-0.105d0)) then
tmp = exp(re)
else if (re <= 4.4d+51) then
tmp = (cos(im) * (1.0d0 + (t_1 * (t_1 * t_1)))) / (1.0d0 + (t_1 * (t_1 + (-1.0d0))))
else if (re <= 1d+103) then
tmp = 1.0d0 + (((re * re) - (t_2 * t_2)) / (re - t_2))
else
tmp = cos(im) * (1.0d0 + t_1)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (0.5 + (re * 0.16666666666666666));
double t_1 = re * (1.0 + t_0);
double t_2 = re * t_0;
double tmp;
if (re <= -0.105) {
tmp = Math.exp(re);
} else if (re <= 4.4e+51) {
tmp = (Math.cos(im) * (1.0 + (t_1 * (t_1 * t_1)))) / (1.0 + (t_1 * (t_1 + -1.0)));
} else if (re <= 1e+103) {
tmp = 1.0 + (((re * re) - (t_2 * t_2)) / (re - t_2));
} else {
tmp = Math.cos(im) * (1.0 + t_1);
}
return tmp;
}
def code(re, im): t_0 = re * (0.5 + (re * 0.16666666666666666)) t_1 = re * (1.0 + t_0) t_2 = re * t_0 tmp = 0 if re <= -0.105: tmp = math.exp(re) elif re <= 4.4e+51: tmp = (math.cos(im) * (1.0 + (t_1 * (t_1 * t_1)))) / (1.0 + (t_1 * (t_1 + -1.0))) elif re <= 1e+103: tmp = 1.0 + (((re * re) - (t_2 * t_2)) / (re - t_2)) else: tmp = math.cos(im) * (1.0 + t_1) return tmp
function code(re, im) t_0 = Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))) t_1 = Float64(re * Float64(1.0 + t_0)) t_2 = Float64(re * t_0) tmp = 0.0 if (re <= -0.105) tmp = exp(re); elseif (re <= 4.4e+51) tmp = Float64(Float64(cos(im) * Float64(1.0 + Float64(t_1 * Float64(t_1 * t_1)))) / Float64(1.0 + Float64(t_1 * Float64(t_1 + -1.0)))); elseif (re <= 1e+103) tmp = Float64(1.0 + Float64(Float64(Float64(re * re) - Float64(t_2 * t_2)) / Float64(re - t_2))); else tmp = Float64(cos(im) * Float64(1.0 + t_1)); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (0.5 + (re * 0.16666666666666666)); t_1 = re * (1.0 + t_0); t_2 = re * t_0; tmp = 0.0; if (re <= -0.105) tmp = exp(re); elseif (re <= 4.4e+51) tmp = (cos(im) * (1.0 + (t_1 * (t_1 * t_1)))) / (1.0 + (t_1 * (t_1 + -1.0))); elseif (re <= 1e+103) tmp = 1.0 + (((re * re) - (t_2 * t_2)) / (re - t_2)); else tmp = cos(im) * (1.0 + t_1); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(re * t$95$0), $MachinePrecision]}, If[LessEqual[re, -0.105], N[Exp[re], $MachinePrecision], If[LessEqual[re, 4.4e+51], N[(N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(t$95$1 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(t$95$1 * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e+103], N[(1.0 + N[(N[(N[(re * re), $MachinePrecision] - N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\
t_1 := re \cdot \left(1 + t\_0\right)\\
t_2 := re \cdot t\_0\\
\mathbf{if}\;re \leq -0.105:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 4.4 \cdot 10^{+51}:\\
\;\;\;\;\frac{\cos im \cdot \left(1 + t\_1 \cdot \left(t\_1 \cdot t\_1\right)\right)}{1 + t\_1 \cdot \left(t\_1 + -1\right)}\\
\mathbf{elif}\;re \leq 10^{+103}:\\
\;\;\;\;1 + \frac{re \cdot re - t\_2 \cdot t\_2}{re - t\_2}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(1 + t\_1\right)\\
\end{array}
\end{array}
if re < -0.104999999999999996Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.0%
if -0.104999999999999996 < re < 4.39999999999999984e51Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6492.7%
Simplified92.7%
flip3-+N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr96.8%
if 4.39999999999999984e51 < re < 1e103Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6481.8%
Simplified81.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-*.f646.3%
Simplified6.3%
distribute-rgt-inN/A
*-lft-identityN/A
flip-+N/A
*-lft-identityN/A
fmm-defN/A
/-lowering-/.f64N/A
Applied egg-rr81.8%
if 1e103 < re Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
Final simplification97.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (+ 0.5 (* re 0.16666666666666666)))))
(if (<= re -0.066)
(exp re)
(if (<= re 0.11)
(* (cos im) (+ (* re t_0) (+ re 1.0)))
(if (<= re 1e+103) (exp re) (* (cos im) (+ 1.0 (* re (+ 1.0 t_0)))))))))
double code(double re, double im) {
double t_0 = re * (0.5 + (re * 0.16666666666666666));
double tmp;
if (re <= -0.066) {
tmp = exp(re);
} else if (re <= 0.11) {
tmp = cos(im) * ((re * t_0) + (re + 1.0));
} else if (re <= 1e+103) {
tmp = exp(re);
} else {
tmp = cos(im) * (1.0 + (re * (1.0 + t_0)));
}
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 * (0.5d0 + (re * 0.16666666666666666d0))
if (re <= (-0.066d0)) then
tmp = exp(re)
else if (re <= 0.11d0) then
tmp = cos(im) * ((re * t_0) + (re + 1.0d0))
else if (re <= 1d+103) then
tmp = exp(re)
else
tmp = cos(im) * (1.0d0 + (re * (1.0d0 + t_0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (0.5 + (re * 0.16666666666666666));
double tmp;
if (re <= -0.066) {
tmp = Math.exp(re);
} else if (re <= 0.11) {
tmp = Math.cos(im) * ((re * t_0) + (re + 1.0));
} else if (re <= 1e+103) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (1.0 + (re * (1.0 + t_0)));
}
return tmp;
}
def code(re, im): t_0 = re * (0.5 + (re * 0.16666666666666666)) tmp = 0 if re <= -0.066: tmp = math.exp(re) elif re <= 0.11: tmp = math.cos(im) * ((re * t_0) + (re + 1.0)) elif re <= 1e+103: tmp = math.exp(re) else: tmp = math.cos(im) * (1.0 + (re * (1.0 + t_0))) return tmp
function code(re, im) t_0 = Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))) tmp = 0.0 if (re <= -0.066) tmp = exp(re); elseif (re <= 0.11) tmp = Float64(cos(im) * Float64(Float64(re * t_0) + Float64(re + 1.0))); elseif (re <= 1e+103) tmp = exp(re); else tmp = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + t_0)))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (0.5 + (re * 0.16666666666666666)); tmp = 0.0; if (re <= -0.066) tmp = exp(re); elseif (re <= 0.11) tmp = cos(im) * ((re * t_0) + (re + 1.0)); elseif (re <= 1e+103) tmp = exp(re); else tmp = cos(im) * (1.0 + (re * (1.0 + t_0))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.066], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.11], N[(N[Cos[im], $MachinePrecision] * N[(N[(re * t$95$0), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e+103], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\
\mathbf{if}\;re \leq -0.066:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.11:\\
\;\;\;\;\cos im \cdot \left(re \cdot t\_0 + \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 10^{+103}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(1 + re \cdot \left(1 + t\_0\right)\right)\\
\end{array}
\end{array}
if re < -0.066000000000000003 or 0.110000000000000001 < re < 1e103Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6493.3%
Simplified93.3%
if -0.066000000000000003 < re < 0.110000000000000001Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6499.5%
Simplified99.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-*.f6499.5%
Applied egg-rr99.5%
if 1e103 < re Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
Final simplification97.4%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(cos im)
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
(if (<= re -0.07)
(exp re)
(if (<= re 0.065) t_0 (if (<= re 1e+103) (exp re) t_0)))))
double code(double re, double im) {
double t_0 = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
double tmp;
if (re <= -0.07) {
tmp = exp(re);
} else if (re <= 0.065) {
tmp = t_0;
} else if (re <= 1e+103) {
tmp = exp(re);
} else {
tmp = t_0;
}
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 = cos(im) * (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))))
if (re <= (-0.07d0)) then
tmp = exp(re)
else if (re <= 0.065d0) then
tmp = t_0
else if (re <= 1d+103) then
tmp = exp(re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
double tmp;
if (re <= -0.07) {
tmp = Math.exp(re);
} else if (re <= 0.065) {
tmp = t_0;
} else if (re <= 1e+103) {
tmp = Math.exp(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) tmp = 0 if re <= -0.07: tmp = math.exp(re) elif re <= 0.065: tmp = t_0 elif re <= 1e+103: tmp = math.exp(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))))))) tmp = 0.0 if (re <= -0.07) tmp = exp(re); elseif (re <= 0.065) tmp = t_0; elseif (re <= 1e+103) tmp = exp(re); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))); tmp = 0.0; if (re <= -0.07) tmp = exp(re); elseif (re <= 0.065) tmp = t_0; elseif (re <= 1e+103) tmp = exp(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.07], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.065], t$95$0, If[LessEqual[re, 1e+103], N[Exp[re], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{if}\;re \leq -0.07:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.065:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 10^{+103}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -0.070000000000000007 or 0.065000000000000002 < re < 1e103Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6493.3%
Simplified93.3%
if -0.070000000000000007 < re < 0.065000000000000002 or 1e103 < re Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6499.7%
Simplified99.7%
Final simplification97.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos im) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))))
(if (<= re -0.066)
(exp re)
(if (<= re 0.0115) t_0 (if (<= re 1.9e+154) (exp re) t_0)))))
double code(double re, double im) {
double t_0 = cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
double tmp;
if (re <= -0.066) {
tmp = exp(re);
} else if (re <= 0.0115) {
tmp = t_0;
} else if (re <= 1.9e+154) {
tmp = exp(re);
} else {
tmp = t_0;
}
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 = cos(im) * (1.0d0 + (re * (1.0d0 + (re * 0.5d0))))
if (re <= (-0.066d0)) then
tmp = exp(re)
else if (re <= 0.0115d0) then
tmp = t_0
else if (re <= 1.9d+154) then
tmp = exp(re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
double tmp;
if (re <= -0.066) {
tmp = Math.exp(re);
} else if (re <= 0.0115) {
tmp = t_0;
} else if (re <= 1.9e+154) {
tmp = Math.exp(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5)))) tmp = 0 if re <= -0.066: tmp = math.exp(re) elif re <= 0.0115: tmp = t_0 elif re <= 1.9e+154: tmp = math.exp(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))))) tmp = 0.0 if (re <= -0.066) tmp = exp(re); elseif (re <= 0.0115) tmp = t_0; elseif (re <= 1.9e+154) tmp = exp(re); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(im) * (1.0 + (re * (1.0 + (re * 0.5)))); tmp = 0.0; if (re <= -0.066) tmp = exp(re); elseif (re <= 0.0115) tmp = t_0; elseif (re <= 1.9e+154) tmp = exp(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.066], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0115], t$95$0, If[LessEqual[re, 1.9e+154], N[Exp[re], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos im \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\
\mathbf{if}\;re \leq -0.066:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0115:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -0.066000000000000003 or 0.0115 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6492.9%
Simplified92.9%
if -0.066000000000000003 < re < 0.0115 or 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6499.4%
Simplified99.4%
Final simplification96.9%
(FPCore (re im) :precision binary64 (if (<= re -0.013) (exp re) (if (<= re 0.0036) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -0.013) {
tmp = exp(re);
} else if (re <= 0.0036) {
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 (re <= (-0.013d0)) then
tmp = exp(re)
else if (re <= 0.0036d0) 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 (re <= -0.013) {
tmp = Math.exp(re);
} else if (re <= 0.0036) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.013: tmp = math.exp(re) elif re <= 0.0036: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.013) tmp = exp(re); elseif (re <= 0.0036) 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 (re <= -0.013) tmp = exp(re); elseif (re <= 0.0036) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.013], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0036], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.013:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0036:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -0.0129999999999999994 or 0.0035999999999999999 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6490.6%
Simplified90.6%
if -0.0129999999999999994 < re < 0.0035999999999999999Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6499.1%
Simplified99.1%
Final simplification94.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re (+ 0.5 (* re 0.16666666666666666))))))
(if (<= re -17000000000000.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(if (<= re 5.8e-22)
(cos im)
(if (<= re 1e+103)
(+ 1.0 (/ (- (* re re) (* t_0 t_0)) (- re t_0)))
t_0)))))
double code(double re, double im) {
double t_0 = re * (re * (0.5 + (re * 0.16666666666666666)));
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 5.8e-22) {
tmp = cos(im);
} else if (re <= 1e+103) {
tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
} else {
tmp = t_0;
}
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 * (0.5d0 + (re * 0.16666666666666666d0)))
if (re <= (-17000000000000.0d0)) then
tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
else if (re <= 5.8d-22) then
tmp = cos(im)
else if (re <= 1d+103) then
tmp = 1.0d0 + (((re * re) - (t_0 * t_0)) / (re - t_0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * (0.5 + (re * 0.16666666666666666)));
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 5.8e-22) {
tmp = Math.cos(im);
} else if (re <= 1e+103) {
tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * (0.5 + (re * 0.16666666666666666))) tmp = 0 if re <= -17000000000000.0: tmp = 0.041666666666666664 * ((im * im) * (im * im)) elif re <= 5.8e-22: tmp = math.cos(im) elif re <= 1e+103: tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))) tmp = 0.0 if (re <= -17000000000000.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); elseif (re <= 5.8e-22) tmp = cos(im); elseif (re <= 1e+103) tmp = Float64(1.0 + Float64(Float64(Float64(re * re) - Float64(t_0 * t_0)) / Float64(re - t_0))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * (0.5 + (re * 0.16666666666666666))); tmp = 0.0; if (re <= -17000000000000.0) tmp = 0.041666666666666664 * ((im * im) * (im * im)); elseif (re <= 5.8e-22) tmp = cos(im); elseif (re <= 1e+103) tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -17000000000000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5.8e-22], N[Cos[im], $MachinePrecision], If[LessEqual[re, 1e+103], N[(1.0 + N[(N[(N[(re * re), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;re \leq -17000000000000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 5.8 \cdot 10^{-22}:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 10^{+103}:\\
\;\;\;\;1 + \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -1.7e13Initial 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
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.4%
Simplified2.4%
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
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.4%
Simplified2.4%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.2%
Simplified36.2%
if -1.7e13 < re < 5.8000000000000003e-22Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6495.4%
Simplified95.4%
if 5.8000000000000003e-22 < re < 1e103Initial program 99.9%
Taylor expanded in im around 0
exp-lowering-exp.f6472.8%
Simplified72.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-*.f6416.6%
Simplified16.6%
distribute-rgt-inN/A
*-lft-identityN/A
flip-+N/A
*-lft-identityN/A
fmm-defN/A
/-lowering-/.f64N/A
Applied egg-rr49.8%
if 1e103 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6484.2%
Simplified84.2%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6484.2%
Simplified84.2%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6484.2%
Simplified84.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re (+ 0.5 (* re 0.16666666666666666))))))
(if (<= re -17000000000000.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(if (<= re 1e+103)
(+ 1.0 (/ (- (* re re) (* t_0 t_0)) (- re t_0)))
t_0))))
double code(double re, double im) {
double t_0 = re * (re * (0.5 + (re * 0.16666666666666666)));
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 1e+103) {
tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
} else {
tmp = t_0;
}
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 * (0.5d0 + (re * 0.16666666666666666d0)))
if (re <= (-17000000000000.0d0)) then
tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
else if (re <= 1d+103) then
tmp = 1.0d0 + (((re * re) - (t_0 * t_0)) / (re - t_0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * (0.5 + (re * 0.16666666666666666)));
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 1e+103) {
tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * (0.5 + (re * 0.16666666666666666))) tmp = 0 if re <= -17000000000000.0: tmp = 0.041666666666666664 * ((im * im) * (im * im)) elif re <= 1e+103: tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))) tmp = 0.0 if (re <= -17000000000000.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); elseif (re <= 1e+103) tmp = Float64(1.0 + Float64(Float64(Float64(re * re) - Float64(t_0 * t_0)) / Float64(re - t_0))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * (0.5 + (re * 0.16666666666666666))); tmp = 0.0; if (re <= -17000000000000.0) tmp = 0.041666666666666664 * ((im * im) * (im * im)); elseif (re <= 1e+103) tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -17000000000000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e+103], N[(1.0 + N[(N[(N[(re * re), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(re - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;re \leq -17000000000000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 10^{+103}:\\
\;\;\;\;1 + \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -1.7e13Initial 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
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.4%
Simplified2.4%
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
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.4%
Simplified2.4%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.2%
Simplified36.2%
if -1.7e13 < re < 1e103Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6456.0%
Simplified56.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6443.8%
Simplified43.8%
distribute-rgt-inN/A
*-lft-identityN/A
flip-+N/A
*-lft-identityN/A
fmm-defN/A
/-lowering-/.f64N/A
Applied egg-rr49.2%
if 1e103 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6484.2%
Simplified84.2%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6484.2%
Simplified84.2%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6484.2%
Simplified84.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 0.5 (* re 0.16666666666666666)))
(t_1 (* re t_0))
(t_2 (* re t_1)))
(if (<= re -17000000000000.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(if (<= re 5e+120)
(+ 1.0 (/ (* re (- 1.0 (* t_0 t_2))) (- 1.0 t_1)))
t_2))))
double code(double re, double im) {
double t_0 = 0.5 + (re * 0.16666666666666666);
double t_1 = re * t_0;
double t_2 = re * t_1;
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 5e+120) {
tmp = 1.0 + ((re * (1.0 - (t_0 * t_2))) / (1.0 - t_1));
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = 0.5d0 + (re * 0.16666666666666666d0)
t_1 = re * t_0
t_2 = re * t_1
if (re <= (-17000000000000.0d0)) then
tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
else if (re <= 5d+120) then
tmp = 1.0d0 + ((re * (1.0d0 - (t_0 * t_2))) / (1.0d0 - t_1))
else
tmp = t_2
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 t_2 = re * t_1;
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 5e+120) {
tmp = 1.0 + ((re * (1.0 - (t_0 * t_2))) / (1.0 - t_1));
} else {
tmp = t_2;
}
return tmp;
}
def code(re, im): t_0 = 0.5 + (re * 0.16666666666666666) t_1 = re * t_0 t_2 = re * t_1 tmp = 0 if re <= -17000000000000.0: tmp = 0.041666666666666664 * ((im * im) * (im * im)) elif re <= 5e+120: tmp = 1.0 + ((re * (1.0 - (t_0 * t_2))) / (1.0 - t_1)) else: tmp = t_2 return tmp
function code(re, im) t_0 = Float64(0.5 + Float64(re * 0.16666666666666666)) t_1 = Float64(re * t_0) t_2 = Float64(re * t_1) tmp = 0.0 if (re <= -17000000000000.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); elseif (re <= 5e+120) tmp = Float64(1.0 + Float64(Float64(re * Float64(1.0 - Float64(t_0 * t_2))) / Float64(1.0 - t_1))); else tmp = t_2; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 + (re * 0.16666666666666666); t_1 = re * t_0; t_2 = re * t_1; tmp = 0.0; if (re <= -17000000000000.0) tmp = 0.041666666666666664 * ((im * im) * (im * im)); elseif (re <= 5e+120) tmp = 1.0 + ((re * (1.0 - (t_0 * t_2))) / (1.0 - t_1)); else tmp = t_2; 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]}, Block[{t$95$2 = N[(re * t$95$1), $MachinePrecision]}, If[LessEqual[re, -17000000000000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5e+120], N[(1.0 + N[(N[(re * N[(1.0 - N[(t$95$0 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 + re \cdot 0.16666666666666666\\
t_1 := re \cdot t\_0\\
t_2 := re \cdot t\_1\\
\mathbf{if}\;re \leq -17000000000000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 5 \cdot 10^{+120}:\\
\;\;\;\;1 + \frac{re \cdot \left(1 - t\_0 \cdot t\_2\right)}{1 - t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if re < -1.7e13Initial 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
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.4%
Simplified2.4%
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
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.4%
Simplified2.4%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.2%
Simplified36.2%
if -1.7e13 < re < 5.00000000000000019e120Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6456.8%
Simplified56.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-*.f6445.0%
Simplified45.0%
*-commutativeN/A
flip-+N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr49.0%
if 5.00000000000000019e120 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6484.8%
Simplified84.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-*.f6484.8%
Simplified84.8%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6484.8%
Simplified84.8%
Final simplification50.5%
(FPCore (re im)
:precision binary64
(if (<= re -17000000000000.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(if (<= re 2.9)
(+ 1.0 (* re (+ 1.0 (* re 0.5))))
(* re (* re (+ 0.5 (* re 0.16666666666666666)))))))
double code(double re, double im) {
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 2.9) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else {
tmp = re * (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 <= (-17000000000000.0d0)) then
tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
else if (re <= 2.9d0) then
tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
else
tmp = re * (re * (0.5d0 + (re * 0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 2.9) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else {
tmp = re * (re * (0.5 + (re * 0.16666666666666666)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -17000000000000.0: tmp = 0.041666666666666664 * ((im * im) * (im * im)) elif re <= 2.9: tmp = 1.0 + (re * (1.0 + (re * 0.5))) else: tmp = re * (re * (0.5 + (re * 0.16666666666666666))) return tmp
function code(re, im) tmp = 0.0 if (re <= -17000000000000.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); elseif (re <= 2.9) tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))); else tmp = Float64(re * Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -17000000000000.0) tmp = 0.041666666666666664 * ((im * im) * (im * im)); elseif (re <= 2.9) tmp = 1.0 + (re * (1.0 + (re * 0.5))); else tmp = re * (re * (0.5 + (re * 0.16666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -17000000000000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.9], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -17000000000000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 2.9:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -1.7e13Initial 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
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.4%
Simplified2.4%
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
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.4%
Simplified2.4%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.2%
Simplified36.2%
if -1.7e13 < re < 2.89999999999999991Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6453.6%
Simplified53.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6450.0%
Simplified50.0%
if 2.89999999999999991 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6479.7%
Simplified79.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6455.8%
Simplified55.8%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6455.8%
Simplified55.8%
(FPCore (re im)
:precision binary64
(if (<= re -17000000000000.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(if (<= re 1.86)
(+ re 1.0)
(* re (* re (+ 0.5 (* re 0.16666666666666666)))))))
double code(double re, double im) {
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 1.86) {
tmp = re + 1.0;
} else {
tmp = re * (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 <= (-17000000000000.0d0)) then
tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
else if (re <= 1.86d0) then
tmp = re + 1.0d0
else
tmp = re * (re * (0.5d0 + (re * 0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 1.86) {
tmp = re + 1.0;
} else {
tmp = re * (re * (0.5 + (re * 0.16666666666666666)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -17000000000000.0: tmp = 0.041666666666666664 * ((im * im) * (im * im)) elif re <= 1.86: tmp = re + 1.0 else: tmp = re * (re * (0.5 + (re * 0.16666666666666666))) return tmp
function code(re, im) tmp = 0.0 if (re <= -17000000000000.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); elseif (re <= 1.86) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -17000000000000.0) tmp = 0.041666666666666664 * ((im * im) * (im * im)); elseif (re <= 1.86) tmp = re + 1.0; else tmp = re * (re * (0.5 + (re * 0.16666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -17000000000000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.86], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -17000000000000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 1.86:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -1.7e13Initial 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
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.4%
Simplified2.4%
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
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.4%
Simplified2.4%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.2%
Simplified36.2%
if -1.7e13 < re < 1.8600000000000001Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6453.6%
Simplified53.6%
Taylor expanded in re around 0
+-lowering-+.f6450.0%
Simplified50.0%
if 1.8600000000000001 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6479.7%
Simplified79.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6455.8%
Simplified55.8%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6455.8%
Simplified55.8%
Final simplification48.0%
(FPCore (re im) :precision binary64 (if (<= re -17000000000000.0) (* 0.041666666666666664 (* (* im im) (* im im))) (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} 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 <= (-17000000000000.0d0)) then
tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
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 <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -17000000000000.0: tmp = 0.041666666666666664 * ((im * im) * (im * im)) else: tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) return tmp
function code(re, im) tmp = 0.0 if (re <= -17000000000000.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); 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 <= -17000000000000.0) tmp = 0.041666666666666664 * ((im * im) * (im * im)); else tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -17000000000000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $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 -17000000000000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\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 < -1.7e13Initial 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
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.4%
Simplified2.4%
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
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.4%
Simplified2.4%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.2%
Simplified36.2%
if -1.7e13 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6461.6%
Simplified61.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-*.f6451.8%
Simplified51.8%
(FPCore (re im) :precision binary64 (if (<= re -17000000000000.0) (* 0.041666666666666664 (* (* im im) (* im im))) (if (<= re 2.9) (+ re 1.0) (* re (* re (* re 0.16666666666666666))))))
double code(double re, double im) {
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 2.9) {
tmp = re + 1.0;
} else {
tmp = re * (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 <= (-17000000000000.0d0)) then
tmp = 0.041666666666666664d0 * ((im * im) * (im * im))
else if (re <= 2.9d0) then
tmp = re + 1.0d0
else
tmp = re * (re * (re * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -17000000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 2.9) {
tmp = re + 1.0;
} else {
tmp = re * (re * (re * 0.16666666666666666));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -17000000000000.0: tmp = 0.041666666666666664 * ((im * im) * (im * im)) elif re <= 2.9: tmp = re + 1.0 else: tmp = re * (re * (re * 0.16666666666666666)) return tmp
function code(re, im) tmp = 0.0 if (re <= -17000000000000.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); elseif (re <= 2.9) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(re * Float64(re * 0.16666666666666666))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -17000000000000.0) tmp = 0.041666666666666664 * ((im * im) * (im * im)); elseif (re <= 2.9) tmp = re + 1.0; else tmp = re * (re * (re * 0.16666666666666666)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -17000000000000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.9], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -17000000000000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 2.9:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -1.7e13Initial 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
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.4%
Simplified2.4%
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
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.4%
Simplified2.4%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.2%
Simplified36.2%
if -1.7e13 < re < 2.89999999999999991Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6453.6%
Simplified53.6%
Taylor expanded in re around 0
+-lowering-+.f6450.0%
Simplified50.0%
if 2.89999999999999991 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6479.7%
Simplified79.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6455.8%
Simplified55.8%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6455.8%
Simplified55.8%
Final simplification48.0%
(FPCore (re im) :precision binary64 (if (<= re 3.0) (+ re 1.0) (* re (* re (* re 0.16666666666666666)))))
double code(double re, double im) {
double tmp;
if (re <= 3.0) {
tmp = re + 1.0;
} else {
tmp = re * (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 <= 3.0d0) then
tmp = re + 1.0d0
else
tmp = re * (re * (re * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 3.0) {
tmp = re + 1.0;
} else {
tmp = re * (re * (re * 0.16666666666666666));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 3.0: tmp = re + 1.0 else: tmp = re * (re * (re * 0.16666666666666666)) return tmp
function code(re, im) tmp = 0.0 if (re <= 3.0) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(re * Float64(re * 0.16666666666666666))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 3.0) tmp = re + 1.0; else tmp = re * (re * (re * 0.16666666666666666)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 3.0], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 3:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < 3Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6468.5%
Simplified68.5%
Taylor expanded in re around 0
+-lowering-+.f6434.7%
Simplified34.7%
if 3 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6479.7%
Simplified79.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6455.8%
Simplified55.8%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6455.8%
Simplified55.8%
Final simplification39.6%
(FPCore (re im) :precision binary64 (if (<= re 2.7) (+ re 1.0) (* 0.5 (* re re))))
double code(double re, double im) {
double tmp;
if (re <= 2.7) {
tmp = re + 1.0;
} else {
tmp = 0.5 * (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.7d0) then
tmp = re + 1.0d0
else
tmp = 0.5d0 * (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.7) {
tmp = re + 1.0;
} else {
tmp = 0.5 * (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.7: tmp = re + 1.0 else: tmp = 0.5 * (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.7) tmp = Float64(re + 1.0); else tmp = Float64(0.5 * Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.7) tmp = re + 1.0; else tmp = 0.5 * (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.7], N[(re + 1.0), $MachinePrecision], N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.7:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 2.7000000000000002Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6468.5%
Simplified68.5%
Taylor expanded in re around 0
+-lowering-+.f6434.7%
Simplified34.7%
if 2.7000000000000002 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6479.7%
Simplified79.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6442.7%
Simplified42.7%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6442.7%
Simplified42.7%
Final simplification36.6%
(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.f6471.0%
Simplified71.0%
Taylor expanded in re around 0
+-lowering-+.f6427.8%
Simplified27.8%
Final simplification27.8%
(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
exp-lowering-exp.f6471.0%
Simplified71.0%
Taylor expanded in re around 0
Simplified27.3%
herbie shell --seed 2024139
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))