
(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 14 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%
Final simplification100.0%
(FPCore (re im) :precision binary64 (if (<= (exp re) 0.999999998) (exp re) (if (<= (exp re) 1.00000002) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.999999998) {
tmp = exp(re);
} else if (exp(re) <= 1.00000002) {
tmp = cos(im);
} else {
tmp = exp(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (exp(re) <= 0.999999998d0) then
tmp = exp(re)
else if (exp(re) <= 1.00000002d0) then
tmp = cos(im)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.exp(re) <= 0.999999998) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 1.00000002) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.999999998: tmp = math.exp(re) elif math.exp(re) <= 1.00000002: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.999999998) tmp = exp(re); elseif (exp(re) <= 1.00000002) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.999999998) tmp = exp(re); elseif (exp(re) <= 1.00000002) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.999999998], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.00000002], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.999999998:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1.00000002:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.999999997999999946 or 1.0000000200000001 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 91.7%
if 0.999999997999999946 < (exp.f64 re) < 1.0000000200000001Initial program 100.0%
Taylor expanded in re around 0 99.5%
Final simplification95.9%
(FPCore (re im)
:precision binary64
(if (or (<= re -0.03) (and (not (<= re 4.4e-8)) (<= re 1.02e+103)))
(exp re)
(*
(cos im)
(+ (* (* re re) (+ (* re 0.16666666666666666) 0.5)) (+ re 1.0)))))
double code(double re, double im) {
double tmp;
if ((re <= -0.03) || (!(re <= 4.4e-8) && (re <= 1.02e+103))) {
tmp = exp(re);
} else {
tmp = cos(im) * (((re * re) * ((re * 0.16666666666666666) + 0.5)) + (re + 1.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= (-0.03d0)) .or. (.not. (re <= 4.4d-8)) .and. (re <= 1.02d+103)) then
tmp = exp(re)
else
tmp = cos(im) * (((re * re) * ((re * 0.16666666666666666d0) + 0.5d0)) + (re + 1.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -0.03) || (!(re <= 4.4e-8) && (re <= 1.02e+103))) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (((re * re) * ((re * 0.16666666666666666) + 0.5)) + (re + 1.0));
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.03) or (not (re <= 4.4e-8) and (re <= 1.02e+103)): tmp = math.exp(re) else: tmp = math.cos(im) * (((re * re) * ((re * 0.16666666666666666) + 0.5)) + (re + 1.0)) return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.03) || (!(re <= 4.4e-8) && (re <= 1.02e+103))) tmp = exp(re); else tmp = Float64(cos(im) * Float64(Float64(Float64(re * re) * Float64(Float64(re * 0.16666666666666666) + 0.5)) + Float64(re + 1.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -0.03) || (~((re <= 4.4e-8)) && (re <= 1.02e+103))) tmp = exp(re); else tmp = cos(im) * (((re * re) * ((re * 0.16666666666666666) + 0.5)) + (re + 1.0)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.03], And[N[Not[LessEqual[re, 4.4e-8]], $MachinePrecision], LessEqual[re, 1.02e+103]]], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] * N[(N[(re * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.03 \lor \neg \left(re \leq 4.4 \cdot 10^{-8}\right) \land re \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot 0.16666666666666666 + 0.5\right) + \left(re + 1\right)\right)\\
\end{array}
\end{array}
if re < -0.029999999999999999 or 4.3999999999999997e-8 < re < 1.01999999999999991e103Initial program 100.0%
Taylor expanded in im around 0 94.5%
if -0.029999999999999999 < re < 4.3999999999999997e-8 or 1.01999999999999991e103 < re Initial program 100.0%
Taylor expanded in re around 0 99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+l+99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-lft-identity99.9%
distribute-rgt-in99.9%
distribute-lft-out99.9%
Simplified99.9%
Final simplification98.3%
(FPCore (re im)
:precision binary64
(if (<= re -0.017)
(exp re)
(if (or (<= re 4.4e-8) (not (<= re 1.9e+154)))
(* (cos im) (+ (+ re 1.0) (* re (* re 0.5))))
(* (exp re) (+ 1.0 (* -0.5 (* im im)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.017) {
tmp = exp(re);
} else if ((re <= 4.4e-8) || !(re <= 1.9e+154)) {
tmp = cos(im) * ((re + 1.0) + (re * (re * 0.5)));
} 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.017d0)) then
tmp = exp(re)
else if ((re <= 4.4d-8) .or. (.not. (re <= 1.9d+154))) then
tmp = cos(im) * ((re + 1.0d0) + (re * (re * 0.5d0)))
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.017) {
tmp = Math.exp(re);
} else if ((re <= 4.4e-8) || !(re <= 1.9e+154)) {
tmp = Math.cos(im) * ((re + 1.0) + (re * (re * 0.5)));
} else {
tmp = Math.exp(re) * (1.0 + (-0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.017: tmp = math.exp(re) elif (re <= 4.4e-8) or not (re <= 1.9e+154): tmp = math.cos(im) * ((re + 1.0) + (re * (re * 0.5))) else: tmp = math.exp(re) * (1.0 + (-0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.017) tmp = exp(re); elseif ((re <= 4.4e-8) || !(re <= 1.9e+154)) tmp = Float64(cos(im) * Float64(Float64(re + 1.0) + Float64(re * Float64(re * 0.5)))); 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.017) tmp = exp(re); elseif ((re <= 4.4e-8) || ~((re <= 1.9e+154))) tmp = cos(im) * ((re + 1.0) + (re * (re * 0.5))); else tmp = exp(re) * (1.0 + (-0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.017], N[Exp[re], $MachinePrecision], If[Or[LessEqual[re, 4.4e-8], N[Not[LessEqual[re, 1.9e+154]], $MachinePrecision]], N[(N[Cos[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $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.017:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 4.4 \cdot 10^{-8} \lor \neg \left(re \leq 1.9 \cdot 10^{+154}\right):\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + re \cdot \left(re \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if re < -0.017000000000000001Initial program 100.0%
Taylor expanded in im around 0 100.0%
if -0.017000000000000001 < re < 4.3999999999999997e-8 or 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0 99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+l+99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-lft-identity99.9%
distribute-rgt-in99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in re around 0 99.8%
unpow299.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
if 4.3999999999999997e-8 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 10.0%
associate-*r*10.0%
distribute-rgt1-in90.0%
unpow290.0%
Simplified90.0%
Final simplification98.3%
(FPCore (re im) :precision binary64 (if (<= re -0.0036) (exp re) (if (<= re 4.4e-8) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -0.0036) {
tmp = exp(re);
} else if (re <= 4.4e-8) {
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.0036d0)) then
tmp = exp(re)
else if (re <= 4.4d-8) 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.0036) {
tmp = Math.exp(re);
} else if (re <= 4.4e-8) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0036: tmp = math.exp(re) elif re <= 4.4e-8: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0036) tmp = exp(re); elseif (re <= 4.4e-8) 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.0036) tmp = exp(re); elseif (re <= 4.4e-8) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0036], N[Exp[re], $MachinePrecision], If[LessEqual[re, 4.4e-8], 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.0036:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 4.4 \cdot 10^{-8}:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -0.0035999999999999999 or 4.3999999999999997e-8 < re Initial program 100.0%
Taylor expanded in im around 0 92.3%
if -0.0035999999999999999 < re < 4.3999999999999997e-8Initial program 100.0%
Taylor expanded in re around 0 99.6%
distribute-rgt1-in99.6%
Simplified99.6%
Final simplification96.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* im im) (* re -0.5))) (t_1 (- -1.0 t_0)))
(if (<= re -1350000.0)
(* -0.5 (* im im))
(if (<= re 2.35e-8)
(cos im)
(/ (+ (* re re) (* (+ 1.0 t_0) t_1)) (+ re t_1))))))
double code(double re, double im) {
double t_0 = (im * im) * (re * -0.5);
double t_1 = -1.0 - t_0;
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 2.35e-8) {
tmp = cos(im);
} else {
tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (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) :: tmp
t_0 = (im * im) * (re * (-0.5d0))
t_1 = (-1.0d0) - t_0
if (re <= (-1350000.0d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 2.35d-8) then
tmp = cos(im)
else
tmp = ((re * re) + ((1.0d0 + t_0) * t_1)) / (re + t_1)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * im) * (re * -0.5);
double t_1 = -1.0 - t_0;
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 2.35e-8) {
tmp = Math.cos(im);
} else {
tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1);
}
return tmp;
}
def code(re, im): t_0 = (im * im) * (re * -0.5) t_1 = -1.0 - t_0 tmp = 0 if re <= -1350000.0: tmp = -0.5 * (im * im) elif re <= 2.35e-8: tmp = math.cos(im) else: tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1) return tmp
function code(re, im) t_0 = Float64(Float64(im * im) * Float64(re * -0.5)) t_1 = Float64(-1.0 - t_0) tmp = 0.0 if (re <= -1350000.0) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 2.35e-8) tmp = cos(im); else tmp = Float64(Float64(Float64(re * re) + Float64(Float64(1.0 + t_0) * t_1)) / Float64(re + t_1)); end return tmp end
function tmp_2 = code(re, im) t_0 = (im * im) * (re * -0.5); t_1 = -1.0 - t_0; tmp = 0.0; if (re <= -1350000.0) tmp = -0.5 * (im * im); elseif (re <= 2.35e-8) tmp = cos(im); else tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[re, -1350000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.35e-8], N[Cos[im], $MachinePrecision], N[(N[(N[(re * re), $MachinePrecision] + N[(N[(1.0 + t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(re + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \left(re \cdot -0.5\right)\\
t_1 := -1 - t_0\\
\mathbf{if}\;re \leq -1350000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 2.35 \cdot 10^{-8}:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;\frac{re \cdot re + \left(1 + t_0\right) \cdot t_1}{re + t_1}\\
\end{array}
\end{array}
if re < -1.35e6Initial program 100.0%
Taylor expanded in im around 0 84.8%
associate-*r*84.8%
distribute-rgt1-in84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in im around inf 84.8%
*-commutative84.8%
associate-*l*84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in re around 0 13.7%
unpow213.7%
Simplified13.7%
if -1.35e6 < re < 2.3499999999999999e-8Initial program 100.0%
Taylor expanded in re around 0 98.0%
if 2.3499999999999999e-8 < re Initial program 100.0%
Taylor expanded in re around 0 7.9%
distribute-rgt1-in7.9%
Simplified7.9%
Taylor expanded in im around 0 16.2%
associate-+r+16.2%
+-commutative16.2%
unpow216.2%
+-commutative16.2%
Simplified16.2%
Taylor expanded in re around inf 16.2%
*-commutative16.2%
unpow216.2%
*-commutative16.2%
associate-*r*16.2%
*-commutative16.2%
Simplified16.2%
associate-+l+16.2%
flip-+29.9%
+-commutative29.9%
associate-*r*29.9%
*-commutative29.9%
+-commutative29.9%
associate-*r*29.9%
*-commutative29.9%
+-commutative29.9%
associate-*r*29.9%
*-commutative29.9%
Applied egg-rr29.9%
Final simplification64.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* im im) (* re -0.5))) (t_1 (- -1.0 t_0)))
(if (<= re -1350000.0)
(* -0.5 (* im im))
(if (<= re 4.7e-11)
(+ re 1.0)
(/ (+ (* re re) (* (+ 1.0 t_0) t_1)) (+ re t_1))))))
double code(double re, double im) {
double t_0 = (im * im) * (re * -0.5);
double t_1 = -1.0 - t_0;
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 4.7e-11) {
tmp = re + 1.0;
} else {
tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (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) :: tmp
t_0 = (im * im) * (re * (-0.5d0))
t_1 = (-1.0d0) - t_0
if (re <= (-1350000.0d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 4.7d-11) then
tmp = re + 1.0d0
else
tmp = ((re * re) + ((1.0d0 + t_0) * t_1)) / (re + t_1)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * im) * (re * -0.5);
double t_1 = -1.0 - t_0;
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 4.7e-11) {
tmp = re + 1.0;
} else {
tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1);
}
return tmp;
}
def code(re, im): t_0 = (im * im) * (re * -0.5) t_1 = -1.0 - t_0 tmp = 0 if re <= -1350000.0: tmp = -0.5 * (im * im) elif re <= 4.7e-11: tmp = re + 1.0 else: tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1) return tmp
function code(re, im) t_0 = Float64(Float64(im * im) * Float64(re * -0.5)) t_1 = Float64(-1.0 - t_0) tmp = 0.0 if (re <= -1350000.0) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 4.7e-11) tmp = Float64(re + 1.0); else tmp = Float64(Float64(Float64(re * re) + Float64(Float64(1.0 + t_0) * t_1)) / Float64(re + t_1)); end return tmp end
function tmp_2 = code(re, im) t_0 = (im * im) * (re * -0.5); t_1 = -1.0 - t_0; tmp = 0.0; if (re <= -1350000.0) tmp = -0.5 * (im * im); elseif (re <= 4.7e-11) tmp = re + 1.0; else tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[re, -1350000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4.7e-11], N[(re + 1.0), $MachinePrecision], N[(N[(N[(re * re), $MachinePrecision] + N[(N[(1.0 + t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(re + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \left(re \cdot -0.5\right)\\
t_1 := -1 - t_0\\
\mathbf{if}\;re \leq -1350000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 4.7 \cdot 10^{-11}:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\frac{re \cdot re + \left(1 + t_0\right) \cdot t_1}{re + t_1}\\
\end{array}
\end{array}
if re < -1.35e6Initial program 100.0%
Taylor expanded in im around 0 84.8%
associate-*r*84.8%
distribute-rgt1-in84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in im around inf 84.8%
*-commutative84.8%
associate-*l*84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in re around 0 13.7%
unpow213.7%
Simplified13.7%
if -1.35e6 < re < 4.69999999999999993e-11Initial program 100.0%
Taylor expanded in re around 0 98.9%
distribute-rgt1-in98.9%
Simplified98.9%
Taylor expanded in im around 0 47.7%
associate-+r+47.7%
+-commutative47.7%
unpow247.7%
+-commutative47.7%
Simplified47.7%
Taylor expanded in re around inf 48.5%
*-commutative48.5%
unpow248.5%
*-commutative48.5%
associate-*r*48.5%
*-commutative48.5%
Simplified48.5%
Taylor expanded in im around 0 52.2%
+-commutative52.2%
Simplified52.2%
if 4.69999999999999993e-11 < re Initial program 100.0%
Taylor expanded in re around 0 9.2%
distribute-rgt1-in9.1%
Simplified9.1%
Taylor expanded in im around 0 16.1%
associate-+r+16.1%
+-commutative16.1%
unpow216.1%
+-commutative16.1%
Simplified16.1%
Taylor expanded in re around inf 16.1%
*-commutative16.1%
unpow216.1%
*-commutative16.1%
associate-*r*16.1%
*-commutative16.1%
Simplified16.1%
associate-+l+16.1%
flip-+29.7%
+-commutative29.7%
associate-*r*29.7%
*-commutative29.7%
+-commutative29.7%
associate-*r*29.7%
*-commutative29.7%
+-commutative29.7%
associate-*r*29.7%
*-commutative29.7%
Applied egg-rr29.7%
Final simplification39.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.5 (* im im))))
(if (<= re -1350000.0)
t_0
(if (<= re 4.7e-11) (+ re 1.0) (+ (+ re 1.0) (* re t_0))))))
double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double tmp;
if (re <= -1350000.0) {
tmp = t_0;
} else if (re <= 4.7e-11) {
tmp = re + 1.0;
} else {
tmp = (re + 1.0) + (re * 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 = (-0.5d0) * (im * im)
if (re <= (-1350000.0d0)) then
tmp = t_0
else if (re <= 4.7d-11) then
tmp = re + 1.0d0
else
tmp = (re + 1.0d0) + (re * t_0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double tmp;
if (re <= -1350000.0) {
tmp = t_0;
} else if (re <= 4.7e-11) {
tmp = re + 1.0;
} else {
tmp = (re + 1.0) + (re * t_0);
}
return tmp;
}
def code(re, im): t_0 = -0.5 * (im * im) tmp = 0 if re <= -1350000.0: tmp = t_0 elif re <= 4.7e-11: tmp = re + 1.0 else: tmp = (re + 1.0) + (re * t_0) return tmp
function code(re, im) t_0 = Float64(-0.5 * Float64(im * im)) tmp = 0.0 if (re <= -1350000.0) tmp = t_0; elseif (re <= 4.7e-11) tmp = Float64(re + 1.0); else tmp = Float64(Float64(re + 1.0) + Float64(re * t_0)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.5 * (im * im); tmp = 0.0; if (re <= -1350000.0) tmp = t_0; elseif (re <= 4.7e-11) tmp = re + 1.0; else tmp = (re + 1.0) + (re * t_0); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -1350000.0], t$95$0, If[LessEqual[re, 4.7e-11], N[(re + 1.0), $MachinePrecision], N[(N[(re + 1.0), $MachinePrecision] + N[(re * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(im \cdot im\right)\\
\mathbf{if}\;re \leq -1350000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 4.7 \cdot 10^{-11}:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(re + 1\right) + re \cdot t_0\\
\end{array}
\end{array}
if re < -1.35e6Initial program 100.0%
Taylor expanded in im around 0 84.8%
associate-*r*84.8%
distribute-rgt1-in84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in im around inf 84.8%
*-commutative84.8%
associate-*l*84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in re around 0 13.7%
unpow213.7%
Simplified13.7%
if -1.35e6 < re < 4.69999999999999993e-11Initial program 100.0%
Taylor expanded in re around 0 98.9%
distribute-rgt1-in98.9%
Simplified98.9%
Taylor expanded in im around 0 47.7%
associate-+r+47.7%
+-commutative47.7%
unpow247.7%
+-commutative47.7%
Simplified47.7%
Taylor expanded in re around inf 48.5%
*-commutative48.5%
unpow248.5%
*-commutative48.5%
associate-*r*48.5%
*-commutative48.5%
Simplified48.5%
Taylor expanded in im around 0 52.2%
+-commutative52.2%
Simplified52.2%
if 4.69999999999999993e-11 < re Initial program 100.0%
Taylor expanded in re around 0 9.2%
distribute-rgt1-in9.1%
Simplified9.1%
Taylor expanded in im around 0 16.1%
associate-+r+16.1%
+-commutative16.1%
unpow216.1%
+-commutative16.1%
Simplified16.1%
Taylor expanded in re around inf 16.1%
*-commutative16.1%
unpow216.1%
*-commutative16.1%
associate-*r*16.1%
*-commutative16.1%
Simplified16.1%
Final simplification35.3%
(FPCore (re im) :precision binary64 (if (<= re -1350000.0) (* -0.5 (* im im)) (if (<= re 9500000000.0) (+ re 1.0) (* -0.5 (* (+ re 1.0) (* im im))))))
double code(double re, double im) {
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 9500000000.0) {
tmp = re + 1.0;
} else {
tmp = -0.5 * ((re + 1.0) * (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 <= (-1350000.0d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 9500000000.0d0) then
tmp = re + 1.0d0
else
tmp = (-0.5d0) * ((re + 1.0d0) * (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 9500000000.0) {
tmp = re + 1.0;
} else {
tmp = -0.5 * ((re + 1.0) * (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -1350000.0: tmp = -0.5 * (im * im) elif re <= 9500000000.0: tmp = re + 1.0 else: tmp = -0.5 * ((re + 1.0) * (im * im)) return tmp
function code(re, im) tmp = 0.0 if (re <= -1350000.0) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 9500000000.0) tmp = Float64(re + 1.0); else tmp = Float64(-0.5 * Float64(Float64(re + 1.0) * Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -1350000.0) tmp = -0.5 * (im * im); elseif (re <= 9500000000.0) tmp = re + 1.0; else tmp = -0.5 * ((re + 1.0) * (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -1350000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 9500000000.0], N[(re + 1.0), $MachinePrecision], N[(-0.5 * N[(N[(re + 1.0), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1350000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 9500000000:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(\left(re + 1\right) \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if re < -1.35e6Initial program 100.0%
Taylor expanded in im around 0 84.8%
associate-*r*84.8%
distribute-rgt1-in84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in im around inf 84.8%
*-commutative84.8%
associate-*l*84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in re around 0 13.7%
unpow213.7%
Simplified13.7%
if -1.35e6 < re < 9.5e9Initial program 100.0%
Taylor expanded in re around 0 96.9%
distribute-rgt1-in96.9%
Simplified96.9%
Taylor expanded in im around 0 47.2%
associate-+r+47.2%
+-commutative47.2%
unpow247.2%
+-commutative47.2%
Simplified47.2%
Taylor expanded in re around inf 47.9%
*-commutative47.9%
unpow247.9%
*-commutative47.9%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
Taylor expanded in im around 0 51.4%
+-commutative51.4%
Simplified51.4%
if 9.5e9 < re Initial program 100.0%
Taylor expanded in im around 0 0.0%
associate-*r*0.0%
distribute-rgt1-in78.5%
unpow278.5%
Simplified78.5%
Taylor expanded in im around inf 13.8%
*-commutative13.8%
associate-*l*13.8%
unpow213.8%
Simplified13.8%
Taylor expanded in re around 0 11.7%
unpow211.7%
*-commutative11.7%
unpow211.7%
*-commutative11.7%
associate-*r*11.7%
*-commutative11.7%
distribute-lft1-in11.7%
*-commutative11.7%
*-commutative11.7%
associate-*r*11.7%
*-commutative11.7%
+-commutative11.7%
Simplified11.7%
Final simplification34.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.5 (* im im))))
(if (<= re -1350000.0)
t_0
(if (<= re 102000000.0) (+ re 1.0) (* re (+ 1.0 t_0))))))
double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double tmp;
if (re <= -1350000.0) {
tmp = t_0;
} else if (re <= 102000000.0) {
tmp = re + 1.0;
} else {
tmp = re * (1.0 + t_0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.5d0) * (im * im)
if (re <= (-1350000.0d0)) then
tmp = t_0
else if (re <= 102000000.0d0) then
tmp = re + 1.0d0
else
tmp = re * (1.0d0 + t_0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double tmp;
if (re <= -1350000.0) {
tmp = t_0;
} else if (re <= 102000000.0) {
tmp = re + 1.0;
} else {
tmp = re * (1.0 + t_0);
}
return tmp;
}
def code(re, im): t_0 = -0.5 * (im * im) tmp = 0 if re <= -1350000.0: tmp = t_0 elif re <= 102000000.0: tmp = re + 1.0 else: tmp = re * (1.0 + t_0) return tmp
function code(re, im) t_0 = Float64(-0.5 * Float64(im * im)) tmp = 0.0 if (re <= -1350000.0) tmp = t_0; elseif (re <= 102000000.0) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(1.0 + t_0)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.5 * (im * im); tmp = 0.0; if (re <= -1350000.0) tmp = t_0; elseif (re <= 102000000.0) tmp = re + 1.0; else tmp = re * (1.0 + t_0); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -1350000.0], t$95$0, If[LessEqual[re, 102000000.0], N[(re + 1.0), $MachinePrecision], N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(im \cdot im\right)\\
\mathbf{if}\;re \leq -1350000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 102000000:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + t_0\right)\\
\end{array}
\end{array}
if re < -1.35e6Initial program 100.0%
Taylor expanded in im around 0 84.8%
associate-*r*84.8%
distribute-rgt1-in84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in im around inf 84.8%
*-commutative84.8%
associate-*l*84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in re around 0 13.7%
unpow213.7%
Simplified13.7%
if -1.35e6 < re < 1.02e8Initial program 100.0%
Taylor expanded in re around 0 96.9%
distribute-rgt1-in96.9%
Simplified96.9%
Taylor expanded in im around 0 47.2%
associate-+r+47.2%
+-commutative47.2%
unpow247.2%
+-commutative47.2%
Simplified47.2%
Taylor expanded in re around inf 47.9%
*-commutative47.9%
unpow247.9%
*-commutative47.9%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
Taylor expanded in im around 0 51.4%
+-commutative51.4%
Simplified51.4%
if 1.02e8 < re Initial program 100.0%
Taylor expanded in re around 0 5.4%
distribute-rgt1-in5.4%
Simplified5.4%
Taylor expanded in im around 0 14.4%
associate-+r+14.4%
+-commutative14.4%
unpow214.4%
+-commutative14.4%
Simplified14.4%
Taylor expanded in re around inf 14.4%
*-commutative14.4%
unpow214.4%
*-commutative14.4%
associate-*r*14.4%
*-commutative14.4%
Simplified14.4%
Taylor expanded in re around inf 14.4%
unpow214.4%
Simplified14.4%
Final simplification35.2%
(FPCore (re im) :precision binary64 (if (<= re -1350000.0) (* -0.5 (* im im)) (if (<= re 102000000.0) (+ re 1.0) (* -0.5 (* im (* re im))))))
double code(double re, double im) {
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 102000000.0) {
tmp = re + 1.0;
} else {
tmp = -0.5 * (im * (re * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-1350000.0d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 102000000.0d0) then
tmp = re + 1.0d0
else
tmp = (-0.5d0) * (im * (re * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 102000000.0) {
tmp = re + 1.0;
} else {
tmp = -0.5 * (im * (re * im));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -1350000.0: tmp = -0.5 * (im * im) elif re <= 102000000.0: tmp = re + 1.0 else: tmp = -0.5 * (im * (re * im)) return tmp
function code(re, im) tmp = 0.0 if (re <= -1350000.0) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 102000000.0) tmp = Float64(re + 1.0); else tmp = Float64(-0.5 * Float64(im * Float64(re * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -1350000.0) tmp = -0.5 * (im * im); elseif (re <= 102000000.0) tmp = re + 1.0; else tmp = -0.5 * (im * (re * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -1350000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 102000000.0], N[(re + 1.0), $MachinePrecision], N[(-0.5 * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1350000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 102000000:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\
\end{array}
\end{array}
if re < -1.35e6Initial program 100.0%
Taylor expanded in im around 0 84.8%
associate-*r*84.8%
distribute-rgt1-in84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in im around inf 84.8%
*-commutative84.8%
associate-*l*84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in re around 0 13.7%
unpow213.7%
Simplified13.7%
if -1.35e6 < re < 1.02e8Initial program 100.0%
Taylor expanded in re around 0 96.9%
distribute-rgt1-in96.9%
Simplified96.9%
Taylor expanded in im around 0 47.2%
associate-+r+47.2%
+-commutative47.2%
unpow247.2%
+-commutative47.2%
Simplified47.2%
Taylor expanded in re around inf 47.9%
*-commutative47.9%
unpow247.9%
*-commutative47.9%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
Taylor expanded in im around 0 51.4%
+-commutative51.4%
Simplified51.4%
if 1.02e8 < re Initial program 100.0%
Taylor expanded in im around 0 0.0%
associate-*r*0.0%
distribute-rgt1-in78.5%
unpow278.5%
Simplified78.5%
Taylor expanded in im around inf 13.8%
*-commutative13.8%
associate-*l*13.8%
unpow213.8%
Simplified13.8%
Taylor expanded in re around 0 11.7%
unpow211.7%
*-commutative11.7%
unpow211.7%
*-commutative11.7%
associate-*r*11.7%
*-commutative11.7%
distribute-lft1-in11.7%
*-commutative11.7%
*-commutative11.7%
associate-*r*11.7%
*-commutative11.7%
+-commutative11.7%
Simplified11.7%
Taylor expanded in re around inf 11.7%
unpow211.7%
*-commutative11.7%
associate-*r*11.7%
*-commutative11.7%
Simplified11.7%
Final simplification34.5%
(FPCore (re im) :precision binary64 (if (<= re -1350000.0) (* -0.5 (* im im)) (+ re 1.0)))
double code(double re, double im) {
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else {
tmp = re + 1.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-1350000.0d0)) then
tmp = (-0.5d0) * (im * im)
else
tmp = re + 1.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -1350000.0) {
tmp = -0.5 * (im * im);
} else {
tmp = re + 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -1350000.0: tmp = -0.5 * (im * im) else: tmp = re + 1.0 return tmp
function code(re, im) tmp = 0.0 if (re <= -1350000.0) tmp = Float64(-0.5 * Float64(im * im)); else tmp = Float64(re + 1.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -1350000.0) tmp = -0.5 * (im * im); else tmp = re + 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -1350000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], N[(re + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1350000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;re + 1\\
\end{array}
\end{array}
if re < -1.35e6Initial program 100.0%
Taylor expanded in im around 0 84.8%
associate-*r*84.8%
distribute-rgt1-in84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in im around inf 84.8%
*-commutative84.8%
associate-*l*84.8%
unpow284.8%
Simplified84.8%
Taylor expanded in re around 0 13.7%
unpow213.7%
Simplified13.7%
if -1.35e6 < re Initial program 100.0%
Taylor expanded in re around 0 68.6%
distribute-rgt1-in68.6%
Simplified68.6%
Taylor expanded in im around 0 37.0%
associate-+r+37.0%
+-commutative37.0%
unpow237.0%
+-commutative37.0%
Simplified37.0%
Taylor expanded in re around inf 37.6%
*-commutative37.6%
unpow237.6%
*-commutative37.6%
associate-*r*37.6%
*-commutative37.6%
Simplified37.6%
Taylor expanded in im around 0 37.0%
+-commutative37.0%
Simplified37.0%
Final simplification32.8%
(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 re around 0 56.6%
distribute-rgt1-in56.6%
Simplified56.6%
Taylor expanded in im around 0 30.7%
associate-+r+30.7%
+-commutative30.7%
unpow230.7%
+-commutative30.7%
Simplified30.7%
Taylor expanded in re around inf 31.2%
*-commutative31.2%
unpow231.2%
*-commutative31.2%
associate-*r*31.2%
*-commutative31.2%
Simplified31.2%
Taylor expanded in im around 0 30.7%
+-commutative30.7%
Simplified30.7%
Final simplification30.7%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 56.6%
distribute-rgt1-in56.6%
Simplified56.6%
Taylor expanded in im around 0 30.7%
associate-+r+30.7%
+-commutative30.7%
unpow230.7%
+-commutative30.7%
Simplified30.7%
Taylor expanded in re around inf 31.2%
*-commutative31.2%
unpow231.2%
*-commutative31.2%
associate-*r*31.2%
*-commutative31.2%
Simplified31.2%
Taylor expanded in re around 0 30.0%
Final simplification30.0%
herbie shell --seed 2023275
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))