
(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 9 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.8) (exp re) (if (<= (exp re) 1.0018) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.8) {
tmp = exp(re);
} else if (exp(re) <= 1.0018) {
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.8d0) then
tmp = exp(re)
else if (exp(re) <= 1.0018d0) 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.8) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 1.0018) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.8: tmp = math.exp(re) elif math.exp(re) <= 1.0018: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.8) tmp = exp(re); elseif (exp(re) <= 1.0018) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.8) tmp = exp(re); elseif (exp(re) <= 1.0018) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.8], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0018], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.8:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1.0018:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.80000000000000004 or 1.00180000000000002 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 89.3%
if 0.80000000000000004 < (exp.f64 re) < 1.00180000000000002Initial program 100.0%
Taylor expanded in re around 0 99.3%
Final simplification94.6%
(FPCore (re im)
:precision binary64
(if (or (<= re -0.27) (and (not (<= re 0.00182)) (<= re 1e+103)))
(exp re)
(*
(cos im)
(+ (+ re 1.0) (* (* re re) (+ 0.5 (* re 0.16666666666666666)))))))
double code(double re, double im) {
double tmp;
if ((re <= -0.27) || (!(re <= 0.00182) && (re <= 1e+103))) {
tmp = exp(re);
} else {
tmp = cos(im) * ((re + 1.0) + ((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 <= (-0.27d0)) .or. (.not. (re <= 0.00182d0)) .and. (re <= 1d+103)) then
tmp = exp(re)
else
tmp = cos(im) * ((re + 1.0d0) + ((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 <= -0.27) || (!(re <= 0.00182) && (re <= 1e+103))) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666))));
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.27) or (not (re <= 0.00182) and (re <= 1e+103)): tmp = math.exp(re) else: tmp = math.cos(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666)))) return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.27) || (!(re <= 0.00182) && (re <= 1e+103))) tmp = exp(re); else tmp = Float64(cos(im) * Float64(Float64(re + 1.0) + Float64(Float64(re * re) * Float64(0.5 + Float64(re * 0.16666666666666666))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -0.27) || (~((re <= 0.00182)) && (re <= 1e+103))) tmp = exp(re); else tmp = cos(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666)))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.27], And[N[Not[LessEqual[re, 0.00182]], $MachinePrecision], LessEqual[re, 1e+103]]], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.27 \lor \neg \left(re \leq 0.00182\right) \land re \leq 10^{+103}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + \left(re \cdot re\right) \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -0.27000000000000002 or 0.00182 < re < 1e103Initial program 100.0%
Taylor expanded in im around 0 95.9%
if -0.27000000000000002 < re < 0.00182 or 1e103 < re Initial program 100.0%
Taylor expanded in re around 0 99.5%
associate-+r+99.5%
*-commutative99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r*99.5%
distribute-rgt-out99.5%
*-commutative99.5%
*-commutative99.5%
distribute-lft1-in99.5%
distribute-rgt-out99.5%
+-commutative99.5%
cube-mult99.5%
unpow299.5%
associate-*r*99.5%
Simplified99.5%
Final simplification98.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5))))
(if (<= re -0.27)
(exp re)
(if (<= re 0.00182)
(* (cos im) (+ (+ re 1.0) t_0))
(if (<= re 1.9e+154) (exp re) (* (cos im) t_0))))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double tmp;
if (re <= -0.27) {
tmp = exp(re);
} else if (re <= 0.00182) {
tmp = cos(im) * ((re + 1.0) + t_0);
} else if (re <= 1.9e+154) {
tmp = exp(re);
} else {
tmp = cos(im) * t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = re * (re * 0.5d0)
if (re <= (-0.27d0)) then
tmp = exp(re)
else if (re <= 0.00182d0) then
tmp = cos(im) * ((re + 1.0d0) + t_0)
else if (re <= 1.9d+154) then
tmp = exp(re)
else
tmp = cos(im) * t_0
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 <= -0.27) {
tmp = Math.exp(re);
} else if (re <= 0.00182) {
tmp = Math.cos(im) * ((re + 1.0) + t_0);
} else if (re <= 1.9e+154) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) tmp = 0 if re <= -0.27: tmp = math.exp(re) elif re <= 0.00182: tmp = math.cos(im) * ((re + 1.0) + t_0) elif re <= 1.9e+154: tmp = math.exp(re) else: tmp = math.cos(im) * t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) tmp = 0.0 if (re <= -0.27) tmp = exp(re); elseif (re <= 0.00182) tmp = Float64(cos(im) * Float64(Float64(re + 1.0) + t_0)); elseif (re <= 1.9e+154) tmp = exp(re); else tmp = Float64(cos(im) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); tmp = 0.0; if (re <= -0.27) tmp = exp(re); elseif (re <= 0.00182) tmp = cos(im) * ((re + 1.0) + t_0); elseif (re <= 1.9e+154) tmp = exp(re); else tmp = cos(im) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.27], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.00182], N[(N[Cos[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.9e+154], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
\mathbf{if}\;re \leq -0.27:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.00182:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + t_0\right)\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot t_0\\
\end{array}
\end{array}
if re < -0.27000000000000002 or 0.00182 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 96.3%
if -0.27000000000000002 < re < 0.00182Initial program 100.0%
Taylor expanded in re around 0 99.2%
*-commutative99.2%
associate-*r*99.2%
*-commutative99.2%
distribute-lft1-in99.2%
distribute-rgt-out99.2%
+-commutative99.2%
*-commutative99.2%
unpow299.2%
associate-*l*99.2%
Simplified99.2%
if 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (re im)
:precision binary64
(if (<= re -0.27)
(exp re)
(if (<= re 0.0017)
(* (cos im) (+ re 1.0))
(if (<= re 1.9e+154) (exp re) (* (cos im) (* re (* re 0.5)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.27) {
tmp = exp(re);
} else if (re <= 0.0017) {
tmp = cos(im) * (re + 1.0);
} else if (re <= 1.9e+154) {
tmp = exp(re);
} else {
tmp = cos(im) * (re * (re * 0.5));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-0.27d0)) then
tmp = exp(re)
else if (re <= 0.0017d0) then
tmp = cos(im) * (re + 1.0d0)
else if (re <= 1.9d+154) then
tmp = exp(re)
else
tmp = cos(im) * (re * (re * 0.5d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.27) {
tmp = Math.exp(re);
} else if (re <= 0.0017) {
tmp = Math.cos(im) * (re + 1.0);
} else if (re <= 1.9e+154) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.27: tmp = math.exp(re) elif re <= 0.0017: tmp = math.cos(im) * (re + 1.0) elif re <= 1.9e+154: tmp = math.exp(re) else: tmp = math.cos(im) * (re * (re * 0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.27) tmp = exp(re); elseif (re <= 0.0017) tmp = Float64(cos(im) * Float64(re + 1.0)); elseif (re <= 1.9e+154) tmp = exp(re); else tmp = Float64(cos(im) * Float64(re * Float64(re * 0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.27) tmp = exp(re); elseif (re <= 0.0017) tmp = cos(im) * (re + 1.0); elseif (re <= 1.9e+154) tmp = exp(re); else tmp = cos(im) * (re * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.27], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0017], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.9e+154], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.27:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0017:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.27000000000000002 or 0.00169999999999999991 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 96.3%
if -0.27000000000000002 < re < 0.00169999999999999991Initial program 100.0%
Taylor expanded in re around 0 99.1%
*-rgt-identity99.1%
distribute-lft-in99.1%
Simplified99.1%
if 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification98.3%
(FPCore (re im) :precision binary64 (if (<= re -0.27) (exp re) (if (<= re 0.00175) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -0.27) {
tmp = exp(re);
} else if (re <= 0.00175) {
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.27d0)) then
tmp = exp(re)
else if (re <= 0.00175d0) 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.27) {
tmp = Math.exp(re);
} else if (re <= 0.00175) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.27: tmp = math.exp(re) elif re <= 0.00175: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.27) tmp = exp(re); elseif (re <= 0.00175) 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.27) tmp = exp(re); elseif (re <= 0.00175) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.27], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.00175], 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.27:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.00175:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -0.27000000000000002 or 0.00175000000000000004 < re Initial program 100.0%
Taylor expanded in im around 0 89.8%
if -0.27000000000000002 < re < 0.00175000000000000004Initial program 100.0%
Taylor expanded in re around 0 99.1%
*-rgt-identity99.1%
distribute-lft-in99.1%
Simplified99.1%
Final simplification94.8%
(FPCore (re im) :precision binary64 (if (<= re 3.8e+56) (cos im) (* re (* re 0.5))))
double code(double re, double im) {
double tmp;
if (re <= 3.8e+56) {
tmp = cos(im);
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 3.8d+56) then
tmp = cos(im)
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 3.8e+56) {
tmp = Math.cos(im);
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 3.8e+56: tmp = math.cos(im) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 3.8e+56) tmp = cos(im); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 3.8e+56) tmp = cos(im); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 3.8e+56], N[Cos[im], $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 3.8 \cdot 10^{+56}:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 3.79999999999999996e56Initial program 100.0%
Taylor expanded in re around 0 67.0%
if 3.79999999999999996e56 < re Initial program 100.0%
Taylor expanded in re around 0 79.2%
*-commutative79.2%
associate-*r*79.2%
*-commutative79.2%
distribute-lft1-in79.2%
distribute-rgt-out79.2%
+-commutative79.2%
*-commutative79.2%
unpow279.2%
associate-*l*79.2%
Simplified79.2%
Taylor expanded in re around inf 79.2%
unpow279.2%
*-commutative79.2%
associate-*r*79.2%
associate-*r*79.2%
Simplified79.2%
Taylor expanded in im around 0 60.9%
*-commutative60.9%
unpow260.9%
associate-*r*60.9%
Simplified60.9%
Final simplification65.9%
(FPCore (re im) :precision binary64 (if (<= re 16.5) (+ re 1.0) (* re (* re 0.5))))
double code(double re, double im) {
double tmp;
if (re <= 16.5) {
tmp = re + 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 16.5d0) then
tmp = re + 1.0d0
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 16.5) {
tmp = re + 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 16.5: tmp = re + 1.0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 16.5) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 16.5) tmp = re + 1.0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 16.5], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 16.5:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 16.5Initial program 100.0%
Taylor expanded in re around 0 71.0%
*-rgt-identity71.0%
distribute-lft-in71.0%
Simplified71.0%
Taylor expanded in im around 0 41.2%
if 16.5 < re Initial program 100.0%
Taylor expanded in re around 0 64.4%
*-commutative64.4%
associate-*r*64.4%
*-commutative64.4%
distribute-lft1-in64.4%
distribute-rgt-out64.4%
+-commutative64.4%
*-commutative64.4%
unpow264.4%
associate-*l*64.4%
Simplified64.4%
Taylor expanded in re around inf 64.4%
unpow264.4%
*-commutative64.4%
associate-*r*64.4%
associate-*r*64.4%
Simplified64.4%
Taylor expanded in im around 0 49.5%
*-commutative49.5%
unpow249.5%
associate-*r*49.5%
Simplified49.5%
Final simplification43.2%
(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 55.4%
*-rgt-identity55.4%
distribute-lft-in55.4%
Simplified55.4%
Taylor expanded in im around 0 32.4%
Final simplification32.4%
herbie shell --seed 2023182
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))