
(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.999995) (exp re) (if (<= (exp re) 1.0000005) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.999995) {
tmp = exp(re);
} else if (exp(re) <= 1.0000005) {
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.999995d0) then
tmp = exp(re)
else if (exp(re) <= 1.0000005d0) 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.999995) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 1.0000005) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.999995: tmp = math.exp(re) elif math.exp(re) <= 1.0000005: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.999995) tmp = exp(re); elseif (exp(re) <= 1.0000005) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.999995) tmp = exp(re); elseif (exp(re) <= 1.0000005) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.999995], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0000005], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.999995:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1.0000005:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.99999499999999997 or 1.0000005000000001 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 90.4%
if 0.99999499999999997 < (exp.f64 re) < 1.0000005000000001Initial program 100.0%
Taylor expanded in re around 0 99.7%
Final simplification94.8%
(FPCore (re im) :precision binary64 (if (or (<= re -0.0136) (and (not (<= re 8e-7)) (<= re 1.35e+154))) (exp re) (* (cos im) (+ (+ re 1.0) (* 0.5 (* re re))))))
double code(double re, double im) {
double tmp;
if ((re <= -0.0136) || (!(re <= 8e-7) && (re <= 1.35e+154))) {
tmp = exp(re);
} else {
tmp = cos(im) * ((re + 1.0) + (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 <= (-0.0136d0)) .or. (.not. (re <= 8d-7)) .and. (re <= 1.35d+154)) then
tmp = exp(re)
else
tmp = cos(im) * ((re + 1.0d0) + (0.5d0 * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -0.0136) || (!(re <= 8e-7) && (re <= 1.35e+154))) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * ((re + 1.0) + (0.5 * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.0136) or (not (re <= 8e-7) and (re <= 1.35e+154)): tmp = math.exp(re) else: tmp = math.cos(im) * ((re + 1.0) + (0.5 * (re * re))) return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.0136) || (!(re <= 8e-7) && (re <= 1.35e+154))) tmp = exp(re); else tmp = Float64(cos(im) * Float64(Float64(re + 1.0) + Float64(0.5 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -0.0136) || (~((re <= 8e-7)) && (re <= 1.35e+154))) tmp = exp(re); else tmp = cos(im) * ((re + 1.0) + (0.5 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.0136], And[N[Not[LessEqual[re, 8e-7]], $MachinePrecision], LessEqual[re, 1.35e+154]]], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0136 \lor \neg \left(re \leq 8 \cdot 10^{-7}\right) \land re \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + 0.5 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < -0.0135999999999999992 or 7.9999999999999996e-7 < re < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in im around 0 92.9%
if -0.0135999999999999992 < re < 7.9999999999999996e-7 or 1.35000000000000003e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
+-commutative100.0%
+-commutative100.0%
*-rgt-identity100.0%
distribute-lft-out99.9%
*-commutative99.9%
associate-*l*99.9%
distribute-lft-out99.9%
*-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification97.2%
(FPCore (re im) :precision binary64 (if (<= re -0.0085) (exp re) (if (<= re 8e-7) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -0.0085) {
tmp = exp(re);
} else if (re <= 8e-7) {
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.0085d0)) then
tmp = exp(re)
else if (re <= 8d-7) 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.0085) {
tmp = Math.exp(re);
} else if (re <= 8e-7) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0085: tmp = math.exp(re) elif re <= 8e-7: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0085) tmp = exp(re); elseif (re <= 8e-7) 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.0085) tmp = exp(re); elseif (re <= 8e-7) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0085], N[Exp[re], $MachinePrecision], If[LessEqual[re, 8e-7], 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.0085:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 8 \cdot 10^{-7}:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -0.0085000000000000006 or 7.9999999999999996e-7 < re Initial program 100.0%
Taylor expanded in im around 0 91.0%
if -0.0085000000000000006 < re < 7.9999999999999996e-7Initial program 100.0%
Taylor expanded in re around 0 99.5%
+-commutative99.5%
*-rgt-identity99.5%
distribute-lft-out99.5%
Simplified99.5%
Final simplification95.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5))) (t_1 (+ re t_0)))
(if (<= re -2.2e+18)
(* -0.5 (* im im))
(if (<= re 2.4e-10)
(cos im)
(if (<= re 1.9e+154) (/ (- 1.0 (* t_1 t_1)) (- 1.0 t_1)) t_0)))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = re + t_0;
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else if (re <= 2.4e-10) {
tmp = cos(im);
} else if (re <= 1.9e+154) {
tmp = (1.0 - (t_1 * t_1)) / (1.0 - t_1);
} 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) :: t_1
real(8) :: tmp
t_0 = re * (re * 0.5d0)
t_1 = re + t_0
if (re <= (-2.2d+18)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 2.4d-10) then
tmp = cos(im)
else if (re <= 1.9d+154) then
tmp = (1.0d0 - (t_1 * t_1)) / (1.0d0 - t_1)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = re + t_0;
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else if (re <= 2.4e-10) {
tmp = Math.cos(im);
} else if (re <= 1.9e+154) {
tmp = (1.0 - (t_1 * t_1)) / (1.0 - t_1);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) t_1 = re + t_0 tmp = 0 if re <= -2.2e+18: tmp = -0.5 * (im * im) elif re <= 2.4e-10: tmp = math.cos(im) elif re <= 1.9e+154: tmp = (1.0 - (t_1 * t_1)) / (1.0 - t_1) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) t_1 = Float64(re + t_0) tmp = 0.0 if (re <= -2.2e+18) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 2.4e-10) tmp = cos(im); elseif (re <= 1.9e+154) tmp = Float64(Float64(1.0 - Float64(t_1 * t_1)) / Float64(1.0 - t_1)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); t_1 = re + t_0; tmp = 0.0; if (re <= -2.2e+18) tmp = -0.5 * (im * im); elseif (re <= 2.4e-10) tmp = cos(im); elseif (re <= 1.9e+154) tmp = (1.0 - (t_1 * t_1)) / (1.0 - t_1); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re + t$95$0), $MachinePrecision]}, If[LessEqual[re, -2.2e+18], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.4e-10], N[Cos[im], $MachinePrecision], If[LessEqual[re, 1.9e+154], N[(N[(1.0 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
t_1 := re + t_0\\
\mathbf{if}\;re \leq -2.2 \cdot 10^{+18}:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 2.4 \cdot 10^{-10}:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 - t_1 \cdot t_1}{1 - t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if re < -2.2e18Initial program 100.0%
Taylor expanded in im around 0 72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in im around inf 72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in re around 0 27.8%
unpow227.8%
Simplified27.8%
if -2.2e18 < re < 2.4e-10Initial program 100.0%
Taylor expanded in re around 0 96.5%
if 2.4e-10 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in re around 0 10.2%
+-commutative10.2%
+-commutative10.2%
*-rgt-identity10.2%
distribute-lft-out10.2%
*-commutative10.2%
associate-*l*10.2%
distribute-lft-out10.2%
*-commutative10.2%
unpow210.2%
Simplified10.2%
Taylor expanded in im around 0 9.3%
associate-+l+9.4%
flip-+51.3%
metadata-eval51.3%
*-commutative51.3%
associate-*l*51.3%
*-commutative51.3%
associate-*l*51.3%
*-commutative51.3%
associate-*l*51.3%
Applied egg-rr51.3%
if 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
+-commutative100.0%
+-commutative100.0%
*-rgt-identity100.0%
distribute-lft-out100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Taylor expanded in re around inf 85.7%
unpow285.7%
*-commutative85.7%
associate-*r*85.7%
Simplified85.7%
Final simplification73.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5))) (t_1 (+ re t_0)))
(if (<= re -2.2e+18)
(* -0.5 (* im im))
(if (<= re 1.9e+154) (/ (- 1.0 (* t_1 t_1)) (- 1.0 t_1)) t_0))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = re + t_0;
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else if (re <= 1.9e+154) {
tmp = (1.0 - (t_1 * t_1)) / (1.0 - t_1);
} 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) :: t_1
real(8) :: tmp
t_0 = re * (re * 0.5d0)
t_1 = re + t_0
if (re <= (-2.2d+18)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 1.9d+154) then
tmp = (1.0d0 - (t_1 * t_1)) / (1.0d0 - t_1)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = re + t_0;
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else if (re <= 1.9e+154) {
tmp = (1.0 - (t_1 * t_1)) / (1.0 - t_1);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) t_1 = re + t_0 tmp = 0 if re <= -2.2e+18: tmp = -0.5 * (im * im) elif re <= 1.9e+154: tmp = (1.0 - (t_1 * t_1)) / (1.0 - t_1) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) t_1 = Float64(re + t_0) tmp = 0.0 if (re <= -2.2e+18) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 1.9e+154) tmp = Float64(Float64(1.0 - Float64(t_1 * t_1)) / Float64(1.0 - t_1)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); t_1 = re + t_0; tmp = 0.0; if (re <= -2.2e+18) tmp = -0.5 * (im * im); elseif (re <= 1.9e+154) tmp = (1.0 - (t_1 * t_1)) / (1.0 - t_1); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re + t$95$0), $MachinePrecision]}, If[LessEqual[re, -2.2e+18], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.9e+154], N[(N[(1.0 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
t_1 := re + t_0\\
\mathbf{if}\;re \leq -2.2 \cdot 10^{+18}:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 - t_1 \cdot t_1}{1 - t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if re < -2.2e18Initial program 100.0%
Taylor expanded in im around 0 72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in im around inf 72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in re around 0 27.8%
unpow227.8%
Simplified27.8%
if -2.2e18 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in re around 0 76.6%
+-commutative76.6%
+-commutative76.6%
*-rgt-identity76.6%
distribute-lft-out76.6%
*-commutative76.6%
associate-*l*76.6%
distribute-lft-out76.6%
*-commutative76.6%
unpow276.6%
Simplified76.6%
Taylor expanded in im around 0 38.1%
associate-+l+38.1%
flip-+48.2%
metadata-eval48.2%
*-commutative48.2%
associate-*l*48.2%
*-commutative48.2%
associate-*l*48.2%
*-commutative48.2%
associate-*l*48.2%
Applied egg-rr48.2%
if 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
+-commutative100.0%
+-commutative100.0%
*-rgt-identity100.0%
distribute-lft-out100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Taylor expanded in re around inf 85.7%
unpow285.7%
*-commutative85.7%
associate-*r*85.7%
Simplified85.7%
Final simplification48.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.5 (* im im))) (t_1 (+ (+ re 1.0) (* 0.5 (* re re)))))
(if (<= re -2.2e+18)
t_0
(if (<= re 1e-13)
t_1
(if (<= re 2.7e+136) (* t_1 (+ 1.0 t_0)) (* re (* re 0.5)))))))
double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double t_1 = (re + 1.0) + (0.5 * (re * re));
double tmp;
if (re <= -2.2e+18) {
tmp = t_0;
} else if (re <= 1e-13) {
tmp = t_1;
} else if (re <= 2.7e+136) {
tmp = t_1 * (1.0 + t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-0.5d0) * (im * im)
t_1 = (re + 1.0d0) + (0.5d0 * (re * re))
if (re <= (-2.2d+18)) then
tmp = t_0
else if (re <= 1d-13) then
tmp = t_1
else if (re <= 2.7d+136) then
tmp = t_1 * (1.0d0 + t_0)
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double t_1 = (re + 1.0) + (0.5 * (re * re));
double tmp;
if (re <= -2.2e+18) {
tmp = t_0;
} else if (re <= 1e-13) {
tmp = t_1;
} else if (re <= 2.7e+136) {
tmp = t_1 * (1.0 + t_0);
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): t_0 = -0.5 * (im * im) t_1 = (re + 1.0) + (0.5 * (re * re)) tmp = 0 if re <= -2.2e+18: tmp = t_0 elif re <= 1e-13: tmp = t_1 elif re <= 2.7e+136: tmp = t_1 * (1.0 + t_0) else: tmp = re * (re * 0.5) return tmp
function code(re, im) t_0 = Float64(-0.5 * Float64(im * im)) t_1 = Float64(Float64(re + 1.0) + Float64(0.5 * Float64(re * re))) tmp = 0.0 if (re <= -2.2e+18) tmp = t_0; elseif (re <= 1e-13) tmp = t_1; elseif (re <= 2.7e+136) tmp = Float64(t_1 * Float64(1.0 + t_0)); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.5 * (im * im); t_1 = (re + 1.0) + (0.5 * (re * re)); tmp = 0.0; if (re <= -2.2e+18) tmp = t_0; elseif (re <= 1e-13) tmp = t_1; elseif (re <= 2.7e+136) tmp = t_1 * (1.0 + t_0); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(re + 1.0), $MachinePrecision] + N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2.2e+18], t$95$0, If[LessEqual[re, 1e-13], t$95$1, If[LessEqual[re, 2.7e+136], N[(t$95$1 * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(im \cdot im\right)\\
t_1 := \left(re + 1\right) + 0.5 \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -2.2 \cdot 10^{+18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 10^{-13}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;re \leq 2.7 \cdot 10^{+136}:\\
\;\;\;\;t_1 \cdot \left(1 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -2.2e18Initial program 100.0%
Taylor expanded in im around 0 72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in im around inf 72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in re around 0 27.8%
unpow227.8%
Simplified27.8%
if -2.2e18 < re < 1e-13Initial program 100.0%
Taylor expanded in re around 0 97.6%
+-commutative97.6%
+-commutative97.6%
*-rgt-identity97.6%
distribute-lft-out97.6%
*-commutative97.6%
associate-*l*97.6%
distribute-lft-out97.6%
*-commutative97.6%
unpow297.6%
Simplified97.6%
Taylor expanded in im around 0 47.5%
if 1e-13 < re < 2.7000000000000002e136Initial program 100.0%
Taylor expanded in re around 0 12.8%
+-commutative12.8%
+-commutative12.8%
*-rgt-identity12.8%
distribute-lft-out12.7%
*-commutative12.7%
associate-*l*12.7%
distribute-lft-out12.7%
*-commutative12.7%
unpow212.7%
Simplified12.7%
Taylor expanded in im around 0 22.0%
unpow269.6%
Simplified22.0%
if 2.7000000000000002e136 < re Initial program 100.0%
Taylor expanded in re around 0 88.7%
+-commutative88.7%
+-commutative88.7%
*-rgt-identity88.7%
distribute-lft-out88.7%
*-commutative88.7%
associate-*l*88.7%
distribute-lft-out88.7%
*-commutative88.7%
unpow288.7%
Simplified88.7%
Taylor expanded in im around 0 76.2%
Taylor expanded in re around inf 76.2%
unpow276.2%
*-commutative76.2%
associate-*r*76.2%
Simplified76.2%
Final simplification44.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.5 (* im im))) (t_1 (* re (* re 0.5))))
(if (<= re -2.2e+18)
t_0
(if (<= re 1700.0)
(+ (+ re 1.0) (* 0.5 (* re re)))
(if (<= re 2.7e+136) (* t_1 (+ 1.0 t_0)) t_1)))))
double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double t_1 = re * (re * 0.5);
double tmp;
if (re <= -2.2e+18) {
tmp = t_0;
} else if (re <= 1700.0) {
tmp = (re + 1.0) + (0.5 * (re * re));
} else if (re <= 2.7e+136) {
tmp = t_1 * (1.0 + t_0);
} else {
tmp = 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 = (-0.5d0) * (im * im)
t_1 = re * (re * 0.5d0)
if (re <= (-2.2d+18)) then
tmp = t_0
else if (re <= 1700.0d0) then
tmp = (re + 1.0d0) + (0.5d0 * (re * re))
else if (re <= 2.7d+136) then
tmp = t_1 * (1.0d0 + t_0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double t_1 = re * (re * 0.5);
double tmp;
if (re <= -2.2e+18) {
tmp = t_0;
} else if (re <= 1700.0) {
tmp = (re + 1.0) + (0.5 * (re * re));
} else if (re <= 2.7e+136) {
tmp = t_1 * (1.0 + t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = -0.5 * (im * im) t_1 = re * (re * 0.5) tmp = 0 if re <= -2.2e+18: tmp = t_0 elif re <= 1700.0: tmp = (re + 1.0) + (0.5 * (re * re)) elif re <= 2.7e+136: tmp = t_1 * (1.0 + t_0) else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(-0.5 * Float64(im * im)) t_1 = Float64(re * Float64(re * 0.5)) tmp = 0.0 if (re <= -2.2e+18) tmp = t_0; elseif (re <= 1700.0) tmp = Float64(Float64(re + 1.0) + Float64(0.5 * Float64(re * re))); elseif (re <= 2.7e+136) tmp = Float64(t_1 * Float64(1.0 + t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.5 * (im * im); t_1 = re * (re * 0.5); tmp = 0.0; if (re <= -2.2e+18) tmp = t_0; elseif (re <= 1700.0) tmp = (re + 1.0) + (0.5 * (re * re)); elseif (re <= 2.7e+136) tmp = t_1 * (1.0 + t_0); else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2.2e+18], t$95$0, If[LessEqual[re, 1700.0], N[(N[(re + 1.0), $MachinePrecision] + N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.7e+136], N[(t$95$1 * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(im \cdot im\right)\\
t_1 := re \cdot \left(re \cdot 0.5\right)\\
\mathbf{if}\;re \leq -2.2 \cdot 10^{+18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 1700:\\
\;\;\;\;\left(re + 1\right) + 0.5 \cdot \left(re \cdot re\right)\\
\mathbf{elif}\;re \leq 2.7 \cdot 10^{+136}:\\
\;\;\;\;t_1 \cdot \left(1 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if re < -2.2e18Initial program 100.0%
Taylor expanded in im around 0 72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in im around inf 72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in re around 0 27.8%
unpow227.8%
Simplified27.8%
if -2.2e18 < re < 1700Initial program 100.0%
Taylor expanded in re around 0 97.6%
+-commutative97.6%
+-commutative97.6%
*-rgt-identity97.6%
distribute-lft-out97.6%
*-commutative97.6%
associate-*l*97.6%
distribute-lft-out97.6%
*-commutative97.6%
unpow297.6%
Simplified97.6%
Taylor expanded in im around 0 48.0%
if 1700 < re < 2.7000000000000002e136Initial program 100.0%
Taylor expanded in re around 0 4.9%
+-commutative4.9%
+-commutative4.9%
*-rgt-identity4.9%
distribute-lft-out4.9%
*-commutative4.9%
associate-*l*4.9%
distribute-lft-out4.9%
*-commutative4.9%
unpow24.9%
Simplified4.9%
Taylor expanded in im around 0 17.9%
unpow269.7%
Simplified17.9%
Taylor expanded in re around inf 17.9%
unpow23.9%
*-commutative3.9%
associate-*r*3.9%
Simplified17.9%
if 2.7000000000000002e136 < re Initial program 100.0%
Taylor expanded in re around 0 88.7%
+-commutative88.7%
+-commutative88.7%
*-rgt-identity88.7%
distribute-lft-out88.7%
*-commutative88.7%
associate-*l*88.7%
distribute-lft-out88.7%
*-commutative88.7%
unpow288.7%
Simplified88.7%
Taylor expanded in im around 0 76.2%
Taylor expanded in re around inf 76.2%
unpow276.2%
*-commutative76.2%
associate-*r*76.2%
Simplified76.2%
Final simplification44.2%
(FPCore (re im)
:precision binary64
(if (<= re -2.2e+18)
(* -0.5 (* im im))
(if (<= re 600.0)
(+ re 1.0)
(if (<= re 2.7e+136)
(* (* re re) (* (* im im) -0.25))
(* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else if (re <= 600.0) {
tmp = re + 1.0;
} else if (re <= 2.7e+136) {
tmp = (re * re) * ((im * im) * -0.25);
} 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 <= (-2.2d+18)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 600.0d0) then
tmp = re + 1.0d0
else if (re <= 2.7d+136) then
tmp = (re * re) * ((im * im) * (-0.25d0))
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else if (re <= 600.0) {
tmp = re + 1.0;
} else if (re <= 2.7e+136) {
tmp = (re * re) * ((im * im) * -0.25);
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.2e+18: tmp = -0.5 * (im * im) elif re <= 600.0: tmp = re + 1.0 elif re <= 2.7e+136: tmp = (re * re) * ((im * im) * -0.25) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.2e+18) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 600.0) tmp = Float64(re + 1.0); elseif (re <= 2.7e+136) tmp = Float64(Float64(re * re) * Float64(Float64(im * im) * -0.25)); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.2e+18) tmp = -0.5 * (im * im); elseif (re <= 600.0) tmp = re + 1.0; elseif (re <= 2.7e+136) tmp = (re * re) * ((im * im) * -0.25); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.2e+18], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 600.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 2.7e+136], N[(N[(re * re), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.2 \cdot 10^{+18}:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 600:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 2.7 \cdot 10^{+136}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(\left(im \cdot im\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -2.2e18Initial program 100.0%
Taylor expanded in im around 0 72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in im around inf 72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in re around 0 27.8%
unpow227.8%
Simplified27.8%
if -2.2e18 < re < 600Initial program 100.0%
Taylor expanded in re around 0 96.9%
+-commutative96.9%
*-rgt-identity96.9%
distribute-lft-out96.9%
Simplified96.9%
Taylor expanded in im around 0 47.4%
if 600 < re < 2.7000000000000002e136Initial program 100.0%
Taylor expanded in re around 0 4.9%
+-commutative4.9%
+-commutative4.9%
*-rgt-identity4.9%
distribute-lft-out4.9%
*-commutative4.9%
associate-*l*4.9%
distribute-lft-out4.9%
*-commutative4.9%
unpow24.9%
Simplified4.9%
Taylor expanded in im around 0 17.9%
unpow269.7%
Simplified17.9%
Taylor expanded in re around inf 17.9%
unpow23.9%
*-commutative3.9%
associate-*r*3.9%
Simplified17.9%
Taylor expanded in im around inf 16.0%
*-commutative16.0%
associate-*l*16.0%
unpow216.0%
unpow216.0%
Simplified16.0%
if 2.7000000000000002e136 < re Initial program 100.0%
Taylor expanded in re around 0 88.7%
+-commutative88.7%
+-commutative88.7%
*-rgt-identity88.7%
distribute-lft-out88.7%
*-commutative88.7%
associate-*l*88.7%
distribute-lft-out88.7%
*-commutative88.7%
unpow288.7%
Simplified88.7%
Taylor expanded in im around 0 76.2%
Taylor expanded in re around inf 76.2%
unpow276.2%
*-commutative76.2%
associate-*r*76.2%
Simplified76.2%
Final simplification43.7%
(FPCore (re im) :precision binary64 (if (<= re -2.2e+18) (* -0.5 (* im im)) (+ (+ re 1.0) (* 0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else {
tmp = (re + 1.0) + (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.2d+18)) then
tmp = (-0.5d0) * (im * im)
else
tmp = (re + 1.0d0) + (0.5d0 * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else {
tmp = (re + 1.0) + (0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.2e+18: tmp = -0.5 * (im * im) else: tmp = (re + 1.0) + (0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.2e+18) tmp = Float64(-0.5 * Float64(im * im)); else tmp = Float64(Float64(re + 1.0) + Float64(0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.2e+18) tmp = -0.5 * (im * im); else tmp = (re + 1.0) + (0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.2e+18], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], N[(N[(re + 1.0), $MachinePrecision] + N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.2 \cdot 10^{+18}:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re + 1\right) + 0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < -2.2e18Initial program 100.0%
Taylor expanded in im around 0 72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in im around inf 72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in re around 0 27.8%
unpow227.8%
Simplified27.8%
if -2.2e18 < re Initial program 100.0%
Taylor expanded in re around 0 80.6%
+-commutative80.6%
+-commutative80.6%
*-rgt-identity80.6%
distribute-lft-out80.6%
*-commutative80.6%
associate-*l*80.6%
distribute-lft-out80.6%
*-commutative80.6%
unpow280.6%
Simplified80.6%
Taylor expanded in im around 0 46.4%
Final simplification42.4%
(FPCore (re im) :precision binary64 (if (or (<= re -2.2e+18) (not (<= re 1950.0))) (* -0.5 (* im im)) (+ re 1.0)))
double code(double re, double im) {
double tmp;
if ((re <= -2.2e+18) || !(re <= 1950.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 <= (-2.2d+18)) .or. (.not. (re <= 1950.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 <= -2.2e+18) || !(re <= 1950.0)) {
tmp = -0.5 * (im * im);
} else {
tmp = re + 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -2.2e+18) or not (re <= 1950.0): tmp = -0.5 * (im * im) else: tmp = re + 1.0 return tmp
function code(re, im) tmp = 0.0 if ((re <= -2.2e+18) || !(re <= 1950.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 <= -2.2e+18) || ~((re <= 1950.0))) tmp = -0.5 * (im * im); else tmp = re + 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -2.2e+18], N[Not[LessEqual[re, 1950.0]], $MachinePrecision]], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], N[(re + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.2 \cdot 10^{+18} \lor \neg \left(re \leq 1950\right):\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;re + 1\\
\end{array}
\end{array}
if re < -2.2e18 or 1950 < re Initial program 100.0%
Taylor expanded in im around 0 67.2%
unpow267.2%
Simplified67.2%
Taylor expanded in im around inf 40.6%
*-commutative40.6%
unpow240.6%
Simplified40.6%
Taylor expanded in re around 0 18.0%
unpow218.0%
Simplified18.0%
if -2.2e18 < re < 1950Initial program 100.0%
Taylor expanded in re around 0 96.9%
+-commutative96.9%
*-rgt-identity96.9%
distribute-lft-out96.9%
Simplified96.9%
Taylor expanded in im around 0 47.4%
Final simplification32.7%
(FPCore (re im) :precision binary64 (if (<= re -2.2e+18) (* -0.5 (* im im)) (if (<= re 200000000000.0) (+ re 1.0) (* re (* re 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else if (re <= 200000000000.0) {
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 <= (-2.2d+18)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 200000000000.0d0) 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 <= -2.2e+18) {
tmp = -0.5 * (im * im);
} else if (re <= 200000000000.0) {
tmp = re + 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.2e+18: tmp = -0.5 * (im * im) elif re <= 200000000000.0: tmp = re + 1.0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.2e+18) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 200000000000.0) 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 <= -2.2e+18) tmp = -0.5 * (im * im); elseif (re <= 200000000000.0) tmp = re + 1.0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.2e+18], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 200000000000.0], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.2 \cdot 10^{+18}:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 200000000000:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -2.2e18Initial program 100.0%
Taylor expanded in im around 0 72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in im around inf 72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in re around 0 27.8%
unpow227.8%
Simplified27.8%
if -2.2e18 < re < 2e11Initial program 100.0%
Taylor expanded in re around 0 96.2%
+-commutative96.2%
*-rgt-identity96.2%
distribute-lft-out96.2%
Simplified96.2%
Taylor expanded in im around 0 47.1%
if 2e11 < re Initial program 100.0%
Taylor expanded in re around 0 51.5%
+-commutative51.5%
+-commutative51.5%
*-rgt-identity51.5%
distribute-lft-out51.5%
*-commutative51.5%
associate-*l*51.5%
distribute-lft-out51.5%
*-commutative51.5%
unpow251.5%
Simplified51.5%
Taylor expanded in im around 0 44.1%
Taylor expanded in re around inf 44.1%
unpow244.1%
*-commutative44.1%
associate-*r*44.1%
Simplified44.1%
Final simplification42.1%
(FPCore (re im) :precision binary64 (+ re 1.0))
double code(double re, double im) {
return re + 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re + 1.0d0
end function
public static double code(double re, double im) {
return re + 1.0;
}
def code(re, im): return re + 1.0
function code(re, im) return Float64(re + 1.0) end
function tmp = code(re, im) tmp = re + 1.0; end
code[re_, im_] := N[(re + 1.0), $MachinePrecision]
\begin{array}{l}
\\
re + 1
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 50.5%
+-commutative50.5%
*-rgt-identity50.5%
distribute-lft-out50.5%
Simplified50.5%
Taylor expanded in im around 0 25.5%
Final simplification25.5%
(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 49.4%
Taylor expanded in im around 0 24.8%
Final simplification24.8%
herbie shell --seed 2023196
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))