
(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 17 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 (let* ((t_0 (<= (exp re) 1.0))) (if t_0 (exp re) (if t_0 (cos im) (exp re)))))
double code(double re, double im) {
int t_0 = exp(re) <= 1.0;
double tmp;
if (t_0) {
tmp = exp(re);
} else if (t_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
logical :: t_0
real(8) :: tmp
t_0 = exp(re) <= 1.0d0
if (t_0) then
tmp = exp(re)
else if (t_0) then
tmp = cos(im)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
boolean t_0 = Math.exp(re) <= 1.0;
double tmp;
if (t_0) {
tmp = Math.exp(re);
} else if (t_0) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) <= 1.0 tmp = 0 if t_0: tmp = math.exp(re) elif t_0: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) t_0 = exp(re) <= 1.0 tmp = 0.0 if (t_0) tmp = exp(re); elseif (t_0) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) <= 1.0; tmp = 0.0; if (t_0) tmp = exp(re); elseif (t_0) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = LessEqual[N[Exp[re], $MachinePrecision], 1.0]}, If[t$95$0, N[Exp[re], $MachinePrecision], If[t$95$0, N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \leq 1\\
\mathbf{if}\;t\_0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;t\_0:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 1 or 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.7%
Simplified76.7%
if 1 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6447.5%
Simplified47.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (+ 0.5 (* re 0.16666666666666666))))
(t_1 (+ 1.0 t_0))
(t_2 (* re (- -1.0 t_0))))
(if (<= re -0.44)
(exp re)
(if (<= re 0.051)
(/ (* (cos im) (+ 1.0 (* re (* t_1 t_2)))) (+ 1.0 t_2))
(if (<= re 1.02e+103)
(* (exp re) (+ 1.0 (* im (* im -0.5))))
(* (cos im) (+ 1.0 (* re t_1))))))))
double code(double re, double im) {
double t_0 = re * (0.5 + (re * 0.16666666666666666));
double t_1 = 1.0 + t_0;
double t_2 = re * (-1.0 - t_0);
double tmp;
if (re <= -0.44) {
tmp = exp(re);
} else if (re <= 0.051) {
tmp = (cos(im) * (1.0 + (re * (t_1 * t_2)))) / (1.0 + t_2);
} else if (re <= 1.02e+103) {
tmp = exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = cos(im) * (1.0 + (re * 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 = 1.0d0 + t_0
t_2 = re * ((-1.0d0) - t_0)
if (re <= (-0.44d0)) then
tmp = exp(re)
else if (re <= 0.051d0) then
tmp = (cos(im) * (1.0d0 + (re * (t_1 * t_2)))) / (1.0d0 + t_2)
else if (re <= 1.02d+103) then
tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
else
tmp = cos(im) * (1.0d0 + (re * 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 = 1.0 + t_0;
double t_2 = re * (-1.0 - t_0);
double tmp;
if (re <= -0.44) {
tmp = Math.exp(re);
} else if (re <= 0.051) {
tmp = (Math.cos(im) * (1.0 + (re * (t_1 * t_2)))) / (1.0 + t_2);
} else if (re <= 1.02e+103) {
tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = Math.cos(im) * (1.0 + (re * t_1));
}
return tmp;
}
def code(re, im): t_0 = re * (0.5 + (re * 0.16666666666666666)) t_1 = 1.0 + t_0 t_2 = re * (-1.0 - t_0) tmp = 0 if re <= -0.44: tmp = math.exp(re) elif re <= 0.051: tmp = (math.cos(im) * (1.0 + (re * (t_1 * t_2)))) / (1.0 + t_2) elif re <= 1.02e+103: tmp = math.exp(re) * (1.0 + (im * (im * -0.5))) else: tmp = math.cos(im) * (1.0 + (re * t_1)) return tmp
function code(re, im) t_0 = Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))) t_1 = Float64(1.0 + t_0) t_2 = Float64(re * Float64(-1.0 - t_0)) tmp = 0.0 if (re <= -0.44) tmp = exp(re); elseif (re <= 0.051) tmp = Float64(Float64(cos(im) * Float64(1.0 + Float64(re * Float64(t_1 * t_2)))) / Float64(1.0 + t_2)); elseif (re <= 1.02e+103) tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); else tmp = Float64(cos(im) * Float64(1.0 + Float64(re * t_1))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (0.5 + (re * 0.16666666666666666)); t_1 = 1.0 + t_0; t_2 = re * (-1.0 - t_0); tmp = 0.0; if (re <= -0.44) tmp = exp(re); elseif (re <= 0.051) tmp = (cos(im) * (1.0 + (re * (t_1 * t_2)))) / (1.0 + t_2); elseif (re <= 1.02e+103) tmp = exp(re) * (1.0 + (im * (im * -0.5))); else tmp = cos(im) * (1.0 + (re * 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[(1.0 + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(re * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.44], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.051], N[(N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.02e+103], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\\
t_1 := 1 + t\_0\\
t_2 := re \cdot \left(-1 - t\_0\right)\\
\mathbf{if}\;re \leq -0.44:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.051:\\
\;\;\;\;\frac{\cos im \cdot \left(1 + re \cdot \left(t\_1 \cdot t\_2\right)\right)}{1 + t\_2}\\
\mathbf{elif}\;re \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(1 + re \cdot t\_1\right)\\
\end{array}
\end{array}
if re < -0.440000000000000002Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.0%
if -0.440000000000000002 < re < 0.0509999999999999967Initial 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.4%
Simplified99.4%
flip-+N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr99.4%
if 0.0509999999999999967 < re < 1.01999999999999991e103Initial program 100.0%
Taylor expanded in im around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6483.3%
Simplified83.3%
if 1.01999999999999991e103 < 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 simplification98.2%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(cos im)
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
(if (<= re -0.44)
(exp re)
(if (<= re 0.055)
t_0
(if (<= re 1.02e+103) (* (exp re) (+ 1.0 (* im (* im -0.5)))) 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.44) {
tmp = exp(re);
} else if (re <= 0.055) {
tmp = t_0;
} else if (re <= 1.02e+103) {
tmp = exp(re) * (1.0 + (im * (im * -0.5)));
} 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.44d0)) then
tmp = exp(re)
else if (re <= 0.055d0) then
tmp = t_0
else if (re <= 1.02d+103) then
tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
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.44) {
tmp = Math.exp(re);
} else if (re <= 0.055) {
tmp = t_0;
} else if (re <= 1.02e+103) {
tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
} 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.44: tmp = math.exp(re) elif re <= 0.055: tmp = t_0 elif re <= 1.02e+103: tmp = math.exp(re) * (1.0 + (im * (im * -0.5))) 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.44) tmp = exp(re); elseif (re <= 0.055) tmp = t_0; elseif (re <= 1.02e+103) tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); 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.44) tmp = exp(re); elseif (re <= 0.055) tmp = t_0; elseif (re <= 1.02e+103) tmp = exp(re) * (1.0 + (im * (im * -0.5))); 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.44], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.055], t$95$0, If[LessEqual[re, 1.02e+103], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $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.44:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.055:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -0.440000000000000002Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.0%
if -0.440000000000000002 < re < 0.0550000000000000003 or 1.01999999999999991e103 < 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.6%
Simplified99.6%
if 0.0550000000000000003 < re < 1.01999999999999991e103Initial program 100.0%
Taylor expanded in im around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6483.3%
Simplified83.3%
Final simplification98.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos im) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))))
(if (<= re -0.44)
(exp re)
(if (<= re 0.0028) 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.44) {
tmp = exp(re);
} else if (re <= 0.0028) {
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.44d0)) then
tmp = exp(re)
else if (re <= 0.0028d0) 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.44) {
tmp = Math.exp(re);
} else if (re <= 0.0028) {
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.44: tmp = math.exp(re) elif re <= 0.0028: 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.44) tmp = exp(re); elseif (re <= 0.0028) 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.44) tmp = exp(re); elseif (re <= 0.0028) 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.44], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0028], 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.44:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0028:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -0.440000000000000002 or 0.00279999999999999997 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6495.3%
Simplified95.3%
if -0.440000000000000002 < re < 0.00279999999999999997 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.5%
Simplified99.5%
Final simplification97.7%
(FPCore (re im) :precision binary64 (if (<= re -0.44) (exp re) (if (<= re 0.000105) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -0.44) {
tmp = exp(re);
} else if (re <= 0.000105) {
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.44d0)) then
tmp = exp(re)
else if (re <= 0.000105d0) 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.44) {
tmp = Math.exp(re);
} else if (re <= 0.000105) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.44: tmp = math.exp(re) elif re <= 0.000105: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.44) tmp = exp(re); elseif (re <= 0.000105) 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.44) tmp = exp(re); elseif (re <= 0.000105) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.44], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.000105], 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.44:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.000105:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -0.440000000000000002 or 1.05e-4 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6492.6%
Simplified92.6%
if -0.440000000000000002 < re < 1.05e-4Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6498.9%
Simplified98.9%
Final simplification95.6%
(FPCore (re im)
:precision binary64
(if (<= re -1.32e+154)
(* re (* re (* re (/ 1.0 (* re re)))))
(if (<= re 8.0)
(cos im)
(if (<= re 1.8e+39)
(+
1.0
(*
(* im im)
(+
-0.5
(*
im
(*
(* im im)
(*
im
(-
-0.001388888888888889
(/ -0.041666666666666664 (* im im)))))))))
(+
1.0
(*
re
(+
1.0
(*
re
(/
(+
(* 0.25 (- 0.5 (* re 0.16666666666666666)))
(*
(* (* re re) 0.027777777777777776)
(- (* re 0.16666666666666666) 0.5)))
0.25)))))))))
double code(double re, double im) {
double tmp;
if (re <= -1.32e+154) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else if (re <= 8.0) {
tmp = cos(im);
} else if (re <= 1.8e+39) {
tmp = 1.0 + ((im * im) * (-0.5 + (im * ((im * im) * (im * (-0.001388888888888889 - (-0.041666666666666664 / (im * im))))))));
} else {
tmp = 1.0 + (re * (1.0 + (re * (((0.25 * (0.5 - (re * 0.16666666666666666))) + (((re * re) * 0.027777777777777776) * ((re * 0.16666666666666666) - 0.5))) / 0.25))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-1.32d+154)) then
tmp = re * (re * (re * (1.0d0 / (re * re))))
else if (re <= 8.0d0) then
tmp = cos(im)
else if (re <= 1.8d+39) then
tmp = 1.0d0 + ((im * im) * ((-0.5d0) + (im * ((im * im) * (im * ((-0.001388888888888889d0) - ((-0.041666666666666664d0) / (im * im))))))))
else
tmp = 1.0d0 + (re * (1.0d0 + (re * (((0.25d0 * (0.5d0 - (re * 0.16666666666666666d0))) + (((re * re) * 0.027777777777777776d0) * ((re * 0.16666666666666666d0) - 0.5d0))) / 0.25d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -1.32e+154) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else if (re <= 8.0) {
tmp = Math.cos(im);
} else if (re <= 1.8e+39) {
tmp = 1.0 + ((im * im) * (-0.5 + (im * ((im * im) * (im * (-0.001388888888888889 - (-0.041666666666666664 / (im * im))))))));
} else {
tmp = 1.0 + (re * (1.0 + (re * (((0.25 * (0.5 - (re * 0.16666666666666666))) + (((re * re) * 0.027777777777777776) * ((re * 0.16666666666666666) - 0.5))) / 0.25))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -1.32e+154: tmp = re * (re * (re * (1.0 / (re * re)))) elif re <= 8.0: tmp = math.cos(im) elif re <= 1.8e+39: tmp = 1.0 + ((im * im) * (-0.5 + (im * ((im * im) * (im * (-0.001388888888888889 - (-0.041666666666666664 / (im * im)))))))) else: tmp = 1.0 + (re * (1.0 + (re * (((0.25 * (0.5 - (re * 0.16666666666666666))) + (((re * re) * 0.027777777777777776) * ((re * 0.16666666666666666) - 0.5))) / 0.25)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -1.32e+154) tmp = Float64(re * Float64(re * Float64(re * Float64(1.0 / Float64(re * re))))); elseif (re <= 8.0) tmp = cos(im); elseif (re <= 1.8e+39) tmp = Float64(1.0 + Float64(Float64(im * im) * Float64(-0.5 + Float64(im * Float64(Float64(im * im) * Float64(im * Float64(-0.001388888888888889 - Float64(-0.041666666666666664 / Float64(im * im))))))))); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(Float64(Float64(0.25 * Float64(0.5 - Float64(re * 0.16666666666666666))) + Float64(Float64(Float64(re * re) * 0.027777777777777776) * Float64(Float64(re * 0.16666666666666666) - 0.5))) / 0.25))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -1.32e+154) tmp = re * (re * (re * (1.0 / (re * re)))); elseif (re <= 8.0) tmp = cos(im); elseif (re <= 1.8e+39) tmp = 1.0 + ((im * im) * (-0.5 + (im * ((im * im) * (im * (-0.001388888888888889 - (-0.041666666666666664 / (im * im)))))))); else tmp = 1.0 + (re * (1.0 + (re * (((0.25 * (0.5 - (re * 0.16666666666666666))) + (((re * re) * 0.027777777777777776) * ((re * 0.16666666666666666) - 0.5))) / 0.25)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -1.32e+154], N[(re * N[(re * N[(re * N[(1.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 8.0], N[Cos[im], $MachinePrecision], If[LessEqual[re, 1.8e+39], N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(-0.5 + N[(im * N[(N[(im * im), $MachinePrecision] * N[(im * N[(-0.001388888888888889 - N[(-0.041666666666666664 / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(N[(N[(0.25 * N[(0.5 - N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(re * re), $MachinePrecision] * 0.027777777777777776), $MachinePrecision] * N[(N[(re * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot \frac{1}{re \cdot re}\right)\right)\\
\mathbf{elif}\;re \leq 8:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 1.8 \cdot 10^{+39}:\\
\;\;\;\;1 + \left(im \cdot im\right) \cdot \left(-0.5 + im \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot \left(-0.001388888888888889 - \frac{-0.041666666666666664}{im \cdot im}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \frac{0.25 \cdot \left(0.5 - re \cdot 0.16666666666666666\right) + \left(\left(re \cdot re\right) \cdot 0.027777777777777776\right) \cdot \left(re \cdot 0.16666666666666666 - 0.5\right)}{0.25}\right)\\
\end{array}
\end{array}
if re < -1.31999999999999998e154Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.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-*.f641.6%
Simplified1.6%
Taylor expanded in re around -inf
mul-1-negN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Simplified1.6%
Taylor expanded in re around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64100.0%
Simplified100.0%
if -1.31999999999999998e154 < re < 8Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6475.4%
Simplified75.4%
if 8 < re < 1.79999999999999992e39Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f644.0%
Simplified4.0%
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
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6439.0%
Simplified39.0%
Taylor expanded in im around inf
unpow3N/A
unpow2N/A
sub-negN/A
remove-double-negN/A
distribute-neg-inN/A
+-commutativeN/A
sub-negN/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
Simplified47.5%
if 1.79999999999999992e39 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6487.8%
Simplified87.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-*.f6465.0%
Simplified65.0%
flip-+N/A
div-subN/A
frac-subN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
swap-sqrN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
Applied egg-rr14.0%
Taylor expanded in re around 0
Simplified80.4%
Final simplification78.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5))))
(if (<= re -700.0)
(* re (* re (* re (/ 1.0 (* re re)))))
(if (<= re 5e+102)
(+ 1.0 (/ (- (* re re) (* t_0 t_0)) (- re t_0)))
(*
re
(* re (* re (+ 0.16666666666666666 (/ (+ 0.5 (/ 1.0 re)) re)))))))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double tmp;
if (re <= -700.0) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else if (re <= 5e+102) {
tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
} else {
tmp = re * (re * (re * (0.16666666666666666 + ((0.5 + (1.0 / 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 = re * (re * 0.5d0)
if (re <= (-700.0d0)) then
tmp = re * (re * (re * (1.0d0 / (re * re))))
else if (re <= 5d+102) then
tmp = 1.0d0 + (((re * re) - (t_0 * t_0)) / (re - t_0))
else
tmp = re * (re * (re * (0.16666666666666666d0 + ((0.5d0 + (1.0d0 / re)) / re))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * 0.5);
double tmp;
if (re <= -700.0) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else if (re <= 5e+102) {
tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0));
} else {
tmp = re * (re * (re * (0.16666666666666666 + ((0.5 + (1.0 / re)) / re))));
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) tmp = 0 if re <= -700.0: tmp = re * (re * (re * (1.0 / (re * re)))) elif re <= 5e+102: tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0)) else: tmp = re * (re * (re * (0.16666666666666666 + ((0.5 + (1.0 / re)) / re)))) return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) tmp = 0.0 if (re <= -700.0) tmp = Float64(re * Float64(re * Float64(re * Float64(1.0 / Float64(re * re))))); elseif (re <= 5e+102) tmp = Float64(1.0 + Float64(Float64(Float64(re * re) - Float64(t_0 * t_0)) / Float64(re - t_0))); else tmp = Float64(re * Float64(re * Float64(re * Float64(0.16666666666666666 + Float64(Float64(0.5 + Float64(1.0 / re)) / re))))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); tmp = 0.0; if (re <= -700.0) tmp = re * (re * (re * (1.0 / (re * re)))); elseif (re <= 5e+102) tmp = 1.0 + (((re * re) - (t_0 * t_0)) / (re - t_0)); else tmp = re * (re * (re * (0.16666666666666666 + ((0.5 + (1.0 / re)) / re)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -700.0], N[(re * N[(re * N[(re * N[(1.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5e+102], 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], N[(re * N[(re * N[(re * N[(0.16666666666666666 + N[(N[(0.5 + N[(1.0 / re), $MachinePrecision]), $MachinePrecision] / re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
\mathbf{if}\;re \leq -700:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot \frac{1}{re \cdot re}\right)\right)\\
\mathbf{elif}\;re \leq 5 \cdot 10^{+102}:\\
\;\;\;\;1 + \frac{re \cdot re - t\_0 \cdot t\_0}{re - t\_0}\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot \left(0.16666666666666666 + \frac{0.5 + \frac{1}{re}}{re}\right)\right)\right)\\
\end{array}
\end{array}
if re < -700Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.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-*.f641.7%
Simplified1.7%
Taylor expanded in re around -inf
mul-1-negN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Simplified1.7%
Taylor expanded in re around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6452.6%
Simplified52.6%
if -700 < re < 5e102Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6462.0%
Simplified62.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6449.5%
Simplified49.5%
distribute-lft-inN/A
*-rgt-identityN/A
flip-+N/A
*-rgt-identityN/A
fmm-defN/A
*-commutativeN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
fmm-defN/A
*-rgt-identityN/A
Applied egg-rr52.8%
if 5e102 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6486.1%
Simplified86.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6486.1%
Simplified86.1%
Taylor expanded in re around -inf
mul-1-negN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Simplified86.1%
(FPCore (re im)
:precision binary64
(if (<= re -3.2)
(* re (* re (* re (/ 1.0 (* re re)))))
(+
1.0
(*
re
(+
1.0
(*
re
(/
(+
(* 0.25 (- 0.5 (* re 0.16666666666666666)))
(*
(* (* re re) 0.027777777777777776)
(- (* re 0.16666666666666666) 0.5)))
0.25)))))))
double code(double re, double im) {
double tmp;
if (re <= -3.2) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else {
tmp = 1.0 + (re * (1.0 + (re * (((0.25 * (0.5 - (re * 0.16666666666666666))) + (((re * re) * 0.027777777777777776) * ((re * 0.16666666666666666) - 0.5))) / 0.25))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-3.2d0)) then
tmp = re * (re * (re * (1.0d0 / (re * re))))
else
tmp = 1.0d0 + (re * (1.0d0 + (re * (((0.25d0 * (0.5d0 - (re * 0.16666666666666666d0))) + (((re * re) * 0.027777777777777776d0) * ((re * 0.16666666666666666d0) - 0.5d0))) / 0.25d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -3.2) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else {
tmp = 1.0 + (re * (1.0 + (re * (((0.25 * (0.5 - (re * 0.16666666666666666))) + (((re * re) * 0.027777777777777776) * ((re * 0.16666666666666666) - 0.5))) / 0.25))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3.2: tmp = re * (re * (re * (1.0 / (re * re)))) else: tmp = 1.0 + (re * (1.0 + (re * (((0.25 * (0.5 - (re * 0.16666666666666666))) + (((re * re) * 0.027777777777777776) * ((re * 0.16666666666666666) - 0.5))) / 0.25)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -3.2) tmp = Float64(re * Float64(re * Float64(re * Float64(1.0 / Float64(re * re))))); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(Float64(Float64(0.25 * Float64(0.5 - Float64(re * 0.16666666666666666))) + Float64(Float64(Float64(re * re) * 0.027777777777777776) * Float64(Float64(re * 0.16666666666666666) - 0.5))) / 0.25))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -3.2) tmp = re * (re * (re * (1.0 / (re * re)))); else tmp = 1.0 + (re * (1.0 + (re * (((0.25 * (0.5 - (re * 0.16666666666666666))) + (((re * re) * 0.027777777777777776) * ((re * 0.16666666666666666) - 0.5))) / 0.25)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3.2], N[(re * N[(re * N[(re * N[(1.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(N[(N[(0.25 * N[(0.5 - N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(re * re), $MachinePrecision] * 0.027777777777777776), $MachinePrecision] * N[(N[(re * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -3.2:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot \frac{1}{re \cdot re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \frac{0.25 \cdot \left(0.5 - re \cdot 0.16666666666666666\right) + \left(\left(re \cdot re\right) \cdot 0.027777777777777776\right) \cdot \left(re \cdot 0.16666666666666666 - 0.5\right)}{0.25}\right)\\
\end{array}
\end{array}
if re < -3.2000000000000002Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.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-*.f641.7%
Simplified1.7%
Taylor expanded in re around -inf
mul-1-negN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Simplified1.7%
Taylor expanded in re around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6452.6%
Simplified52.6%
if -3.2000000000000002 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6466.8%
Simplified66.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-*.f6457.0%
Simplified57.0%
flip-+N/A
div-subN/A
frac-subN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
swap-sqrN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
Applied egg-rr43.1%
Taylor expanded in re around 0
Simplified61.2%
Final simplification58.6%
(FPCore (re im)
:precision binary64
(if (<= re -700.0)
(* re (* re (* re (/ 1.0 (* re re)))))
(if (<= re 1.8)
(+ 1.0 (* re (+ 1.0 (* re 0.5))))
(* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
double tmp;
if (re <= -700.0) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else if (re <= 1.8) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else {
tmp = 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 <= (-700.0d0)) then
tmp = re * (re * (re * (1.0d0 / (re * re))))
else if (re <= 1.8d0) then
tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
else
tmp = 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 <= -700.0) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else if (re <= 1.8) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else {
tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -700.0: tmp = re * (re * (re * (1.0 / (re * re)))) elif re <= 1.8: tmp = 1.0 + (re * (1.0 + (re * 0.5))) else: tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -700.0) tmp = Float64(re * Float64(re * Float64(re * Float64(1.0 / Float64(re * re))))); elseif (re <= 1.8) tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))); else tmp = 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 <= -700.0) tmp = re * (re * (re * (1.0 / (re * re)))); elseif (re <= 1.8) tmp = 1.0 + (re * (1.0 + (re * 0.5))); else tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -700.0], N[(re * N[(re * N[(re * N[(1.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.8], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -700:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot \frac{1}{re \cdot re}\right)\right)\\
\mathbf{elif}\;re \leq 1.8:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -700Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.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-*.f641.7%
Simplified1.7%
Taylor expanded in re around -inf
mul-1-negN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Simplified1.7%
Taylor expanded in re around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6452.6%
Simplified52.6%
if -700 < re < 1.80000000000000004Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6458.6%
Simplified58.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6458.6%
Simplified58.6%
if 1.80000000000000004 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6483.3%
Simplified83.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.8%
Simplified53.8%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
rgt-mult-inverseN/A
+-commutativeN/A
*-lowering-*.f64N/A
Simplified53.8%
(FPCore (re im)
:precision binary64
(if (<= re -700.0)
(* re (* re (* re (/ 1.0 (* re re)))))
(if (<= re 2.85)
(+ 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 <= -700.0) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else if (re <= 2.85) {
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 <= (-700.0d0)) then
tmp = re * (re * (re * (1.0d0 / (re * re))))
else if (re <= 2.85d0) 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 <= -700.0) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else if (re <= 2.85) {
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 <= -700.0: tmp = re * (re * (re * (1.0 / (re * re)))) elif re <= 2.85: 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 <= -700.0) tmp = Float64(re * Float64(re * Float64(re * Float64(1.0 / Float64(re * re))))); elseif (re <= 2.85) 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 <= -700.0) tmp = re * (re * (re * (1.0 / (re * re)))); elseif (re <= 2.85) 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, -700.0], N[(re * N[(re * N[(re * N[(1.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.85], 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 -700:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot \frac{1}{re \cdot re}\right)\right)\\
\mathbf{elif}\;re \leq 2.85:\\
\;\;\;\;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 < -700Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.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-*.f641.7%
Simplified1.7%
Taylor expanded in re around -inf
mul-1-negN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Simplified1.7%
Taylor expanded in re around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6452.6%
Simplified52.6%
if -700 < re < 2.85000000000000009Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6458.6%
Simplified58.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6458.6%
Simplified58.6%
if 2.85000000000000009 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6483.3%
Simplified83.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.8%
Simplified53.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-*.f6453.8%
Simplified53.8%
(FPCore (re im) :precision binary64 (if (<= re -3.5) (* re (* re (* re (/ 1.0 (* re re))))) (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
double tmp;
if (re <= -3.5) {
tmp = re * (re * (re * (1.0 / (re * re))));
} 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 <= (-3.5d0)) then
tmp = re * (re * (re * (1.0d0 / (re * re))))
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 <= -3.5) {
tmp = re * (re * (re * (1.0 / (re * re))));
} else {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3.5: tmp = re * (re * (re * (1.0 / (re * re)))) else: tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) return tmp
function code(re, im) tmp = 0.0 if (re <= -3.5) tmp = Float64(re * Float64(re * Float64(re * Float64(1.0 / Float64(re * re))))); 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 <= -3.5) tmp = re * (re * (re * (1.0 / (re * re)))); else tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3.5], N[(re * N[(re * N[(re * N[(1.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $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 -3.5:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot \frac{1}{re \cdot re}\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 < -3.5Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.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-*.f641.7%
Simplified1.7%
Taylor expanded in re around -inf
mul-1-negN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Simplified1.7%
Taylor expanded in re around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6452.6%
Simplified52.6%
if -3.5 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6466.8%
Simplified66.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-*.f6457.0%
Simplified57.0%
(FPCore (re im) :precision binary64 (if (<= re 1.86) (+ re 1.0) (* re (* re (+ 0.5 (* re 0.16666666666666666))))))
double code(double re, double im) {
double tmp;
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 <= 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 <= 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 <= 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 <= 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 <= 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, 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 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.8600000000000001Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6474.6%
Simplified74.6%
Taylor expanded in re around 0
+-lowering-+.f6436.6%
Simplified36.6%
if 1.8600000000000001 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6483.3%
Simplified83.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.8%
Simplified53.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-*.f6453.8%
Simplified53.8%
Final simplification40.6%
(FPCore (re im) :precision binary64 (if (<= re 2.9) (+ re 1.0) (* 0.16666666666666666 (* re (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 2.9) {
tmp = re + 1.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) :: tmp
if (re <= 2.9d0) then
tmp = re + 1.0d0
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 <= 2.9) {
tmp = re + 1.0;
} else {
tmp = 0.16666666666666666 * (re * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.9: tmp = re + 1.0 else: tmp = 0.16666666666666666 * (re * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.9) tmp = Float64(re + 1.0); 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 <= 2.9) tmp = re + 1.0; else tmp = 0.16666666666666666 * (re * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.9], N[(re + 1.0), $MachinePrecision], N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.9:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 2.89999999999999991Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6474.6%
Simplified74.6%
Taylor expanded in re around 0
+-lowering-+.f6436.6%
Simplified36.6%
if 2.89999999999999991 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6483.3%
Simplified83.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.8%
Simplified53.8%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.8%
Simplified53.8%
Final simplification40.6%
(FPCore (re im) :precision binary64 (if (<= re 2.8) (+ re 1.0) (* 0.5 (* re re))))
double code(double re, double im) {
double tmp;
if (re <= 2.8) {
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.8d0) 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.8) {
tmp = re + 1.0;
} else {
tmp = 0.5 * (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.8: tmp = re + 1.0 else: tmp = 0.5 * (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.8) 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.8) tmp = re + 1.0; else tmp = 0.5 * (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.8], N[(re + 1.0), $MachinePrecision], N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.8:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 2.7999999999999998Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6474.6%
Simplified74.6%
Taylor expanded in re around 0
+-lowering-+.f6436.6%
Simplified36.6%
if 2.7999999999999998 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6483.3%
Simplified83.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6444.0%
Simplified44.0%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6444.0%
Simplified44.0%
Final simplification38.3%
(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.f6476.7%
Simplified76.7%
Taylor expanded in re around 0
+-lowering-+.f6429.1%
Simplified29.1%
Final simplification29.1%
(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.f6476.7%
Simplified76.7%
Taylor expanded in re around 0
Simplified28.5%
herbie shell --seed 2024161
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))