
(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) 2e-248) (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) <= 2e-248) {
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) <= 2d-248) 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) <= 2e-248) {
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) <= 2e-248: 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) <= 2e-248) 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) <= 2e-248) 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], 2e-248], 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 2 \cdot 10^{-248}:\\
\;\;\;\;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) < 1.99999999999999996e-248 or 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6485.5%
Simplified85.5%
if 1.99999999999999996e-248 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6499.2%
Simplified99.2%
Final simplification91.9%
(FPCore (re im) :precision binary64 (if (<= (exp re) 2e-248) (exp re) (if (<= (exp re) 1.0) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 2e-248) {
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) <= 2d-248) 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) <= 2e-248) {
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) <= 2e-248: 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) <= 2e-248) 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) <= 2e-248) 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], 2e-248], 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 2 \cdot 10^{-248}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 1.99999999999999996e-248 or 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6485.5%
Simplified85.5%
if 1.99999999999999996e-248 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6498.8%
Simplified98.8%
(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 1.85e-13)
t_0
(if (<= re 1.05e+103) (* (exp re) (+ 1.0 (* -0.5 (* im im)))) 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 <= 1.85e-13) {
tmp = t_0;
} else if (re <= 1.05e+103) {
tmp = exp(re) * (1.0 + (-0.5 * (im * im)));
} 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 <= 1.85d-13) then
tmp = t_0
else if (re <= 1.05d+103) then
tmp = exp(re) * (1.0d0 + ((-0.5d0) * (im * im)))
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 <= 1.85e-13) {
tmp = t_0;
} else if (re <= 1.05e+103) {
tmp = Math.exp(re) * (1.0 + (-0.5 * (im * im)));
} 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 <= 1.85e-13: tmp = t_0 elif re <= 1.05e+103: tmp = math.exp(re) * (1.0 + (-0.5 * (im * im))) 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 <= 1.85e-13) tmp = t_0; elseif (re <= 1.05e+103) tmp = Float64(exp(re) * Float64(1.0 + Float64(-0.5 * Float64(im * im)))); 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 <= 1.85e-13) tmp = t_0; elseif (re <= 1.05e+103) tmp = exp(re) * (1.0 + (-0.5 * (im * im))); 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, 1.85e-13], t$95$0, If[LessEqual[re, 1.05e+103], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 1.85 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -0.070000000000000007Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6498.9%
Simplified98.9%
if -0.070000000000000007 < re < 1.84999999999999994e-13 or 1.0500000000000001e103 < 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.8%
Simplified99.8%
if 1.84999999999999994e-13 < re < 1.0500000000000001e103Initial 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
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6476.9%
Simplified76.9%
Final simplification97.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos im) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))))
(if (<= re -0.019)
(exp re)
(if (<= re 1.85e-13)
t_0
(if (<= re 1.1e+152) (* (exp re) (+ 1.0 (* -0.5 (* im im)))) 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.019) {
tmp = exp(re);
} else if (re <= 1.85e-13) {
tmp = t_0;
} else if (re <= 1.1e+152) {
tmp = exp(re) * (1.0 + (-0.5 * (im * im)));
} 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.019d0)) then
tmp = exp(re)
else if (re <= 1.85d-13) then
tmp = t_0
else if (re <= 1.1d+152) then
tmp = exp(re) * (1.0d0 + ((-0.5d0) * (im * im)))
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.019) {
tmp = Math.exp(re);
} else if (re <= 1.85e-13) {
tmp = t_0;
} else if (re <= 1.1e+152) {
tmp = Math.exp(re) * (1.0 + (-0.5 * (im * im)));
} 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.019: tmp = math.exp(re) elif re <= 1.85e-13: tmp = t_0 elif re <= 1.1e+152: tmp = math.exp(re) * (1.0 + (-0.5 * (im * im))) 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.019) tmp = exp(re); elseif (re <= 1.85e-13) tmp = t_0; elseif (re <= 1.1e+152) tmp = Float64(exp(re) * Float64(1.0 + Float64(-0.5 * Float64(im * im)))); 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.019) tmp = exp(re); elseif (re <= 1.85e-13) tmp = t_0; elseif (re <= 1.1e+152) tmp = exp(re) * (1.0 + (-0.5 * (im * im))); 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.019], N[Exp[re], $MachinePrecision], If[LessEqual[re, 1.85e-13], t$95$0, If[LessEqual[re, 1.1e+152], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.019:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 1.85 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.1 \cdot 10^{+152}:\\
\;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -0.0189999999999999995Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6498.9%
Simplified98.9%
if -0.0189999999999999995 < re < 1.84999999999999994e-13 or 1.0999999999999999e152 < re Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6499.1%
Simplified99.1%
if 1.84999999999999994e-13 < re < 1.0999999999999999e152Initial 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
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6470.3%
Simplified70.3%
Final simplification94.8%
(FPCore (re im)
:precision binary64
(if (<= re -0.024)
(exp re)
(if (<= re 1.85e-13)
(* (cos im) (+ re 1.0))
(* (exp re) (+ 1.0 (* -0.5 (* im im)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.024) {
tmp = exp(re);
} else if (re <= 1.85e-13) {
tmp = cos(im) * (re + 1.0);
} else {
tmp = exp(re) * (1.0 + (-0.5 * (im * im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-0.024d0)) then
tmp = exp(re)
else if (re <= 1.85d-13) then
tmp = cos(im) * (re + 1.0d0)
else
tmp = exp(re) * (1.0d0 + ((-0.5d0) * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.024) {
tmp = Math.exp(re);
} else if (re <= 1.85e-13) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re) * (1.0 + (-0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.024: tmp = math.exp(re) elif re <= 1.85e-13: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) * (1.0 + (-0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.024) tmp = exp(re); elseif (re <= 1.85e-13) tmp = Float64(cos(im) * Float64(re + 1.0)); else tmp = Float64(exp(re) * Float64(1.0 + Float64(-0.5 * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.024) tmp = exp(re); elseif (re <= 1.85e-13) tmp = cos(im) * (re + 1.0); else tmp = exp(re) * (1.0 + (-0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.024], N[Exp[re], $MachinePrecision], If[LessEqual[re, 1.85e-13], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.024:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 1.85 \cdot 10^{-13}:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if re < -0.024Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6498.9%
Simplified98.9%
if -0.024 < re < 1.84999999999999994e-13Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6499.2%
Simplified99.2%
if 1.84999999999999994e-13 < 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
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6473.1%
Simplified73.1%
Final simplification92.3%
(FPCore (re im)
:precision binary64
(if (<= re -600.0)
(* im (* im -0.5))
(if (<= re 1.85e-13)
(cos im)
(* (+ 1.0 (* -0.5 (* im im))) (+ 1.0 (* re (+ 1.0 (* re 0.5))))))))
double code(double re, double im) {
double tmp;
if (re <= -600.0) {
tmp = im * (im * -0.5);
} else if (re <= 1.85e-13) {
tmp = cos(im);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (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 <= (-600.0d0)) then
tmp = im * (im * (-0.5d0))
else if (re <= 1.85d-13) then
tmp = cos(im)
else
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * (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 <= -600.0) {
tmp = im * (im * -0.5);
} else if (re <= 1.85e-13) {
tmp = Math.cos(im);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (1.0 + (re * (1.0 + (re * 0.5))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -600.0: tmp = im * (im * -0.5) elif re <= 1.85e-13: tmp = math.cos(im) else: tmp = (1.0 + (-0.5 * (im * im))) * (1.0 + (re * (1.0 + (re * 0.5)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -600.0) tmp = Float64(im * Float64(im * -0.5)); elseif (re <= 1.85e-13) tmp = cos(im); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * 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 <= -600.0) tmp = im * (im * -0.5); elseif (re <= 1.85e-13) tmp = cos(im); else tmp = (1.0 + (-0.5 * (im * im))) * (1.0 + (re * (1.0 + (re * 0.5)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -600.0], N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.85e-13], N[Cos[im], $MachinePrecision], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -600:\\
\;\;\;\;im \cdot \left(im \cdot -0.5\right)\\
\mathbf{elif}\;re \leq 1.85 \cdot 10^{-13}:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -600Initial 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-*.f642.5%
Simplified2.5%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6434.0%
Simplified34.0%
if -600 < re < 1.84999999999999994e-13Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6498.0%
Simplified98.0%
if 1.84999999999999994e-13 < 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
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6473.1%
Simplified73.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6459.3%
Simplified59.3%
Final simplification70.6%
(FPCore (re im)
:precision binary64
(if (<= re -0.0118)
(* im (* im -0.5))
(if (<= re 4000.0)
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))
(* (+ 1.0 (* -0.5 (* im im))) (+ 1.0 (* re (+ 1.0 (* re 0.5))))))))
double code(double re, double im) {
double tmp;
if (re <= -0.0118) {
tmp = im * (im * -0.5);
} else if (re <= 4000.0) {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (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 <= (-0.0118d0)) then
tmp = im * (im * (-0.5d0))
else if (re <= 4000.0d0) then
tmp = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
else
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * (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 <= -0.0118) {
tmp = im * (im * -0.5);
} else if (re <= 4000.0) {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (1.0 + (re * (1.0 + (re * 0.5))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0118: tmp = im * (im * -0.5) elif re <= 4000.0: tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) else: tmp = (1.0 + (-0.5 * (im * im))) * (1.0 + (re * (1.0 + (re * 0.5)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0118) tmp = Float64(im * Float64(im * -0.5)); elseif (re <= 4000.0) tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * 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 <= -0.0118) tmp = im * (im * -0.5); elseif (re <= 4000.0) tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); else tmp = (1.0 + (-0.5 * (im * im))) * (1.0 + (re * (1.0 + (re * 0.5)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0118], N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4000.0], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0118:\\
\;\;\;\;im \cdot \left(im \cdot -0.5\right)\\
\mathbf{elif}\;re \leq 4000:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.0117999999999999997Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.6%
Simplified2.6%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6433.1%
Simplified33.1%
if -0.0117999999999999997 < re < 4e3Initial 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-*.f6454.4%
Simplified54.4%
if 4e3 < 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
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6473.3%
Simplified73.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6459.0%
Simplified59.0%
Final simplification49.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* im -0.5))))
(if (<= re -0.0118)
t_0
(if (<= re 7200.0)
(+ 1.0 (* re (+ 1.0 (* re 0.5))))
(if (<= re 1.5e+78)
(* re (+ 1.0 t_0))
(* 0.16666666666666666 (* re (* re re))))))))
double code(double re, double im) {
double t_0 = im * (im * -0.5);
double tmp;
if (re <= -0.0118) {
tmp = t_0;
} else if (re <= 7200.0) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else if (re <= 1.5e+78) {
tmp = re * (1.0 + t_0);
} else {
tmp = 0.16666666666666666 * (re * (re * re));
}
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 = im * (im * (-0.5d0))
if (re <= (-0.0118d0)) then
tmp = t_0
else if (re <= 7200.0d0) then
tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
else if (re <= 1.5d+78) then
tmp = re * (1.0d0 + t_0)
else
tmp = 0.16666666666666666d0 * (re * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (im * -0.5);
double tmp;
if (re <= -0.0118) {
tmp = t_0;
} else if (re <= 7200.0) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else if (re <= 1.5e+78) {
tmp = re * (1.0 + t_0);
} else {
tmp = 0.16666666666666666 * (re * (re * re));
}
return tmp;
}
def code(re, im): t_0 = im * (im * -0.5) tmp = 0 if re <= -0.0118: tmp = t_0 elif re <= 7200.0: tmp = 1.0 + (re * (1.0 + (re * 0.5))) elif re <= 1.5e+78: tmp = re * (1.0 + t_0) else: tmp = 0.16666666666666666 * (re * (re * re)) return tmp
function code(re, im) t_0 = Float64(im * Float64(im * -0.5)) tmp = 0.0 if (re <= -0.0118) tmp = t_0; elseif (re <= 7200.0) tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))); elseif (re <= 1.5e+78) tmp = Float64(re * Float64(1.0 + t_0)); else tmp = Float64(0.16666666666666666 * Float64(re * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (im * -0.5); tmp = 0.0; if (re <= -0.0118) tmp = t_0; elseif (re <= 7200.0) tmp = 1.0 + (re * (1.0 + (re * 0.5))); elseif (re <= 1.5e+78) tmp = re * (1.0 + t_0); else tmp = 0.16666666666666666 * (re * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.0118], t$95$0, If[LessEqual[re, 7200.0], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.5e+78], N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(im \cdot -0.5\right)\\
\mathbf{if}\;re \leq -0.0118:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 7200:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
\mathbf{elif}\;re \leq 1.5 \cdot 10^{+78}:\\
\;\;\;\;re \cdot \left(1 + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < -0.0117999999999999997Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.6%
Simplified2.6%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6433.1%
Simplified33.1%
if -0.0117999999999999997 < re < 7200Initial 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
*-commutativeN/A
*-lowering-*.f6454.3%
Simplified54.3%
if 7200 < re < 1.49999999999999991e78Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6448.7%
Simplified48.7%
Taylor expanded in re around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6448.7%
Simplified48.7%
if 1.49999999999999991e78 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6475.6%
Simplified75.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-*.f6467.3%
Simplified67.3%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.3%
Simplified67.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* im -0.5))))
(if (<= re -0.0118)
t_0
(if (<= re 4000.0)
(+ re 1.0)
(if (<= re 1.5e+78)
(* re (+ 1.0 t_0))
(* 0.16666666666666666 (* re (* re re))))))))
double code(double re, double im) {
double t_0 = im * (im * -0.5);
double tmp;
if (re <= -0.0118) {
tmp = t_0;
} else if (re <= 4000.0) {
tmp = re + 1.0;
} else if (re <= 1.5e+78) {
tmp = re * (1.0 + t_0);
} else {
tmp = 0.16666666666666666 * (re * (re * re));
}
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 = im * (im * (-0.5d0))
if (re <= (-0.0118d0)) then
tmp = t_0
else if (re <= 4000.0d0) then
tmp = re + 1.0d0
else if (re <= 1.5d+78) then
tmp = re * (1.0d0 + t_0)
else
tmp = 0.16666666666666666d0 * (re * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (im * -0.5);
double tmp;
if (re <= -0.0118) {
tmp = t_0;
} else if (re <= 4000.0) {
tmp = re + 1.0;
} else if (re <= 1.5e+78) {
tmp = re * (1.0 + t_0);
} else {
tmp = 0.16666666666666666 * (re * (re * re));
}
return tmp;
}
def code(re, im): t_0 = im * (im * -0.5) tmp = 0 if re <= -0.0118: tmp = t_0 elif re <= 4000.0: tmp = re + 1.0 elif re <= 1.5e+78: tmp = re * (1.0 + t_0) else: tmp = 0.16666666666666666 * (re * (re * re)) return tmp
function code(re, im) t_0 = Float64(im * Float64(im * -0.5)) tmp = 0.0 if (re <= -0.0118) tmp = t_0; elseif (re <= 4000.0) tmp = Float64(re + 1.0); elseif (re <= 1.5e+78) tmp = Float64(re * Float64(1.0 + t_0)); else tmp = Float64(0.16666666666666666 * Float64(re * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (im * -0.5); tmp = 0.0; if (re <= -0.0118) tmp = t_0; elseif (re <= 4000.0) tmp = re + 1.0; elseif (re <= 1.5e+78) tmp = re * (1.0 + t_0); else tmp = 0.16666666666666666 * (re * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.0118], t$95$0, If[LessEqual[re, 4000.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 1.5e+78], N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(im \cdot -0.5\right)\\
\mathbf{if}\;re \leq -0.0118:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 4000:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 1.5 \cdot 10^{+78}:\\
\;\;\;\;re \cdot \left(1 + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < -0.0117999999999999997Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.6%
Simplified2.6%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6433.1%
Simplified33.1%
if -0.0117999999999999997 < re < 4e3Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6456.5%
Simplified56.5%
Taylor expanded in re around 0
+-lowering-+.f6454.2%
Simplified54.2%
if 4e3 < re < 1.49999999999999991e78Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6448.7%
Simplified48.7%
Taylor expanded in re around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6448.7%
Simplified48.7%
if 1.49999999999999991e78 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6475.6%
Simplified75.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-*.f6467.3%
Simplified67.3%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.3%
Simplified67.3%
Final simplification50.3%
(FPCore (re im)
:precision binary64
(if (<= re -0.0118)
(* im (* im -0.5))
(if (<= re 7200.0)
(+ re 1.0)
(if (<= re 1.5e+78)
(* (* im im) (* re -0.5))
(* 0.16666666666666666 (* re (* re re)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.0118) {
tmp = im * (im * -0.5);
} else if (re <= 7200.0) {
tmp = re + 1.0;
} else if (re <= 1.5e+78) {
tmp = (im * im) * (re * -0.5);
} else {
tmp = 0.16666666666666666 * (re * (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 <= (-0.0118d0)) then
tmp = im * (im * (-0.5d0))
else if (re <= 7200.0d0) then
tmp = re + 1.0d0
else if (re <= 1.5d+78) then
tmp = (im * im) * (re * (-0.5d0))
else
tmp = 0.16666666666666666d0 * (re * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.0118) {
tmp = im * (im * -0.5);
} else if (re <= 7200.0) {
tmp = re + 1.0;
} else if (re <= 1.5e+78) {
tmp = (im * im) * (re * -0.5);
} else {
tmp = 0.16666666666666666 * (re * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0118: tmp = im * (im * -0.5) elif re <= 7200.0: tmp = re + 1.0 elif re <= 1.5e+78: tmp = (im * im) * (re * -0.5) else: tmp = 0.16666666666666666 * (re * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0118) tmp = Float64(im * Float64(im * -0.5)); elseif (re <= 7200.0) tmp = Float64(re + 1.0); elseif (re <= 1.5e+78) tmp = Float64(Float64(im * im) * Float64(re * -0.5)); else tmp = Float64(0.16666666666666666 * Float64(re * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.0118) tmp = im * (im * -0.5); elseif (re <= 7200.0) tmp = re + 1.0; elseif (re <= 1.5e+78) tmp = (im * im) * (re * -0.5); else tmp = 0.16666666666666666 * (re * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0118], N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 7200.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 1.5e+78], N[(N[(im * im), $MachinePrecision] * N[(re * -0.5), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0118:\\
\;\;\;\;im \cdot \left(im \cdot -0.5\right)\\
\mathbf{elif}\;re \leq 7200:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 1.5 \cdot 10^{+78}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < -0.0117999999999999997Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.6%
Simplified2.6%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6433.1%
Simplified33.1%
if -0.0117999999999999997 < re < 7200Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6456.5%
Simplified56.5%
Taylor expanded in re around 0
+-lowering-+.f6454.2%
Simplified54.2%
if 7200 < re < 1.49999999999999991e78Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6448.7%
Simplified48.7%
Taylor expanded in re around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6448.7%
Simplified48.7%
Taylor expanded in im around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6448.0%
Simplified48.0%
if 1.49999999999999991e78 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6475.6%
Simplified75.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-*.f6467.3%
Simplified67.3%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.3%
Simplified67.3%
Final simplification50.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* im -0.5))))
(if (<= re -0.0118)
t_0
(if (<= re 4000.0)
(+ re 1.0)
(if (<= re 1.05e+73) t_0 (* 0.16666666666666666 (* re (* re re))))))))
double code(double re, double im) {
double t_0 = im * (im * -0.5);
double tmp;
if (re <= -0.0118) {
tmp = t_0;
} else if (re <= 4000.0) {
tmp = re + 1.0;
} else if (re <= 1.05e+73) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (re * (re * re));
}
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 = im * (im * (-0.5d0))
if (re <= (-0.0118d0)) then
tmp = t_0
else if (re <= 4000.0d0) then
tmp = re + 1.0d0
else if (re <= 1.05d+73) then
tmp = t_0
else
tmp = 0.16666666666666666d0 * (re * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (im * -0.5);
double tmp;
if (re <= -0.0118) {
tmp = t_0;
} else if (re <= 4000.0) {
tmp = re + 1.0;
} else if (re <= 1.05e+73) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (re * (re * re));
}
return tmp;
}
def code(re, im): t_0 = im * (im * -0.5) tmp = 0 if re <= -0.0118: tmp = t_0 elif re <= 4000.0: tmp = re + 1.0 elif re <= 1.05e+73: tmp = t_0 else: tmp = 0.16666666666666666 * (re * (re * re)) return tmp
function code(re, im) t_0 = Float64(im * Float64(im * -0.5)) tmp = 0.0 if (re <= -0.0118) tmp = t_0; elseif (re <= 4000.0) tmp = Float64(re + 1.0); elseif (re <= 1.05e+73) tmp = t_0; else tmp = Float64(0.16666666666666666 * Float64(re * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (im * -0.5); tmp = 0.0; if (re <= -0.0118) tmp = t_0; elseif (re <= 4000.0) tmp = re + 1.0; elseif (re <= 1.05e+73) tmp = t_0; else tmp = 0.16666666666666666 * (re * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.0118], t$95$0, If[LessEqual[re, 4000.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 1.05e+73], t$95$0, N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(im \cdot -0.5\right)\\
\mathbf{if}\;re \leq -0.0118:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 4000:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 1.05 \cdot 10^{+73}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < -0.0117999999999999997 or 4e3 < re < 1.0500000000000001e73Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.4%
Simplified3.4%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f649.7%
Simplified9.7%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6435.7%
Simplified35.7%
if -0.0117999999999999997 < re < 4e3Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6456.5%
Simplified56.5%
Taylor expanded in re around 0
+-lowering-+.f6454.2%
Simplified54.2%
if 1.0500000000000001e73 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6475.0%
Simplified75.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-*.f6463.3%
Simplified63.3%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6463.3%
Simplified63.3%
Final simplification49.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* im -0.5))))
(if (<= re -0.0118)
t_0
(if (<= re 4000.0)
(+ re 1.0)
(if (<= re 1.5e+156) t_0 (* 0.5 (* re re)))))))
double code(double re, double im) {
double t_0 = im * (im * -0.5);
double tmp;
if (re <= -0.0118) {
tmp = t_0;
} else if (re <= 4000.0) {
tmp = re + 1.0;
} else if (re <= 1.5e+156) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = im * (im * (-0.5d0))
if (re <= (-0.0118d0)) then
tmp = t_0
else if (re <= 4000.0d0) then
tmp = re + 1.0d0
else if (re <= 1.5d+156) then
tmp = t_0
else
tmp = 0.5d0 * (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (im * -0.5);
double tmp;
if (re <= -0.0118) {
tmp = t_0;
} else if (re <= 4000.0) {
tmp = re + 1.0;
} else if (re <= 1.5e+156) {
tmp = t_0;
} else {
tmp = 0.5 * (re * re);
}
return tmp;
}
def code(re, im): t_0 = im * (im * -0.5) tmp = 0 if re <= -0.0118: tmp = t_0 elif re <= 4000.0: tmp = re + 1.0 elif re <= 1.5e+156: tmp = t_0 else: tmp = 0.5 * (re * re) return tmp
function code(re, im) t_0 = Float64(im * Float64(im * -0.5)) tmp = 0.0 if (re <= -0.0118) tmp = t_0; elseif (re <= 4000.0) tmp = Float64(re + 1.0); elseif (re <= 1.5e+156) tmp = t_0; else tmp = Float64(0.5 * Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (im * -0.5); tmp = 0.0; if (re <= -0.0118) tmp = t_0; elseif (re <= 4000.0) tmp = re + 1.0; elseif (re <= 1.5e+156) tmp = t_0; else tmp = 0.5 * (re * re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.0118], t$95$0, If[LessEqual[re, 4000.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 1.5e+156], t$95$0, N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(im \cdot -0.5\right)\\
\mathbf{if}\;re \leq -0.0118:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 4000:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 1.5 \cdot 10^{+156}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < -0.0117999999999999997 or 4e3 < re < 1.5e156Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.4%
Simplified3.4%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6412.0%
Simplified12.0%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6432.9%
Simplified32.9%
if -0.0117999999999999997 < re < 4e3Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6456.5%
Simplified56.5%
Taylor expanded in re around 0
+-lowering-+.f6454.2%
Simplified54.2%
if 1.5e156 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6478.6%
Simplified78.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6478.6%
Simplified78.6%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6478.6%
Simplified78.6%
Final simplification48.3%
(FPCore (re im) :precision binary64 (if (<= re -0.0118) (* im (* im -0.5)) (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
double tmp;
if (re <= -0.0118) {
tmp = im * (im * -0.5);
} 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 <= (-0.0118d0)) then
tmp = im * (im * (-0.5d0))
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 <= -0.0118) {
tmp = im * (im * -0.5);
} else {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0118: tmp = im * (im * -0.5) else: tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0118) tmp = Float64(im * Float64(im * -0.5)); 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 <= -0.0118) tmp = im * (im * -0.5); else tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0118], N[(im * N[(im * -0.5), $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 -0.0118:\\
\;\;\;\;im \cdot \left(im \cdot -0.5\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 < -0.0117999999999999997Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.6%
Simplified2.6%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6433.1%
Simplified33.1%
if -0.0117999999999999997 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6460.3%
Simplified60.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-*.f6453.3%
Simplified53.3%
(FPCore (re im) :precision binary64 (if (<= re -0.0118) (* im (* im -0.5)) (+ 1.0 (* re (+ 1.0 (* re (* re 0.16666666666666666)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.0118) {
tmp = im * (im * -0.5);
} 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 <= (-0.0118d0)) then
tmp = im * (im * (-0.5d0))
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 <= -0.0118) {
tmp = im * (im * -0.5);
} else {
tmp = 1.0 + (re * (1.0 + (re * (re * 0.16666666666666666))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0118: tmp = im * (im * -0.5) else: tmp = 1.0 + (re * (1.0 + (re * (re * 0.16666666666666666)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0118) tmp = Float64(im * Float64(im * -0.5)); 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 <= -0.0118) tmp = im * (im * -0.5); else tmp = 1.0 + (re * (1.0 + (re * (re * 0.16666666666666666)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0118], N[(im * N[(im * -0.5), $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 -0.0118:\\
\;\;\;\;im \cdot \left(im \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -0.0117999999999999997Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f643.5%
Simplified3.5%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.6%
Simplified2.6%
Taylor expanded in im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6433.1%
Simplified33.1%
if -0.0117999999999999997 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6460.3%
Simplified60.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-*.f6453.3%
Simplified53.3%
Taylor expanded in re around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6453.2%
Simplified53.2%
(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.f6471.0%
Simplified71.0%
Taylor expanded in re around 0
+-lowering-+.f6435.7%
Simplified35.7%
if 2.7000000000000002 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6469.4%
Simplified69.4%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6437.3%
Simplified37.3%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.3%
Simplified37.3%
Final simplification36.1%
(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.f6470.6%
Simplified70.6%
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 im around 0
exp-lowering-exp.f6470.6%
Simplified70.6%
Taylor expanded in re around 0
Simplified27.4%
herbie shell --seed 2024164
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))