
(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 16 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) 1.0) (exp re) (if (<= (exp re) 5e+91) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 1.0) {
tmp = exp(re);
} else if (exp(re) <= 5e+91) {
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) <= 1.0d0) then
tmp = exp(re)
else if (exp(re) <= 5d+91) 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) <= 1.0) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 5e+91) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 1.0: tmp = math.exp(re) elif math.exp(re) <= 5e+91: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 1.0) tmp = exp(re); elseif (exp(re) <= 5e+91) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 1.0) tmp = exp(re); elseif (exp(re) <= 5e+91) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 5e+91], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 1:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 5 \cdot 10^{+91}:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 1 or 5.0000000000000002e91 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 72.9%
if 1 < (exp.f64 re) < 5.0000000000000002e91Initial program 99.5%
Taylor expanded in re around 0 36.2%
Final simplification72.5%
(FPCore (re im)
:precision binary64
(if (<= re -7.2e-5)
(exp re)
(if (<= re 215.0)
(* (cos im) (+ (* 0.5 (* re re)) (+ 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 <= -7.2e-5) {
tmp = exp(re);
} else if (re <= 215.0) {
tmp = cos(im) * ((0.5 * (re * re)) + (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 <= (-7.2d-5)) then
tmp = exp(re)
else if (re <= 215.0d0) then
tmp = cos(im) * ((0.5d0 * (re * re)) + (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 <= -7.2e-5) {
tmp = Math.exp(re);
} else if (re <= 215.0) {
tmp = Math.cos(im) * ((0.5 * (re * re)) + (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 <= -7.2e-5: tmp = math.exp(re) elif re <= 215.0: tmp = math.cos(im) * ((0.5 * (re * re)) + (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 <= -7.2e-5) tmp = exp(re); elseif (re <= 215.0) tmp = Float64(cos(im) * Float64(Float64(0.5 * Float64(re * re)) + 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 <= -7.2e-5) tmp = exp(re); elseif (re <= 215.0) tmp = cos(im) * ((0.5 * (re * re)) + (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, -7.2e-5], N[Exp[re], $MachinePrecision], If[LessEqual[re, 215.0], N[(N[Cos[im], $MachinePrecision] * N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $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 -7.2 \cdot 10^{-5}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 215:\\
\;\;\;\;\cos im \cdot \left(0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\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 < -7.20000000000000018e-5 or 215 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 89.5%
if -7.20000000000000018e-5 < re < 215Initial program 100.0%
Taylor expanded in re around 0 98.8%
+-commutative98.8%
+-commutative98.8%
*-rgt-identity98.8%
distribute-lft-out98.9%
*-commutative98.9%
associate-*l*98.9%
distribute-lft-out98.9%
+-commutative98.9%
*-commutative98.9%
unpow298.9%
Simplified98.9%
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%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
unpow269.2%
*-commutative69.2%
associate-*r*69.2%
Simplified100.0%
Final simplification95.3%
(FPCore (re im)
:precision binary64
(if (<= re -5.7e-5)
(exp re)
(if (<= re 215.0)
(* (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 <= -5.7e-5) {
tmp = exp(re);
} else if (re <= 215.0) {
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 <= (-5.7d-5)) then
tmp = exp(re)
else if (re <= 215.0d0) 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 <= -5.7e-5) {
tmp = Math.exp(re);
} else if (re <= 215.0) {
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 <= -5.7e-5: tmp = math.exp(re) elif re <= 215.0: 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 <= -5.7e-5) tmp = exp(re); elseif (re <= 215.0) 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 <= -5.7e-5) tmp = exp(re); elseif (re <= 215.0) 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, -5.7e-5], N[Exp[re], $MachinePrecision], If[LessEqual[re, 215.0], 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 -5.7 \cdot 10^{-5}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 215:\\
\;\;\;\;\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 < -5.7000000000000003e-5 or 215 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 89.5%
if -5.7000000000000003e-5 < re < 215Initial program 100.0%
Taylor expanded in re around 0 98.7%
*-rgt-identity98.7%
distribute-lft-out98.7%
Simplified98.7%
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%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
unpow269.2%
*-commutative69.2%
associate-*r*69.2%
Simplified100.0%
Final simplification95.3%
(FPCore (re im) :precision binary64 (if (<= re -6.6e-5) (exp re) (if (<= re 215.0) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -6.6e-5) {
tmp = exp(re);
} else if (re <= 215.0) {
tmp = cos(im) * (re + 1.0);
} else {
tmp = exp(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-6.6d-5)) then
tmp = exp(re)
else if (re <= 215.0d0) then
tmp = cos(im) * (re + 1.0d0)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -6.6e-5) {
tmp = Math.exp(re);
} else if (re <= 215.0) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -6.6e-5: tmp = math.exp(re) elif re <= 215.0: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -6.6e-5) tmp = exp(re); elseif (re <= 215.0) tmp = Float64(cos(im) * Float64(re + 1.0)); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -6.6e-5) tmp = exp(re); elseif (re <= 215.0) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -6.6e-5], N[Exp[re], $MachinePrecision], If[LessEqual[re, 215.0], 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 -6.6 \cdot 10^{-5}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 215:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -6.6000000000000005e-5 or 215 < re Initial program 100.0%
Taylor expanded in im around 0 86.7%
if -6.6000000000000005e-5 < re < 215Initial program 100.0%
Taylor expanded in re around 0 98.7%
*-rgt-identity98.7%
distribute-lft-out98.7%
Simplified98.7%
Final simplification92.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 1.0 (* -0.5 (* im im)))) (t_1 (* re (* re 0.5))))
(if (<= re -9500000.0)
(* re (* im (* im -0.5)))
(if (<= re 520.0)
(cos im)
(if (<= re 5.8e+145)
(* t_0 (+ (* 0.5 (* re re)) (+ re 1.0)))
(if (<= re 5e+290) t_1 (* t_1 t_0)))))))
double code(double re, double im) {
double t_0 = 1.0 + (-0.5 * (im * im));
double t_1 = re * (re * 0.5);
double tmp;
if (re <= -9500000.0) {
tmp = re * (im * (im * -0.5));
} else if (re <= 520.0) {
tmp = cos(im);
} else if (re <= 5.8e+145) {
tmp = t_0 * ((0.5 * (re * re)) + (re + 1.0));
} else if (re <= 5e+290) {
tmp = t_1;
} else {
tmp = t_1 * 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 = 1.0d0 + ((-0.5d0) * (im * im))
t_1 = re * (re * 0.5d0)
if (re <= (-9500000.0d0)) then
tmp = re * (im * (im * (-0.5d0)))
else if (re <= 520.0d0) then
tmp = cos(im)
else if (re <= 5.8d+145) then
tmp = t_0 * ((0.5d0 * (re * re)) + (re + 1.0d0))
else if (re <= 5d+290) then
tmp = t_1
else
tmp = t_1 * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 1.0 + (-0.5 * (im * im));
double t_1 = re * (re * 0.5);
double tmp;
if (re <= -9500000.0) {
tmp = re * (im * (im * -0.5));
} else if (re <= 520.0) {
tmp = Math.cos(im);
} else if (re <= 5.8e+145) {
tmp = t_0 * ((0.5 * (re * re)) + (re + 1.0));
} else if (re <= 5e+290) {
tmp = t_1;
} else {
tmp = t_1 * t_0;
}
return tmp;
}
def code(re, im): t_0 = 1.0 + (-0.5 * (im * im)) t_1 = re * (re * 0.5) tmp = 0 if re <= -9500000.0: tmp = re * (im * (im * -0.5)) elif re <= 520.0: tmp = math.cos(im) elif re <= 5.8e+145: tmp = t_0 * ((0.5 * (re * re)) + (re + 1.0)) elif re <= 5e+290: tmp = t_1 else: tmp = t_1 * t_0 return tmp
function code(re, im) t_0 = Float64(1.0 + Float64(-0.5 * Float64(im * im))) t_1 = Float64(re * Float64(re * 0.5)) tmp = 0.0 if (re <= -9500000.0) tmp = Float64(re * Float64(im * Float64(im * -0.5))); elseif (re <= 520.0) tmp = cos(im); elseif (re <= 5.8e+145) tmp = Float64(t_0 * Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0))); elseif (re <= 5e+290) tmp = t_1; else tmp = Float64(t_1 * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = 1.0 + (-0.5 * (im * im)); t_1 = re * (re * 0.5); tmp = 0.0; if (re <= -9500000.0) tmp = re * (im * (im * -0.5)); elseif (re <= 520.0) tmp = cos(im); elseif (re <= 5.8e+145) tmp = t_0 * ((0.5 * (re * re)) + (re + 1.0)); elseif (re <= 5e+290) tmp = t_1; else tmp = t_1 * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -9500000.0], N[(re * N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 520.0], N[Cos[im], $MachinePrecision], If[LessEqual[re, 5.8e+145], N[(t$95$0 * N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5e+290], t$95$1, N[(t$95$1 * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + -0.5 \cdot \left(im \cdot im\right)\\
t_1 := re \cdot \left(re \cdot 0.5\right)\\
\mathbf{if}\;re \leq -9500000:\\
\;\;\;\;re \cdot \left(im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{elif}\;re \leq 520:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 5.8 \cdot 10^{+145}:\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 5 \cdot 10^{+290}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot t_0\\
\end{array}
\end{array}
if re < -9.5e6Initial program 100.0%
Taylor expanded in re around 0 2.3%
*-rgt-identity2.3%
distribute-lft-out2.3%
Simplified2.3%
Taylor expanded in re around inf 2.3%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 27.6%
*-commutative27.6%
associate-*r*27.6%
*-commutative27.6%
unpow227.6%
associate-*r*27.6%
*-commutative27.6%
Simplified27.6%
if -9.5e6 < re < 520Initial program 100.0%
Taylor expanded in re around 0 94.8%
if 520 < re < 5.8000000000000001e145Initial program 100.0%
Taylor expanded in re around 0 4.5%
+-commutative4.5%
+-commutative4.5%
*-rgt-identity4.5%
distribute-lft-out4.5%
*-commutative4.5%
associate-*l*4.5%
distribute-lft-out4.5%
+-commutative4.5%
*-commutative4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in im around 0 21.3%
unpow221.3%
Simplified21.3%
if 5.8000000000000001e145 < re < 4.9999999999999998e290Initial program 100.0%
Taylor expanded in re around 0 97.3%
+-commutative97.3%
+-commutative97.3%
*-rgt-identity97.3%
distribute-lft-out97.3%
*-commutative97.3%
associate-*l*97.3%
distribute-lft-out97.3%
+-commutative97.3%
*-commutative97.3%
unpow297.3%
Simplified97.3%
Taylor expanded in im around 0 63.9%
unpow263.9%
Simplified63.9%
Taylor expanded in re around inf 63.9%
unpow263.9%
*-commutative63.9%
associate-*r*63.9%
Simplified63.9%
Taylor expanded in im around 0 79.1%
unpow279.1%
*-commutative79.1%
associate-*r*79.1%
Simplified79.1%
if 4.9999999999999998e290 < 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%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
unpow285.7%
Simplified85.7%
Taylor expanded in re around inf 85.7%
unpow285.7%
*-commutative85.7%
associate-*r*85.7%
Simplified85.7%
Final simplification66.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ (* 0.5 (* re re)) (+ re 1.0))))
(if (<= re -9500000.0)
(* re (* im (* im -0.5)))
(if (<= re 180.0)
t_0
(if (<= re 5.8e+145)
(* (+ 1.0 (* -0.5 (* im im))) t_0)
(* re (* re 0.5)))))))
double code(double re, double im) {
double t_0 = (0.5 * (re * re)) + (re + 1.0);
double tmp;
if (re <= -9500000.0) {
tmp = re * (im * (im * -0.5));
} else if (re <= 180.0) {
tmp = t_0;
} else if (re <= 5.8e+145) {
tmp = (1.0 + (-0.5 * (im * im))) * 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) :: tmp
t_0 = (0.5d0 * (re * re)) + (re + 1.0d0)
if (re <= (-9500000.0d0)) then
tmp = re * (im * (im * (-0.5d0)))
else if (re <= 180.0d0) then
tmp = t_0
else if (re <= 5.8d+145) then
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * 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 * (re * re)) + (re + 1.0);
double tmp;
if (re <= -9500000.0) {
tmp = re * (im * (im * -0.5));
} else if (re <= 180.0) {
tmp = t_0;
} else if (re <= 5.8e+145) {
tmp = (1.0 + (-0.5 * (im * im))) * t_0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): t_0 = (0.5 * (re * re)) + (re + 1.0) tmp = 0 if re <= -9500000.0: tmp = re * (im * (im * -0.5)) elif re <= 180.0: tmp = t_0 elif re <= 5.8e+145: tmp = (1.0 + (-0.5 * (im * im))) * t_0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) t_0 = Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0)) tmp = 0.0 if (re <= -9500000.0) tmp = Float64(re * Float64(im * Float64(im * -0.5))); elseif (re <= 180.0) tmp = t_0; elseif (re <= 5.8e+145) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * t_0); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) t_0 = (0.5 * (re * re)) + (re + 1.0); tmp = 0.0; if (re <= -9500000.0) tmp = re * (im * (im * -0.5)); elseif (re <= 180.0) tmp = t_0; elseif (re <= 5.8e+145) tmp = (1.0 + (-0.5 * (im * im))) * t_0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -9500000.0], N[(re * N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 180.0], t$95$0, If[LessEqual[re, 5.8e+145], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\\
\mathbf{if}\;re \leq -9500000:\\
\;\;\;\;re \cdot \left(im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{elif}\;re \leq 180:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 5.8 \cdot 10^{+145}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -9.5e6Initial program 100.0%
Taylor expanded in re around 0 2.3%
*-rgt-identity2.3%
distribute-lft-out2.3%
Simplified2.3%
Taylor expanded in re around inf 2.3%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 27.6%
*-commutative27.6%
associate-*r*27.6%
*-commutative27.6%
unpow227.6%
associate-*r*27.6%
*-commutative27.6%
Simplified27.6%
if -9.5e6 < re < 180Initial program 100.0%
Taylor expanded in re around 0 96.4%
+-commutative96.4%
+-commutative96.4%
*-rgt-identity96.4%
distribute-lft-out96.4%
*-commutative96.4%
associate-*l*96.4%
distribute-lft-out96.4%
+-commutative96.4%
*-commutative96.4%
unpow296.4%
Simplified96.4%
Taylor expanded in im around 0 53.8%
if 180 < re < 5.8000000000000001e145Initial program 100.0%
Taylor expanded in re around 0 4.6%
+-commutative4.6%
+-commutative4.6%
*-rgt-identity4.6%
distribute-lft-out4.6%
*-commutative4.6%
associate-*l*4.6%
distribute-lft-out4.6%
+-commutative4.6%
*-commutative4.6%
unpow24.6%
Simplified4.6%
Taylor expanded in im around 0 20.8%
unpow220.8%
Simplified20.8%
if 5.8000000000000001e145 < re Initial program 100.0%
Taylor expanded in re around 0 97.7%
+-commutative97.7%
+-commutative97.7%
*-rgt-identity97.7%
distribute-lft-out97.7%
*-commutative97.7%
associate-*l*97.7%
distribute-lft-out97.7%
+-commutative97.7%
*-commutative97.7%
unpow297.7%
Simplified97.7%
Taylor expanded in im around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in re around inf 67.7%
unpow267.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
Taylor expanded in im around 0 77.7%
unpow277.7%
*-commutative77.7%
associate-*r*77.7%
Simplified77.7%
Final simplification46.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5))))
(if (<= re -11500000.0)
(* re (* im (* im -0.5)))
(if (<= re 210.0)
(+ (* 0.5 (* re re)) (+ re 1.0))
(if (<= re 5.8e+145) (* t_0 (+ 1.0 (* -0.5 (* im im)))) t_0)))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double tmp;
if (re <= -11500000.0) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = (0.5 * (re * re)) + (re + 1.0);
} else if (re <= 5.8e+145) {
tmp = t_0 * (1.0 + (-0.5 * (im * im)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = re * (re * 0.5d0)
if (re <= (-11500000.0d0)) then
tmp = re * (im * (im * (-0.5d0)))
else if (re <= 210.0d0) then
tmp = (0.5d0 * (re * re)) + (re + 1.0d0)
else if (re <= 5.8d+145) then
tmp = t_0 * (1.0d0 + ((-0.5d0) * (im * im)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * 0.5);
double tmp;
if (re <= -11500000.0) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = (0.5 * (re * re)) + (re + 1.0);
} else if (re <= 5.8e+145) {
tmp = t_0 * (1.0 + (-0.5 * (im * im)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) tmp = 0 if re <= -11500000.0: tmp = re * (im * (im * -0.5)) elif re <= 210.0: tmp = (0.5 * (re * re)) + (re + 1.0) elif re <= 5.8e+145: tmp = t_0 * (1.0 + (-0.5 * (im * im))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) tmp = 0.0 if (re <= -11500000.0) tmp = Float64(re * Float64(im * Float64(im * -0.5))); elseif (re <= 210.0) tmp = Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0)); elseif (re <= 5.8e+145) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(im * im)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); tmp = 0.0; if (re <= -11500000.0) tmp = re * (im * (im * -0.5)); elseif (re <= 210.0) tmp = (0.5 * (re * re)) + (re + 1.0); elseif (re <= 5.8e+145) tmp = t_0 * (1.0 + (-0.5 * (im * im))); else tmp = 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, -11500000.0], N[(re * N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 210.0], N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5.8e+145], N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
\mathbf{if}\;re \leq -11500000:\\
\;\;\;\;re \cdot \left(im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{elif}\;re \leq 210:\\
\;\;\;\;0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\\
\mathbf{elif}\;re \leq 5.8 \cdot 10^{+145}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if re < -1.15e7Initial program 100.0%
Taylor expanded in re around 0 2.3%
*-rgt-identity2.3%
distribute-lft-out2.3%
Simplified2.3%
Taylor expanded in re around inf 2.3%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 27.6%
*-commutative27.6%
associate-*r*27.6%
*-commutative27.6%
unpow227.6%
associate-*r*27.6%
*-commutative27.6%
Simplified27.6%
if -1.15e7 < re < 210Initial program 100.0%
Taylor expanded in re around 0 96.4%
+-commutative96.4%
+-commutative96.4%
*-rgt-identity96.4%
distribute-lft-out96.4%
*-commutative96.4%
associate-*l*96.4%
distribute-lft-out96.4%
+-commutative96.4%
*-commutative96.4%
unpow296.4%
Simplified96.4%
Taylor expanded in im around 0 53.8%
if 210 < re < 5.8000000000000001e145Initial program 100.0%
Taylor expanded in re around 0 4.6%
+-commutative4.6%
+-commutative4.6%
*-rgt-identity4.6%
distribute-lft-out4.6%
*-commutative4.6%
associate-*l*4.6%
distribute-lft-out4.6%
+-commutative4.6%
*-commutative4.6%
unpow24.6%
Simplified4.6%
Taylor expanded in im around 0 20.8%
unpow220.8%
Simplified20.8%
Taylor expanded in re around inf 20.8%
unpow220.8%
*-commutative20.8%
associate-*r*20.8%
Simplified20.8%
if 5.8000000000000001e145 < re Initial program 100.0%
Taylor expanded in re around 0 97.7%
+-commutative97.7%
+-commutative97.7%
*-rgt-identity97.7%
distribute-lft-out97.7%
*-commutative97.7%
associate-*l*97.7%
distribute-lft-out97.7%
+-commutative97.7%
*-commutative97.7%
unpow297.7%
Simplified97.7%
Taylor expanded in im around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in re around inf 67.7%
unpow267.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
Taylor expanded in im around 0 77.7%
unpow277.7%
*-commutative77.7%
associate-*r*77.7%
Simplified77.7%
Final simplification46.7%
(FPCore (re im)
:precision binary64
(if (<= re -2.35)
(* re (* im (* im -0.5)))
(if (<= re 210.0)
(+ re 1.0)
(if (<= re 5.8e+145)
(* im (* im (* re (* re -0.25))))
(* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -2.35) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = re + 1.0;
} else if (re <= 5.8e+145) {
tmp = im * (im * (re * (re * -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.35d0)) then
tmp = re * (im * (im * (-0.5d0)))
else if (re <= 210.0d0) then
tmp = re + 1.0d0
else if (re <= 5.8d+145) then
tmp = im * (im * (re * (re * (-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.35) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = re + 1.0;
} else if (re <= 5.8e+145) {
tmp = im * (im * (re * (re * -0.25)));
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.35: tmp = re * (im * (im * -0.5)) elif re <= 210.0: tmp = re + 1.0 elif re <= 5.8e+145: tmp = im * (im * (re * (re * -0.25))) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.35) tmp = Float64(re * Float64(im * Float64(im * -0.5))); elseif (re <= 210.0) tmp = Float64(re + 1.0); elseif (re <= 5.8e+145) tmp = Float64(im * Float64(im * Float64(re * Float64(re * -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.35) tmp = re * (im * (im * -0.5)); elseif (re <= 210.0) tmp = re + 1.0; elseif (re <= 5.8e+145) tmp = im * (im * (re * (re * -0.25))); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.35], N[(re * N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 210.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 5.8e+145], N[(im * N[(im * N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.35:\\
\;\;\;\;re \cdot \left(im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{elif}\;re \leq 210:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 5.8 \cdot 10^{+145}:\\
\;\;\;\;im \cdot \left(im \cdot \left(re \cdot \left(re \cdot -0.25\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -2.35000000000000009Initial program 99.9%
Taylor expanded in re around 0 2.3%
*-rgt-identity2.3%
distribute-lft-out2.3%
Simplified2.3%
Taylor expanded in re around inf 2.3%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 26.0%
*-commutative26.0%
associate-*r*26.0%
*-commutative26.0%
unpow226.0%
associate-*r*26.0%
*-commutative26.0%
Simplified26.0%
if -2.35000000000000009 < re < 210Initial program 100.0%
Taylor expanded in re around 0 99.2%
*-rgt-identity99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in im around 0 55.2%
if 210 < re < 5.8000000000000001e145Initial program 100.0%
Taylor expanded in re around 0 4.6%
+-commutative4.6%
+-commutative4.6%
*-rgt-identity4.6%
distribute-lft-out4.6%
*-commutative4.6%
associate-*l*4.6%
distribute-lft-out4.6%
+-commutative4.6%
*-commutative4.6%
unpow24.6%
Simplified4.6%
Taylor expanded in im around 0 20.8%
unpow220.8%
Simplified20.8%
Taylor expanded in re around inf 20.8%
unpow220.8%
*-commutative20.8%
associate-*r*20.8%
Simplified20.8%
Taylor expanded in im around inf 19.3%
unpow219.3%
associate-*r*19.3%
*-commutative19.3%
metadata-eval19.3%
associate-*l*19.3%
associate-*r*19.3%
unpow219.3%
associate-*r*19.3%
*-commutative19.3%
*-commutative19.3%
associate-*r*19.3%
associate-*l*19.3%
metadata-eval19.3%
*-commutative19.3%
associate-*r*19.3%
*-commutative19.3%
*-commutative19.3%
Simplified19.3%
if 5.8000000000000001e145 < re Initial program 100.0%
Taylor expanded in re around 0 97.7%
+-commutative97.7%
+-commutative97.7%
*-rgt-identity97.7%
distribute-lft-out97.7%
*-commutative97.7%
associate-*l*97.7%
distribute-lft-out97.7%
+-commutative97.7%
*-commutative97.7%
unpow297.7%
Simplified97.7%
Taylor expanded in im around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in re around inf 67.7%
unpow267.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
Taylor expanded in im around 0 77.7%
unpow277.7%
*-commutative77.7%
associate-*r*77.7%
Simplified77.7%
Final simplification46.3%
(FPCore (re im)
:precision binary64
(if (<= re -4.6)
(* re (* im (* im -0.5)))
(if (<= re 210.0)
(+ re 1.0)
(if (<= re 5.8e+145)
(* (* im im) (* (* re re) -0.25))
(* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -4.6) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = re + 1.0;
} else if (re <= 5.8e+145) {
tmp = (im * im) * ((re * re) * -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 <= (-4.6d0)) then
tmp = re * (im * (im * (-0.5d0)))
else if (re <= 210.0d0) then
tmp = re + 1.0d0
else if (re <= 5.8d+145) then
tmp = (im * im) * ((re * re) * (-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 <= -4.6) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = re + 1.0;
} else if (re <= 5.8e+145) {
tmp = (im * im) * ((re * re) * -0.25);
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -4.6: tmp = re * (im * (im * -0.5)) elif re <= 210.0: tmp = re + 1.0 elif re <= 5.8e+145: tmp = (im * im) * ((re * re) * -0.25) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -4.6) tmp = Float64(re * Float64(im * Float64(im * -0.5))); elseif (re <= 210.0) tmp = Float64(re + 1.0); elseif (re <= 5.8e+145) tmp = Float64(Float64(im * im) * Float64(Float64(re * re) * -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 <= -4.6) tmp = re * (im * (im * -0.5)); elseif (re <= 210.0) tmp = re + 1.0; elseif (re <= 5.8e+145) tmp = (im * im) * ((re * re) * -0.25); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -4.6], N[(re * N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 210.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 5.8e+145], N[(N[(im * im), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.6:\\
\;\;\;\;re \cdot \left(im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{elif}\;re \leq 210:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 5.8 \cdot 10^{+145}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -4.5999999999999996Initial program 99.9%
Taylor expanded in re around 0 2.3%
*-rgt-identity2.3%
distribute-lft-out2.3%
Simplified2.3%
Taylor expanded in re around inf 2.3%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 26.0%
*-commutative26.0%
associate-*r*26.0%
*-commutative26.0%
unpow226.0%
associate-*r*26.0%
*-commutative26.0%
Simplified26.0%
if -4.5999999999999996 < re < 210Initial program 100.0%
Taylor expanded in re around 0 99.2%
*-rgt-identity99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in im around 0 55.2%
if 210 < re < 5.8000000000000001e145Initial program 100.0%
Taylor expanded in re around 0 4.6%
+-commutative4.6%
+-commutative4.6%
*-rgt-identity4.6%
distribute-lft-out4.6%
*-commutative4.6%
associate-*l*4.6%
distribute-lft-out4.6%
+-commutative4.6%
*-commutative4.6%
unpow24.6%
Simplified4.6%
Taylor expanded in im around 0 20.8%
unpow220.8%
Simplified20.8%
Taylor expanded in re around inf 20.8%
unpow220.8%
*-commutative20.8%
associate-*r*20.8%
Simplified20.8%
Taylor expanded in im around inf 19.3%
unpow219.3%
associate-*r*19.3%
*-commutative19.3%
unpow219.3%
Simplified19.3%
if 5.8000000000000001e145 < re Initial program 100.0%
Taylor expanded in re around 0 97.7%
+-commutative97.7%
+-commutative97.7%
*-rgt-identity97.7%
distribute-lft-out97.7%
*-commutative97.7%
associate-*l*97.7%
distribute-lft-out97.7%
+-commutative97.7%
*-commutative97.7%
unpow297.7%
Simplified97.7%
Taylor expanded in im around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in re around inf 67.7%
unpow267.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
Taylor expanded in im around 0 77.7%
unpow277.7%
*-commutative77.7%
associate-*r*77.7%
Simplified77.7%
Final simplification46.3%
(FPCore (re im)
:precision binary64
(if (<= re -9500000.0)
(* re (* im (* im -0.5)))
(if (<= re 210.0)
(+ (* 0.5 (* re re)) (+ re 1.0))
(if (<= re 4.7e+145)
(* (* im im) (* (* re re) -0.25))
(* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -9500000.0) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = (0.5 * (re * re)) + (re + 1.0);
} else if (re <= 4.7e+145) {
tmp = (im * im) * ((re * re) * -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 <= (-9500000.0d0)) then
tmp = re * (im * (im * (-0.5d0)))
else if (re <= 210.0d0) then
tmp = (0.5d0 * (re * re)) + (re + 1.0d0)
else if (re <= 4.7d+145) then
tmp = (im * im) * ((re * re) * (-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 <= -9500000.0) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = (0.5 * (re * re)) + (re + 1.0);
} else if (re <= 4.7e+145) {
tmp = (im * im) * ((re * re) * -0.25);
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -9500000.0: tmp = re * (im * (im * -0.5)) elif re <= 210.0: tmp = (0.5 * (re * re)) + (re + 1.0) elif re <= 4.7e+145: tmp = (im * im) * ((re * re) * -0.25) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -9500000.0) tmp = Float64(re * Float64(im * Float64(im * -0.5))); elseif (re <= 210.0) tmp = Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0)); elseif (re <= 4.7e+145) tmp = Float64(Float64(im * im) * Float64(Float64(re * re) * -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 <= -9500000.0) tmp = re * (im * (im * -0.5)); elseif (re <= 210.0) tmp = (0.5 * (re * re)) + (re + 1.0); elseif (re <= 4.7e+145) tmp = (im * im) * ((re * re) * -0.25); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -9500000.0], N[(re * N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 210.0], N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4.7e+145], N[(N[(im * im), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -9500000:\\
\;\;\;\;re \cdot \left(im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{elif}\;re \leq 210:\\
\;\;\;\;0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\\
\mathbf{elif}\;re \leq 4.7 \cdot 10^{+145}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -9.5e6Initial program 100.0%
Taylor expanded in re around 0 2.3%
*-rgt-identity2.3%
distribute-lft-out2.3%
Simplified2.3%
Taylor expanded in re around inf 2.3%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 27.6%
*-commutative27.6%
associate-*r*27.6%
*-commutative27.6%
unpow227.6%
associate-*r*27.6%
*-commutative27.6%
Simplified27.6%
if -9.5e6 < re < 210Initial program 100.0%
Taylor expanded in re around 0 96.4%
+-commutative96.4%
+-commutative96.4%
*-rgt-identity96.4%
distribute-lft-out96.4%
*-commutative96.4%
associate-*l*96.4%
distribute-lft-out96.4%
+-commutative96.4%
*-commutative96.4%
unpow296.4%
Simplified96.4%
Taylor expanded in im around 0 53.8%
if 210 < re < 4.7000000000000002e145Initial program 100.0%
Taylor expanded in re around 0 4.6%
+-commutative4.6%
+-commutative4.6%
*-rgt-identity4.6%
distribute-lft-out4.6%
*-commutative4.6%
associate-*l*4.6%
distribute-lft-out4.6%
+-commutative4.6%
*-commutative4.6%
unpow24.6%
Simplified4.6%
Taylor expanded in im around 0 20.8%
unpow220.8%
Simplified20.8%
Taylor expanded in re around inf 20.8%
unpow220.8%
*-commutative20.8%
associate-*r*20.8%
Simplified20.8%
Taylor expanded in im around inf 19.3%
unpow219.3%
associate-*r*19.3%
*-commutative19.3%
unpow219.3%
Simplified19.3%
if 4.7000000000000002e145 < re Initial program 100.0%
Taylor expanded in re around 0 97.7%
+-commutative97.7%
+-commutative97.7%
*-rgt-identity97.7%
distribute-lft-out97.7%
*-commutative97.7%
associate-*l*97.7%
distribute-lft-out97.7%
+-commutative97.7%
*-commutative97.7%
unpow297.7%
Simplified97.7%
Taylor expanded in im around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in re around inf 67.7%
unpow267.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
Taylor expanded in im around 0 77.7%
unpow277.7%
*-commutative77.7%
associate-*r*77.7%
Simplified77.7%
Final simplification46.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.5 (* im (* re im)))))
(if (<= re -7.5)
t_0
(if (<= re 210.0)
(+ re 1.0)
(if (<= re 5.5e+145) t_0 (* re (* re 0.5)))))))
double code(double re, double im) {
double t_0 = -0.5 * (im * (re * im));
double tmp;
if (re <= -7.5) {
tmp = t_0;
} else if (re <= 210.0) {
tmp = re + 1.0;
} else if (re <= 5.5e+145) {
tmp = 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) :: tmp
t_0 = (-0.5d0) * (im * (re * im))
if (re <= (-7.5d0)) then
tmp = t_0
else if (re <= 210.0d0) then
tmp = re + 1.0d0
else if (re <= 5.5d+145) then
tmp = 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 * (re * im));
double tmp;
if (re <= -7.5) {
tmp = t_0;
} else if (re <= 210.0) {
tmp = re + 1.0;
} else if (re <= 5.5e+145) {
tmp = t_0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): t_0 = -0.5 * (im * (re * im)) tmp = 0 if re <= -7.5: tmp = t_0 elif re <= 210.0: tmp = re + 1.0 elif re <= 5.5e+145: tmp = t_0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) t_0 = Float64(-0.5 * Float64(im * Float64(re * im))) tmp = 0.0 if (re <= -7.5) tmp = t_0; elseif (re <= 210.0) tmp = Float64(re + 1.0); elseif (re <= 5.5e+145) tmp = 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 * (re * im)); tmp = 0.0; if (re <= -7.5) tmp = t_0; elseif (re <= 210.0) tmp = re + 1.0; elseif (re <= 5.5e+145) tmp = 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 * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -7.5], t$95$0, If[LessEqual[re, 210.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 5.5e+145], t$95$0, N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\
\mathbf{if}\;re \leq -7.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 210:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 5.5 \cdot 10^{+145}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -7.5 or 210 < re < 5.4999999999999995e145Initial program 100.0%
Taylor expanded in re around 0 2.8%
*-rgt-identity2.8%
distribute-lft-out2.8%
Simplified2.8%
Taylor expanded in re around inf 2.8%
Taylor expanded in im around 0 8.1%
unpow29.0%
Simplified8.1%
Taylor expanded in im around inf 22.6%
unpow222.6%
associate-*r*13.2%
*-commutative13.2%
Simplified13.2%
if -7.5 < re < 210Initial program 100.0%
Taylor expanded in re around 0 99.2%
*-rgt-identity99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in im around 0 55.2%
if 5.4999999999999995e145 < re Initial program 100.0%
Taylor expanded in re around 0 97.7%
+-commutative97.7%
+-commutative97.7%
*-rgt-identity97.7%
distribute-lft-out97.7%
*-commutative97.7%
associate-*l*97.7%
distribute-lft-out97.7%
+-commutative97.7%
*-commutative97.7%
unpow297.7%
Simplified97.7%
Taylor expanded in im around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in re around inf 67.7%
unpow267.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
Taylor expanded in im around 0 77.7%
unpow277.7%
*-commutative77.7%
associate-*r*77.7%
Simplified77.7%
Final simplification42.3%
(FPCore (re im)
:precision binary64
(if (<= re -3.8)
(* re (* im (* im -0.5)))
(if (<= re 210.0)
(+ re 1.0)
(if (<= re 1.05e+144) (* -0.5 (* im (* re im))) (* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -3.8) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = re + 1.0;
} else if (re <= 1.05e+144) {
tmp = -0.5 * (im * (re * 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.8d0)) then
tmp = re * (im * (im * (-0.5d0)))
else if (re <= 210.0d0) then
tmp = re + 1.0d0
else if (re <= 1.05d+144) then
tmp = (-0.5d0) * (im * (re * 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.8) {
tmp = re * (im * (im * -0.5));
} else if (re <= 210.0) {
tmp = re + 1.0;
} else if (re <= 1.05e+144) {
tmp = -0.5 * (im * (re * im));
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3.8: tmp = re * (im * (im * -0.5)) elif re <= 210.0: tmp = re + 1.0 elif re <= 1.05e+144: tmp = -0.5 * (im * (re * im)) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -3.8) tmp = Float64(re * Float64(im * Float64(im * -0.5))); elseif (re <= 210.0) tmp = Float64(re + 1.0); elseif (re <= 1.05e+144) tmp = Float64(-0.5 * Float64(im * Float64(re * 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.8) tmp = re * (im * (im * -0.5)); elseif (re <= 210.0) tmp = re + 1.0; elseif (re <= 1.05e+144) tmp = -0.5 * (im * (re * im)); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3.8], N[(re * N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 210.0], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 1.05e+144], N[(-0.5 * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -3.8:\\
\;\;\;\;re \cdot \left(im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{elif}\;re \leq 210:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 1.05 \cdot 10^{+144}:\\
\;\;\;\;-0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -3.7999999999999998Initial program 99.9%
Taylor expanded in re around 0 2.3%
*-rgt-identity2.3%
distribute-lft-out2.3%
Simplified2.3%
Taylor expanded in re around inf 2.3%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 26.0%
*-commutative26.0%
associate-*r*26.0%
*-commutative26.0%
unpow226.0%
associate-*r*26.0%
*-commutative26.0%
Simplified26.0%
if -3.7999999999999998 < re < 210Initial program 100.0%
Taylor expanded in re around 0 99.2%
*-rgt-identity99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in im around 0 55.2%
if 210 < re < 1.04999999999999998e144Initial program 100.0%
Taylor expanded in re around 0 3.7%
*-rgt-identity3.7%
distribute-lft-out3.7%
Simplified3.7%
Taylor expanded in re around inf 3.7%
Taylor expanded in im around 0 18.0%
unpow220.8%
Simplified18.0%
Taylor expanded in im around inf 16.9%
unpow216.9%
associate-*r*16.9%
*-commutative16.9%
Simplified16.9%
if 1.04999999999999998e144 < re Initial program 100.0%
Taylor expanded in re around 0 97.7%
+-commutative97.7%
+-commutative97.7%
*-rgt-identity97.7%
distribute-lft-out97.7%
*-commutative97.7%
associate-*l*97.7%
distribute-lft-out97.7%
+-commutative97.7%
*-commutative97.7%
unpow297.7%
Simplified97.7%
Taylor expanded in im around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in re around inf 67.7%
unpow267.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
Taylor expanded in im around 0 77.7%
unpow277.7%
*-commutative77.7%
associate-*r*77.7%
Simplified77.7%
Final simplification46.0%
(FPCore (re im) :precision binary64 (if (<= re 215.0) 1.0 (* re (* re 0.5))))
double code(double re, double im) {
double tmp;
if (re <= 215.0) {
tmp = 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 <= 215.0d0) then
tmp = 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 <= 215.0) {
tmp = 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 215.0: tmp = 1.0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 215.0) tmp = 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 <= 215.0) tmp = 1.0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 215.0], 1.0, N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 215:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 215Initial program 100.0%
Taylor expanded in re around 0 65.1%
Taylor expanded in im around 0 36.8%
if 215 < re Initial program 100.0%
Taylor expanded in re around 0 52.9%
+-commutative52.9%
+-commutative52.9%
*-rgt-identity52.9%
distribute-lft-out52.9%
*-commutative52.9%
associate-*l*52.9%
distribute-lft-out52.9%
+-commutative52.9%
*-commutative52.9%
unpow252.9%
Simplified52.9%
Taylor expanded in im around 0 45.4%
unpow245.4%
Simplified45.4%
Taylor expanded in re around inf 45.4%
unpow245.4%
*-commutative45.4%
associate-*r*45.4%
Simplified45.4%
Taylor expanded in im around 0 42.1%
unpow242.1%
*-commutative42.1%
associate-*r*42.1%
Simplified42.1%
Final simplification38.4%
(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 47.2%
*-rgt-identity47.2%
distribute-lft-out47.2%
Simplified47.2%
Taylor expanded in im around 0 26.9%
Final simplification26.9%
(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 46.5%
Taylor expanded in im around 0 26.5%
Final simplification26.5%
herbie shell --seed 2023178
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))