
(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 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
Initial program 100.0%
(FPCore (re im) :precision binary64 (if (or (<= (exp re) 0.0) (not (<= (exp re) 2.0))) (exp re) (* (cos im) (+ re 1.0))))
double code(double re, double im) {
double tmp;
if ((exp(re) <= 0.0) || !(exp(re) <= 2.0)) {
tmp = exp(re);
} else {
tmp = cos(im) * (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 ((exp(re) <= 0.0d0) .or. (.not. (exp(re) <= 2.0d0))) then
tmp = exp(re)
else
tmp = cos(im) * (re + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((Math.exp(re) <= 0.0) || !(Math.exp(re) <= 2.0)) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (re + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if (math.exp(re) <= 0.0) or not (math.exp(re) <= 2.0): tmp = math.exp(re) else: tmp = math.cos(im) * (re + 1.0) return tmp
function code(re, im) tmp = 0.0 if ((exp(re) <= 0.0) || !(exp(re) <= 2.0)) tmp = exp(re); else tmp = Float64(cos(im) * Float64(re + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((exp(re) <= 0.0) || ~((exp(re) <= 2.0))) tmp = exp(re); else tmp = cos(im) * (re + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[N[Exp[re], $MachinePrecision], 0.0], N[Not[LessEqual[N[Exp[re], $MachinePrecision], 2.0]], $MachinePrecision]], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0 \lor \neg \left(e^{re} \leq 2\right):\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0 or 2 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 86.4%
if 0.0 < (exp.f64 re) < 2Initial program 100.0%
Taylor expanded in re around 0 99.6%
distribute-rgt1-in99.6%
*-commutative99.6%
Simplified99.6%
Final simplification92.5%
(FPCore (re im) :precision binary64 (if (or (<= (exp re) 0.0) (not (<= (exp re) 2.0))) (exp re) (cos im)))
double code(double re, double im) {
double tmp;
if ((exp(re) <= 0.0) || !(exp(re) <= 2.0)) {
tmp = exp(re);
} else {
tmp = cos(im);
}
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.0d0) .or. (.not. (exp(re) <= 2.0d0))) then
tmp = exp(re)
else
tmp = cos(im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((Math.exp(re) <= 0.0) || !(Math.exp(re) <= 2.0)) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im);
}
return tmp;
}
def code(re, im): tmp = 0 if (math.exp(re) <= 0.0) or not (math.exp(re) <= 2.0): tmp = math.exp(re) else: tmp = math.cos(im) return tmp
function code(re, im) tmp = 0.0 if ((exp(re) <= 0.0) || !(exp(re) <= 2.0)) tmp = exp(re); else tmp = cos(im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((exp(re) <= 0.0) || ~((exp(re) <= 2.0))) tmp = exp(re); else tmp = cos(im); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[N[Exp[re], $MachinePrecision], 0.0], N[Not[LessEqual[N[Exp[re], $MachinePrecision], 2.0]], $MachinePrecision]], N[Exp[re], $MachinePrecision], N[Cos[im], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0 \lor \neg \left(e^{re} \leq 2\right):\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0 or 2 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 86.4%
if 0.0 < (exp.f64 re) < 2Initial program 100.0%
Taylor expanded in re around 0 98.6%
Final simplification92.0%
(FPCore (re im)
:precision binary64
(if (<= re -0.024)
(exp re)
(if (<= re 350.0)
(*
(cos im)
(+ (+ re 1.0) (* (+ 0.5 (* re 0.16666666666666666)) (* re re))))
(if (<= re 2.1e+90)
(* (exp re) (+ 1.0 (* im (* im -0.5))))
(* (cos im) (* 0.16666666666666666 (* re (* re re))))))))
double code(double re, double im) {
double tmp;
if (re <= -0.024) {
tmp = exp(re);
} else if (re <= 350.0) {
tmp = cos(im) * ((re + 1.0) + ((0.5 + (re * 0.16666666666666666)) * (re * re)));
} else if (re <= 2.1e+90) {
tmp = exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = cos(im) * (0.16666666666666666 * (re * (re * re)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-0.024d0)) then
tmp = exp(re)
else if (re <= 350.0d0) then
tmp = cos(im) * ((re + 1.0d0) + ((0.5d0 + (re * 0.16666666666666666d0)) * (re * re)))
else if (re <= 2.1d+90) then
tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
else
tmp = cos(im) * (0.16666666666666666d0 * (re * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.024) {
tmp = Math.exp(re);
} else if (re <= 350.0) {
tmp = Math.cos(im) * ((re + 1.0) + ((0.5 + (re * 0.16666666666666666)) * (re * re)));
} else if (re <= 2.1e+90) {
tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = Math.cos(im) * (0.16666666666666666 * (re * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.024: tmp = math.exp(re) elif re <= 350.0: tmp = math.cos(im) * ((re + 1.0) + ((0.5 + (re * 0.16666666666666666)) * (re * re))) elif re <= 2.1e+90: tmp = math.exp(re) * (1.0 + (im * (im * -0.5))) else: tmp = math.cos(im) * (0.16666666666666666 * (re * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.024) tmp = exp(re); elseif (re <= 350.0) tmp = Float64(cos(im) * Float64(Float64(re + 1.0) + Float64(Float64(0.5 + Float64(re * 0.16666666666666666)) * Float64(re * re)))); elseif (re <= 2.1e+90) tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); else tmp = Float64(cos(im) * Float64(0.16666666666666666 * Float64(re * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.024) tmp = exp(re); elseif (re <= 350.0) tmp = cos(im) * ((re + 1.0) + ((0.5 + (re * 0.16666666666666666)) * (re * re))); elseif (re <= 2.1e+90) tmp = exp(re) * (1.0 + (im * (im * -0.5))); else tmp = cos(im) * (0.16666666666666666 * (re * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.024], N[Exp[re], $MachinePrecision], If[LessEqual[re, 350.0], N[(N[Cos[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.1e+90], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.024:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 350:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + \left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\right)\\
\mathbf{elif}\;re \leq 2.1 \cdot 10^{+90}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\
\end{array}
\end{array}
if re < -0.024Initial program 100.0%
Taylor expanded in im around 0 100.0%
if -0.024 < re < 350Initial program 100.0%
Taylor expanded in re around 0 98.4%
distribute-rgt-in98.4%
*-commutative98.4%
associate-+r+98.4%
distribute-rgt1-in98.4%
*-commutative98.4%
*-commutative98.4%
associate-*l*98.4%
+-commutative98.4%
associate-*r*98.4%
distribute-rgt-out98.4%
associate-*l*98.4%
distribute-lft-out98.4%
Simplified98.4%
if 350 < re < 2.09999999999999981e90Initial program 100.0%
Taylor expanded in im around 0 0.0%
*-lft-identity0.0%
associate-*r*0.0%
distribute-rgt-out82.6%
*-commutative82.6%
unpow282.6%
associate-*l*82.6%
Simplified82.6%
if 2.09999999999999981e90 < re Initial program 100.0%
Taylor expanded in re around 0 98.0%
distribute-rgt-in98.0%
*-commutative98.0%
associate-+r+98.0%
distribute-rgt1-in98.0%
*-commutative98.0%
*-commutative98.0%
associate-*l*98.0%
+-commutative98.0%
associate-*r*98.0%
distribute-rgt-out98.0%
associate-*l*98.0%
distribute-lft-out98.0%
Simplified98.0%
Taylor expanded in re around inf 98.0%
associate-*r*98.0%
cube-mult98.0%
Simplified98.0%
Final simplification97.3%
(FPCore (re im)
:precision binary64
(if (<= re -0.0205)
(exp re)
(if (<= re 350.0)
(* (cos im) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))
(if (<= re 2.1e+90)
(* (exp re) (+ 1.0 (* im (* im -0.5))))
(* (cos im) (* 0.16666666666666666 (* re (* re re))))))))
double code(double re, double im) {
double tmp;
if (re <= -0.0205) {
tmp = exp(re);
} else if (re <= 350.0) {
tmp = cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
} else if (re <= 2.1e+90) {
tmp = exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = cos(im) * (0.16666666666666666 * (re * (re * re)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-0.0205d0)) then
tmp = exp(re)
else if (re <= 350.0d0) then
tmp = cos(im) * (1.0d0 + (re * (1.0d0 + (re * 0.5d0))))
else if (re <= 2.1d+90) then
tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
else
tmp = cos(im) * (0.16666666666666666d0 * (re * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.0205) {
tmp = Math.exp(re);
} else if (re <= 350.0) {
tmp = Math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
} else if (re <= 2.1e+90) {
tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = Math.cos(im) * (0.16666666666666666 * (re * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0205: tmp = math.exp(re) elif re <= 350.0: tmp = math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5)))) elif re <= 2.1e+90: tmp = math.exp(re) * (1.0 + (im * (im * -0.5))) else: tmp = math.cos(im) * (0.16666666666666666 * (re * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0205) tmp = exp(re); elseif (re <= 350.0) tmp = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))))); elseif (re <= 2.1e+90) tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); else tmp = Float64(cos(im) * Float64(0.16666666666666666 * Float64(re * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.0205) tmp = exp(re); elseif (re <= 350.0) tmp = cos(im) * (1.0 + (re * (1.0 + (re * 0.5)))); elseif (re <= 2.1e+90) tmp = exp(re) * (1.0 + (im * (im * -0.5))); else tmp = cos(im) * (0.16666666666666666 * (re * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0205], N[Exp[re], $MachinePrecision], If[LessEqual[re, 350.0], N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.1e+90], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0205:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 350:\\
\;\;\;\;\cos im \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\
\mathbf{elif}\;re \leq 2.1 \cdot 10^{+90}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\
\end{array}
\end{array}
if re < -0.0205000000000000009Initial program 100.0%
Taylor expanded in im around 0 100.0%
if -0.0205000000000000009 < re < 350Initial program 100.0%
Taylor expanded in re around 0 98.3%
*-rgt-identity98.3%
distribute-rgt-in98.3%
*-commutative98.3%
associate-*l*98.3%
*-commutative98.3%
associate-*l*98.3%
distribute-lft-out98.3%
distribute-lft-out98.3%
*-commutative98.3%
distribute-rgt1-in98.3%
+-commutative98.3%
*-commutative98.3%
Simplified98.3%
if 350 < re < 2.09999999999999981e90Initial program 100.0%
Taylor expanded in im around 0 0.0%
*-lft-identity0.0%
associate-*r*0.0%
distribute-rgt-out82.6%
*-commutative82.6%
unpow282.6%
associate-*l*82.6%
Simplified82.6%
if 2.09999999999999981e90 < re Initial program 100.0%
Taylor expanded in re around 0 98.0%
distribute-rgt-in98.0%
*-commutative98.0%
associate-+r+98.0%
distribute-rgt1-in98.0%
*-commutative98.0%
*-commutative98.0%
associate-*l*98.0%
+-commutative98.0%
associate-*r*98.0%
distribute-rgt-out98.0%
associate-*l*98.0%
distribute-lft-out98.0%
Simplified98.0%
Taylor expanded in re around inf 98.0%
associate-*r*98.0%
cube-mult98.0%
Simplified98.0%
Final simplification97.3%
(FPCore (re im)
:precision binary64
(if (<= re -0.0003)
(exp re)
(if (<= re 350.0)
(* (cos im) (+ re 1.0))
(if (<= re 2.1e+90)
(* (exp re) (+ 1.0 (* im (* im -0.5))))
(* (cos im) (* 0.16666666666666666 (* re (* re re))))))))
double code(double re, double im) {
double tmp;
if (re <= -0.0003) {
tmp = exp(re);
} else if (re <= 350.0) {
tmp = cos(im) * (re + 1.0);
} else if (re <= 2.1e+90) {
tmp = exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = cos(im) * (0.16666666666666666 * (re * (re * re)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-0.0003d0)) then
tmp = exp(re)
else if (re <= 350.0d0) then
tmp = cos(im) * (re + 1.0d0)
else if (re <= 2.1d+90) then
tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
else
tmp = cos(im) * (0.16666666666666666d0 * (re * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.0003) {
tmp = Math.exp(re);
} else if (re <= 350.0) {
tmp = Math.cos(im) * (re + 1.0);
} else if (re <= 2.1e+90) {
tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = Math.cos(im) * (0.16666666666666666 * (re * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0003: tmp = math.exp(re) elif re <= 350.0: tmp = math.cos(im) * (re + 1.0) elif re <= 2.1e+90: tmp = math.exp(re) * (1.0 + (im * (im * -0.5))) else: tmp = math.cos(im) * (0.16666666666666666 * (re * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0003) tmp = exp(re); elseif (re <= 350.0) tmp = Float64(cos(im) * Float64(re + 1.0)); elseif (re <= 2.1e+90) tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); else tmp = Float64(cos(im) * Float64(0.16666666666666666 * Float64(re * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.0003) tmp = exp(re); elseif (re <= 350.0) tmp = cos(im) * (re + 1.0); elseif (re <= 2.1e+90) tmp = exp(re) * (1.0 + (im * (im * -0.5))); else tmp = cos(im) * (0.16666666666666666 * (re * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0003], N[Exp[re], $MachinePrecision], If[LessEqual[re, 350.0], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.1e+90], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0003:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 350:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 2.1 \cdot 10^{+90}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\
\end{array}
\end{array}
if re < -2.99999999999999974e-4Initial program 100.0%
Taylor expanded in im around 0 100.0%
if -2.99999999999999974e-4 < re < 350Initial program 100.0%
Taylor expanded in re around 0 98.1%
distribute-rgt1-in98.1%
*-commutative98.1%
Simplified98.1%
if 350 < re < 2.09999999999999981e90Initial program 100.0%
Taylor expanded in im around 0 0.0%
*-lft-identity0.0%
associate-*r*0.0%
distribute-rgt-out82.6%
*-commutative82.6%
unpow282.6%
associate-*l*82.6%
Simplified82.6%
if 2.09999999999999981e90 < re Initial program 100.0%
Taylor expanded in re around 0 98.0%
distribute-rgt-in98.0%
*-commutative98.0%
associate-+r+98.0%
distribute-rgt1-in98.0%
*-commutative98.0%
*-commutative98.0%
associate-*l*98.0%
+-commutative98.0%
associate-*r*98.0%
distribute-rgt-out98.0%
associate-*l*98.0%
distribute-lft-out98.0%
Simplified98.0%
Taylor expanded in re around inf 98.0%
associate-*r*98.0%
cube-mult98.0%
Simplified98.0%
Final simplification97.2%
(FPCore (re im)
:precision binary64
(if (<= re -0.00068)
(exp re)
(if (<= re 0.0036)
(/ (- (cos im)) (+ re -1.0))
(if (<= re 1.25e+150) (exp re) (* (cos im) (+ 1.0 (* re (* re 0.5))))))))
double code(double re, double im) {
double tmp;
if (re <= -0.00068) {
tmp = exp(re);
} else if (re <= 0.0036) {
tmp = -cos(im) / (re + -1.0);
} else if (re <= 1.25e+150) {
tmp = exp(re);
} else {
tmp = cos(im) * (1.0 + (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.00068d0)) then
tmp = exp(re)
else if (re <= 0.0036d0) then
tmp = -cos(im) / (re + (-1.0d0))
else if (re <= 1.25d+150) then
tmp = exp(re)
else
tmp = cos(im) * (1.0d0 + (re * (re * 0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.00068) {
tmp = Math.exp(re);
} else if (re <= 0.0036) {
tmp = -Math.cos(im) / (re + -1.0);
} else if (re <= 1.25e+150) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (1.0 + (re * (re * 0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.00068: tmp = math.exp(re) elif re <= 0.0036: tmp = -math.cos(im) / (re + -1.0) elif re <= 1.25e+150: tmp = math.exp(re) else: tmp = math.cos(im) * (1.0 + (re * (re * 0.5))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.00068) tmp = exp(re); elseif (re <= 0.0036) tmp = Float64(Float64(-cos(im)) / Float64(re + -1.0)); elseif (re <= 1.25e+150) tmp = exp(re); else tmp = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(re * 0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.00068) tmp = exp(re); elseif (re <= 0.0036) tmp = -cos(im) / (re + -1.0); elseif (re <= 1.25e+150) tmp = exp(re); else tmp = cos(im) * (1.0 + (re * (re * 0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.00068], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0036], N[((-N[Cos[im], $MachinePrecision]) / N[(re + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.25e+150], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.00068:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0036:\\
\;\;\;\;\frac{-\cos im}{re + -1}\\
\mathbf{elif}\;re \leq 1.25 \cdot 10^{+150}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(1 + re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -6.8e-4 or 0.0035999999999999999 < re < 1.25000000000000002e150Initial program 100.0%
Taylor expanded in im around 0 93.4%
if -6.8e-4 < re < 0.0035999999999999999Initial program 100.0%
Taylor expanded in re around 0 99.6%
distribute-rgt1-in99.6%
*-commutative99.6%
Simplified99.6%
*-commutative99.6%
flip-+99.6%
associate-*l/99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in re around 0 99.6%
mul-1-neg99.6%
neg-sub099.6%
Simplified99.6%
if 1.25000000000000002e150 < re Initial program 100.0%
Taylor expanded in re around 0 97.5%
*-rgt-identity97.5%
distribute-rgt-in97.5%
*-commutative97.5%
associate-*l*97.5%
*-commutative97.5%
associate-*l*97.5%
distribute-lft-out97.5%
distribute-lft-out97.5%
*-commutative97.5%
distribute-rgt1-in97.5%
+-commutative97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in re around inf 97.5%
*-commutative97.5%
unpow297.5%
associate-*r*97.5%
Simplified97.5%
Final simplification96.8%
(FPCore (re im)
:precision binary64
(if (<= re -0.0014)
(exp re)
(if (<= re 0.0165)
(/ (- (cos im)) (+ re -1.0))
(if (<= re 1.25e+150) (exp re) (* (cos im) (* re (* re 0.5)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.0014) {
tmp = exp(re);
} else if (re <= 0.0165) {
tmp = -cos(im) / (re + -1.0);
} else if (re <= 1.25e+150) {
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.0014d0)) then
tmp = exp(re)
else if (re <= 0.0165d0) then
tmp = -cos(im) / (re + (-1.0d0))
else if (re <= 1.25d+150) 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.0014) {
tmp = Math.exp(re);
} else if (re <= 0.0165) {
tmp = -Math.cos(im) / (re + -1.0);
} else if (re <= 1.25e+150) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0014: tmp = math.exp(re) elif re <= 0.0165: tmp = -math.cos(im) / (re + -1.0) elif re <= 1.25e+150: 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.0014) tmp = exp(re); elseif (re <= 0.0165) tmp = Float64(Float64(-cos(im)) / Float64(re + -1.0)); elseif (re <= 1.25e+150) 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.0014) tmp = exp(re); elseif (re <= 0.0165) tmp = -cos(im) / (re + -1.0); elseif (re <= 1.25e+150) tmp = exp(re); else tmp = cos(im) * (re * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0014], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0165], N[((-N[Cos[im], $MachinePrecision]) / N[(re + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.25e+150], 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.0014:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0165:\\
\;\;\;\;\frac{-\cos im}{re + -1}\\
\mathbf{elif}\;re \leq 1.25 \cdot 10^{+150}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.00139999999999999999 or 0.016500000000000001 < re < 1.25000000000000002e150Initial program 100.0%
Taylor expanded in im around 0 93.4%
if -0.00139999999999999999 < re < 0.016500000000000001Initial program 100.0%
Taylor expanded in re around 0 99.6%
distribute-rgt1-in99.6%
*-commutative99.6%
Simplified99.6%
*-commutative99.6%
flip-+99.6%
associate-*l/99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in re around 0 99.6%
mul-1-neg99.6%
neg-sub099.6%
Simplified99.6%
if 1.25000000000000002e150 < re Initial program 100.0%
Taylor expanded in re around 0 97.5%
*-rgt-identity97.5%
distribute-rgt-in97.5%
*-commutative97.5%
associate-*l*97.5%
*-commutative97.5%
associate-*l*97.5%
distribute-lft-out97.5%
distribute-lft-out97.5%
*-commutative97.5%
distribute-rgt1-in97.5%
+-commutative97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in re around inf 97.5%
*-commutative97.5%
*-commutative97.5%
associate-*l*97.5%
unpow297.5%
associate-*r*97.5%
Simplified97.5%
Final simplification96.8%
(FPCore (re im)
:precision binary64
(if (<= re -0.0044)
(exp re)
(if (<= re 0.00225)
(* (cos im) (+ re 1.0))
(if (<= re 1.25e+150) (exp re) (* (cos im) (* re (* re 0.5)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.0044) {
tmp = exp(re);
} else if (re <= 0.00225) {
tmp = cos(im) * (re + 1.0);
} else if (re <= 1.25e+150) {
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.0044d0)) then
tmp = exp(re)
else if (re <= 0.00225d0) then
tmp = cos(im) * (re + 1.0d0)
else if (re <= 1.25d+150) 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.0044) {
tmp = Math.exp(re);
} else if (re <= 0.00225) {
tmp = Math.cos(im) * (re + 1.0);
} else if (re <= 1.25e+150) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0044: tmp = math.exp(re) elif re <= 0.00225: tmp = math.cos(im) * (re + 1.0) elif re <= 1.25e+150: 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.0044) tmp = exp(re); elseif (re <= 0.00225) tmp = Float64(cos(im) * Float64(re + 1.0)); elseif (re <= 1.25e+150) 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.0044) tmp = exp(re); elseif (re <= 0.00225) tmp = cos(im) * (re + 1.0); elseif (re <= 1.25e+150) tmp = exp(re); else tmp = cos(im) * (re * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0044], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.00225], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.25e+150], 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.0044:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.00225:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 1.25 \cdot 10^{+150}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.00440000000000000027 or 0.00224999999999999983 < re < 1.25000000000000002e150Initial program 100.0%
Taylor expanded in im around 0 93.4%
if -0.00440000000000000027 < re < 0.00224999999999999983Initial program 100.0%
Taylor expanded in re around 0 99.6%
distribute-rgt1-in99.6%
*-commutative99.6%
Simplified99.6%
if 1.25000000000000002e150 < re Initial program 100.0%
Taylor expanded in re around 0 97.5%
*-rgt-identity97.5%
distribute-rgt-in97.5%
*-commutative97.5%
associate-*l*97.5%
*-commutative97.5%
associate-*l*97.5%
distribute-lft-out97.5%
distribute-lft-out97.5%
*-commutative97.5%
distribute-rgt1-in97.5%
+-commutative97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in re around inf 97.5%
*-commutative97.5%
*-commutative97.5%
associate-*l*97.5%
unpow297.5%
associate-*r*97.5%
Simplified97.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re re))))
(if (<= re -2100000.0)
(* (* im im) (* (* re re) (- (/ 0.5 (- re)) 0.25)))
(if (<= re 680.0)
(cos im)
(if (<= re 1.65e+77)
(+
(* im (* (* re re) (+ (* -0.5 (/ im re)) (* im -0.25))))
(+
1.0
(/
(+ t_0 (* 0.125 (* (* re re) (* re t_0))))
(+ (* re re) (* (* re re) (- (* re (* re 0.25)) (* re 0.5)))))))
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))))
double code(double re, double im) {
double t_0 = re * (re * re);
double tmp;
if (re <= -2100000.0) {
tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25));
} else if (re <= 680.0) {
tmp = cos(im);
} else if (re <= 1.65e+77) {
tmp = (im * ((re * re) * ((-0.5 * (im / re)) + (im * -0.25)))) + (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5))))));
} else {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = re * (re * re)
if (re <= (-2100000.0d0)) then
tmp = (im * im) * ((re * re) * ((0.5d0 / -re) - 0.25d0))
else if (re <= 680.0d0) then
tmp = cos(im)
else if (re <= 1.65d+77) then
tmp = (im * ((re * re) * (((-0.5d0) * (im / re)) + (im * (-0.25d0))))) + (1.0d0 + ((t_0 + (0.125d0 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25d0)) - (re * 0.5d0))))))
else
tmp = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * re);
double tmp;
if (re <= -2100000.0) {
tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25));
} else if (re <= 680.0) {
tmp = Math.cos(im);
} else if (re <= 1.65e+77) {
tmp = (im * ((re * re) * ((-0.5 * (im / re)) + (im * -0.25)))) + (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5))))));
} else {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
return tmp;
}
def code(re, im): t_0 = re * (re * re) tmp = 0 if re <= -2100000.0: tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25)) elif re <= 680.0: tmp = math.cos(im) elif re <= 1.65e+77: tmp = (im * ((re * re) * ((-0.5 * (im / re)) + (im * -0.25)))) + (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5)))))) else: tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) return tmp
function code(re, im) t_0 = Float64(re * Float64(re * re)) tmp = 0.0 if (re <= -2100000.0) tmp = Float64(Float64(im * im) * Float64(Float64(re * re) * Float64(Float64(0.5 / Float64(-re)) - 0.25))); elseif (re <= 680.0) tmp = cos(im); elseif (re <= 1.65e+77) tmp = Float64(Float64(im * Float64(Float64(re * re) * Float64(Float64(-0.5 * Float64(im / re)) + Float64(im * -0.25)))) + Float64(1.0 + Float64(Float64(t_0 + Float64(0.125 * Float64(Float64(re * re) * Float64(re * t_0)))) / Float64(Float64(re * re) + Float64(Float64(re * re) * Float64(Float64(re * Float64(re * 0.25)) - Float64(re * 0.5))))))); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * re); tmp = 0.0; if (re <= -2100000.0) tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25)); elseif (re <= 680.0) tmp = cos(im); elseif (re <= 1.65e+77) tmp = (im * ((re * re) * ((-0.5 * (im / re)) + (im * -0.25)))) + (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5)))))); else tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2100000.0], N[(N[(im * im), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(N[(0.5 / (-re)), $MachinePrecision] - 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 680.0], N[Cos[im], $MachinePrecision], If[LessEqual[re, 1.65e+77], N[(N[(im * N[(N[(re * re), $MachinePrecision] * N[(N[(-0.5 * N[(im / re), $MachinePrecision]), $MachinePrecision] + N[(im * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$0 + N[(0.125 * N[(N[(re * re), $MachinePrecision] * N[(re * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(re * re), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(N[(re * N[(re * 0.25), $MachinePrecision]), $MachinePrecision] - N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -2100000:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(re \cdot re\right) \cdot \left(\frac{0.5}{-re} - 0.25\right)\right)\\
\mathbf{elif}\;re \leq 680:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 1.65 \cdot 10^{+77}:\\
\;\;\;\;im \cdot \left(\left(re \cdot re\right) \cdot \left(-0.5 \cdot \frac{im}{re} + im \cdot -0.25\right)\right) + \left(1 + \frac{t\_0 + 0.125 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot t\_0\right)\right)}{re \cdot re + \left(re \cdot re\right) \cdot \left(re \cdot \left(re \cdot 0.25\right) - re \cdot 0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -2.1e6Initial program 100.0%
Taylor expanded in re around 0 1.9%
*-rgt-identity1.9%
distribute-rgt-in1.9%
*-commutative1.9%
associate-*l*1.9%
*-commutative1.9%
associate-*l*1.9%
distribute-lft-out1.9%
distribute-lft-out1.9%
*-commutative1.9%
distribute-rgt1-in1.9%
+-commutative1.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in im around 0 0.9%
+-commutative0.9%
distribute-rgt-in0.9%
*-commutative0.9%
distribute-rgt-in0.9%
associate-+l+0.9%
Simplified0.9%
Taylor expanded in re around inf 0.9%
unpow20.9%
*-commutative0.9%
Simplified0.9%
Taylor expanded in im around inf 10.2%
mul-1-neg10.2%
distribute-rgt-neg-in10.2%
unpow210.2%
*-commutative10.2%
distribute-rgt-neg-in10.2%
+-commutative10.2%
associate-*r/10.2%
metadata-eval10.2%
mul-1-neg10.2%
unpow210.2%
Simplified10.2%
if -2.1e6 < re < 680Initial program 100.0%
Taylor expanded in re around 0 96.4%
if 680 < re < 1.6499999999999999e77Initial program 100.0%
Taylor expanded in re around 0 3.9%
*-rgt-identity3.9%
distribute-rgt-in3.9%
*-commutative3.9%
associate-*l*3.9%
*-commutative3.9%
associate-*l*3.9%
distribute-lft-out3.9%
distribute-lft-out3.9%
*-commutative3.9%
distribute-rgt1-in3.9%
+-commutative3.9%
*-commutative3.9%
Simplified3.9%
Taylor expanded in im around 0 16.9%
+-commutative16.9%
distribute-rgt-in16.9%
*-commutative16.9%
distribute-rgt-in16.9%
associate-+l+16.9%
Simplified16.9%
Taylor expanded in re around inf 16.9%
unpow216.9%
*-commutative16.9%
Simplified16.9%
distribute-rgt-in16.9%
*-un-lft-identity16.9%
flip3-+39.7%
cube-mult39.7%
*-commutative39.7%
*-commutative39.7%
*-commutative39.7%
*-commutative39.7%
Applied egg-rr39.7%
+-commutative39.7%
associate-*r*39.7%
unpow239.7%
*-commutative39.7%
cube-prod39.7%
metadata-eval39.7%
cube-unmult39.7%
unpow239.7%
unpow239.7%
associate-*l*39.7%
unpow239.7%
Simplified39.7%
if 1.6499999999999999e77 < re Initial program 100.0%
Taylor expanded in re around 0 94.1%
distribute-rgt-in94.1%
*-commutative94.1%
associate-+r+94.1%
distribute-rgt1-in94.1%
*-commutative94.1%
*-commutative94.1%
associate-*l*94.1%
+-commutative94.1%
associate-*r*94.1%
distribute-rgt-out94.1%
associate-*l*94.1%
distribute-lft-out94.1%
Simplified94.1%
Taylor expanded in im around 0 68.6%
*-rgt-identity68.6%
unpow268.6%
+-commutative68.6%
*-commutative68.6%
associate-*l*68.6%
*-commutative68.6%
+-commutative68.6%
distribute-lft-in68.6%
Simplified68.6%
Final simplification64.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re re))))
(if (<= re -350.0)
(* (* im im) (* (* re re) (- (/ 0.5 (- re)) 0.25)))
(if (or (<= re 320.0) (not (<= re 1.65e+77)))
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))
(+
(* im (* (* re re) (+ (* -0.5 (/ im re)) (* im -0.25))))
(+
1.0
(/
(+ t_0 (* 0.125 (* (* re re) (* re t_0))))
(+ (* re re) (* (* re re) (- (* re (* re 0.25)) (* re 0.5)))))))))))
double code(double re, double im) {
double t_0 = re * (re * re);
double tmp;
if (re <= -350.0) {
tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25));
} else if ((re <= 320.0) || !(re <= 1.65e+77)) {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
} else {
tmp = (im * ((re * re) * ((-0.5 * (im / re)) + (im * -0.25)))) + (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (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 = re * (re * re)
if (re <= (-350.0d0)) then
tmp = (im * im) * ((re * re) * ((0.5d0 / -re) - 0.25d0))
else if ((re <= 320.0d0) .or. (.not. (re <= 1.65d+77))) then
tmp = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
else
tmp = (im * ((re * re) * (((-0.5d0) * (im / re)) + (im * (-0.25d0))))) + (1.0d0 + ((t_0 + (0.125d0 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25d0)) - (re * 0.5d0))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * re);
double tmp;
if (re <= -350.0) {
tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25));
} else if ((re <= 320.0) || !(re <= 1.65e+77)) {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
} else {
tmp = (im * ((re * re) * ((-0.5 * (im / re)) + (im * -0.25)))) + (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5))))));
}
return tmp;
}
def code(re, im): t_0 = re * (re * re) tmp = 0 if re <= -350.0: tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25)) elif (re <= 320.0) or not (re <= 1.65e+77): tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) else: tmp = (im * ((re * re) * ((-0.5 * (im / re)) + (im * -0.25)))) + (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5)))))) return tmp
function code(re, im) t_0 = Float64(re * Float64(re * re)) tmp = 0.0 if (re <= -350.0) tmp = Float64(Float64(im * im) * Float64(Float64(re * re) * Float64(Float64(0.5 / Float64(-re)) - 0.25))); elseif ((re <= 320.0) || !(re <= 1.65e+77)) tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))); else tmp = Float64(Float64(im * Float64(Float64(re * re) * Float64(Float64(-0.5 * Float64(im / re)) + Float64(im * -0.25)))) + Float64(1.0 + Float64(Float64(t_0 + Float64(0.125 * Float64(Float64(re * re) * Float64(re * t_0)))) / Float64(Float64(re * re) + Float64(Float64(re * re) * Float64(Float64(re * Float64(re * 0.25)) - Float64(re * 0.5))))))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * re); tmp = 0.0; if (re <= -350.0) tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25)); elseif ((re <= 320.0) || ~((re <= 1.65e+77))) tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); else tmp = (im * ((re * re) * ((-0.5 * (im / re)) + (im * -0.25)))) + (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5)))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -350.0], N[(N[(im * im), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(N[(0.5 / (-re)), $MachinePrecision] - 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 320.0], N[Not[LessEqual[re, 1.65e+77]], $MachinePrecision]], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im * N[(N[(re * re), $MachinePrecision] * N[(N[(-0.5 * N[(im / re), $MachinePrecision]), $MachinePrecision] + N[(im * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$0 + N[(0.125 * N[(N[(re * re), $MachinePrecision] * N[(re * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(re * re), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(N[(re * N[(re * 0.25), $MachinePrecision]), $MachinePrecision] - N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -350:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(re \cdot re\right) \cdot \left(\frac{0.5}{-re} - 0.25\right)\right)\\
\mathbf{elif}\;re \leq 320 \lor \neg \left(re \leq 1.65 \cdot 10^{+77}\right):\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(\left(re \cdot re\right) \cdot \left(-0.5 \cdot \frac{im}{re} + im \cdot -0.25\right)\right) + \left(1 + \frac{t\_0 + 0.125 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot t\_0\right)\right)}{re \cdot re + \left(re \cdot re\right) \cdot \left(re \cdot \left(re \cdot 0.25\right) - re \cdot 0.5\right)}\right)\\
\end{array}
\end{array}
if re < -350Initial program 100.0%
Taylor expanded in re around 0 1.9%
*-rgt-identity1.9%
distribute-rgt-in1.9%
*-commutative1.9%
associate-*l*1.9%
*-commutative1.9%
associate-*l*1.9%
distribute-lft-out1.9%
distribute-lft-out1.9%
*-commutative1.9%
distribute-rgt1-in1.9%
+-commutative1.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in im around 0 0.9%
+-commutative0.9%
distribute-rgt-in0.9%
*-commutative0.9%
distribute-rgt-in0.9%
associate-+l+0.9%
Simplified0.9%
Taylor expanded in re around inf 0.9%
unpow20.9%
*-commutative0.9%
Simplified0.9%
Taylor expanded in im around inf 10.1%
mul-1-neg10.1%
distribute-rgt-neg-in10.1%
unpow210.1%
*-commutative10.1%
distribute-rgt-neg-in10.1%
+-commutative10.1%
associate-*r/10.1%
metadata-eval10.1%
mul-1-neg10.1%
unpow210.1%
Simplified10.1%
if -350 < re < 320 or 1.6499999999999999e77 < re Initial program 100.0%
Taylor expanded in re around 0 97.8%
distribute-rgt-in97.8%
*-commutative97.8%
associate-+r+97.8%
distribute-rgt1-in97.8%
*-commutative97.8%
*-commutative97.8%
associate-*l*97.8%
+-commutative97.8%
associate-*r*97.8%
distribute-rgt-out97.8%
associate-*l*97.8%
distribute-lft-out97.8%
Simplified97.8%
Taylor expanded in im around 0 56.4%
*-rgt-identity56.4%
unpow256.4%
+-commutative56.4%
*-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
+-commutative56.4%
distribute-lft-in56.4%
Simplified56.4%
if 320 < re < 1.6499999999999999e77Initial program 100.0%
Taylor expanded in re around 0 4.0%
*-rgt-identity4.0%
distribute-rgt-in4.0%
*-commutative4.0%
associate-*l*4.0%
*-commutative4.0%
associate-*l*4.0%
distribute-lft-out4.0%
distribute-lft-out4.0%
*-commutative4.0%
distribute-rgt1-in4.0%
+-commutative4.0%
*-commutative4.0%
Simplified4.0%
Taylor expanded in im around 0 16.3%
+-commutative16.3%
distribute-rgt-in16.3%
*-commutative16.3%
distribute-rgt-in16.3%
associate-+l+16.3%
Simplified16.3%
Taylor expanded in re around inf 16.3%
unpow216.3%
*-commutative16.3%
Simplified16.3%
distribute-rgt-in16.3%
*-un-lft-identity16.3%
flip3-+38.1%
cube-mult38.1%
*-commutative38.1%
*-commutative38.1%
*-commutative38.1%
*-commutative38.1%
Applied egg-rr38.1%
+-commutative38.1%
associate-*r*38.1%
unpow238.1%
*-commutative38.1%
cube-prod38.1%
metadata-eval38.1%
cube-unmult38.1%
unpow238.1%
unpow238.1%
associate-*l*38.1%
unpow238.1%
Simplified38.1%
Final simplification42.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re re))))
(if (<= re -380.0)
(* (* im im) (* (* re re) (- (/ 0.5 (- re)) 0.25)))
(if (or (<= re 310.0) (not (<= re 1.65e+77)))
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))
(+
(+
1.0
(/
(+ t_0 (* 0.125 (* (* re re) (* re t_0))))
(+ (* re re) (* (* re re) (- (* re (* re 0.25)) (* re 0.5))))))
(* im (* im (* -0.5 (+ 1.0 (* re (+ 1.0 (* re 0.5))))))))))))
double code(double re, double im) {
double t_0 = re * (re * re);
double tmp;
if (re <= -380.0) {
tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25));
} else if ((re <= 310.0) || !(re <= 1.65e+77)) {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
} else {
tmp = (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5)))))) + (im * (im * (-0.5 * (1.0 + (re * (1.0 + (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 = re * (re * re)
if (re <= (-380.0d0)) then
tmp = (im * im) * ((re * re) * ((0.5d0 / -re) - 0.25d0))
else if ((re <= 310.0d0) .or. (.not. (re <= 1.65d+77))) then
tmp = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
else
tmp = (1.0d0 + ((t_0 + (0.125d0 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25d0)) - (re * 0.5d0)))))) + (im * (im * ((-0.5d0) * (1.0d0 + (re * (1.0d0 + (re * 0.5d0)))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * re);
double tmp;
if (re <= -380.0) {
tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25));
} else if ((re <= 310.0) || !(re <= 1.65e+77)) {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
} else {
tmp = (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5)))))) + (im * (im * (-0.5 * (1.0 + (re * (1.0 + (re * 0.5)))))));
}
return tmp;
}
def code(re, im): t_0 = re * (re * re) tmp = 0 if re <= -380.0: tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25)) elif (re <= 310.0) or not (re <= 1.65e+77): tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) else: tmp = (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5)))))) + (im * (im * (-0.5 * (1.0 + (re * (1.0 + (re * 0.5))))))) return tmp
function code(re, im) t_0 = Float64(re * Float64(re * re)) tmp = 0.0 if (re <= -380.0) tmp = Float64(Float64(im * im) * Float64(Float64(re * re) * Float64(Float64(0.5 / Float64(-re)) - 0.25))); elseif ((re <= 310.0) || !(re <= 1.65e+77)) tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))); else tmp = Float64(Float64(1.0 + Float64(Float64(t_0 + Float64(0.125 * Float64(Float64(re * re) * Float64(re * t_0)))) / Float64(Float64(re * re) + Float64(Float64(re * re) * Float64(Float64(re * Float64(re * 0.25)) - Float64(re * 0.5)))))) + Float64(im * Float64(im * Float64(-0.5 * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))))))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * re); tmp = 0.0; if (re <= -380.0) tmp = (im * im) * ((re * re) * ((0.5 / -re) - 0.25)); elseif ((re <= 310.0) || ~((re <= 1.65e+77))) tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); else tmp = (1.0 + ((t_0 + (0.125 * ((re * re) * (re * t_0)))) / ((re * re) + ((re * re) * ((re * (re * 0.25)) - (re * 0.5)))))) + (im * (im * (-0.5 * (1.0 + (re * (1.0 + (re * 0.5))))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -380.0], N[(N[(im * im), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(N[(0.5 / (-re)), $MachinePrecision] - 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 310.0], N[Not[LessEqual[re, 1.65e+77]], $MachinePrecision]], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(t$95$0 + N[(0.125 * N[(N[(re * re), $MachinePrecision] * N[(re * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(re * re), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(N[(re * N[(re * 0.25), $MachinePrecision]), $MachinePrecision] - N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(im * N[(im * N[(-0.5 * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot re\right)\\
\mathbf{if}\;re \leq -380:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(\left(re \cdot re\right) \cdot \left(\frac{0.5}{-re} - 0.25\right)\right)\\
\mathbf{elif}\;re \leq 310 \lor \neg \left(re \leq 1.65 \cdot 10^{+77}\right):\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{t\_0 + 0.125 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot t\_0\right)\right)}{re \cdot re + \left(re \cdot re\right) \cdot \left(re \cdot \left(re \cdot 0.25\right) - re \cdot 0.5\right)}\right) + im \cdot \left(im \cdot \left(-0.5 \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\right)\right)\\
\end{array}
\end{array}
if re < -380Initial program 100.0%
Taylor expanded in re around 0 1.9%
*-rgt-identity1.9%
distribute-rgt-in1.9%
*-commutative1.9%
associate-*l*1.9%
*-commutative1.9%
associate-*l*1.9%
distribute-lft-out1.9%
distribute-lft-out1.9%
*-commutative1.9%
distribute-rgt1-in1.9%
+-commutative1.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in im around 0 0.9%
+-commutative0.9%
distribute-rgt-in0.9%
*-commutative0.9%
distribute-rgt-in0.9%
associate-+l+0.9%
Simplified0.9%
Taylor expanded in re around inf 0.9%
unpow20.9%
*-commutative0.9%
Simplified0.9%
Taylor expanded in im around inf 10.1%
mul-1-neg10.1%
distribute-rgt-neg-in10.1%
unpow210.1%
*-commutative10.1%
distribute-rgt-neg-in10.1%
+-commutative10.1%
associate-*r/10.1%
metadata-eval10.1%
mul-1-neg10.1%
unpow210.1%
Simplified10.1%
if -380 < re < 310 or 1.6499999999999999e77 < re Initial program 100.0%
Taylor expanded in re around 0 97.8%
distribute-rgt-in97.8%
*-commutative97.8%
associate-+r+97.8%
distribute-rgt1-in97.8%
*-commutative97.8%
*-commutative97.8%
associate-*l*97.8%
+-commutative97.8%
associate-*r*97.8%
distribute-rgt-out97.8%
associate-*l*97.8%
distribute-lft-out97.8%
Simplified97.8%
Taylor expanded in im around 0 56.4%
*-rgt-identity56.4%
unpow256.4%
+-commutative56.4%
*-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
+-commutative56.4%
distribute-lft-in56.4%
Simplified56.4%
if 310 < re < 1.6499999999999999e77Initial program 100.0%
Taylor expanded in re around 0 4.0%
*-rgt-identity4.0%
distribute-rgt-in4.0%
*-commutative4.0%
associate-*l*4.0%
*-commutative4.0%
associate-*l*4.0%
distribute-lft-out4.0%
distribute-lft-out4.0%
*-commutative4.0%
distribute-rgt1-in4.0%
+-commutative4.0%
*-commutative4.0%
Simplified4.0%
Taylor expanded in im around 0 16.3%
+-commutative16.3%
distribute-rgt-in16.3%
*-commutative16.3%
distribute-rgt-in16.3%
associate-+l+16.3%
Simplified16.3%
distribute-rgt-in16.3%
*-un-lft-identity16.3%
flip3-+38.1%
cube-mult38.1%
*-commutative38.1%
*-commutative38.1%
*-commutative38.1%
*-commutative38.1%
Applied egg-rr38.1%
+-commutative38.1%
associate-*r*38.1%
unpow238.1%
*-commutative38.1%
cube-prod38.1%
metadata-eval38.1%
cube-unmult38.1%
unpow238.1%
unpow238.1%
associate-*l*38.1%
unpow238.1%
Simplified38.1%
Final simplification42.6%
(FPCore (re im)
:precision binary64
(if (<= re 305.0)
1.0
(if (<= re 1.18e+157)
(* re (+ 1.0 (* -0.5 (* im im))))
(+ 1.0 (* re (+ 1.0 (* re 0.5)))))))
double code(double re, double im) {
double tmp;
if (re <= 305.0) {
tmp = 1.0;
} else if (re <= 1.18e+157) {
tmp = re * (1.0 + (-0.5 * (im * im)));
} else {
tmp = 1.0 + (re * (1.0 + (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 <= 305.0d0) then
tmp = 1.0d0
else if (re <= 1.18d+157) then
tmp = re * (1.0d0 + ((-0.5d0) * (im * im)))
else
tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 305.0) {
tmp = 1.0;
} else if (re <= 1.18e+157) {
tmp = re * (1.0 + (-0.5 * (im * im)));
} else {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 305.0: tmp = 1.0 elif re <= 1.18e+157: tmp = re * (1.0 + (-0.5 * (im * im))) else: tmp = 1.0 + (re * (1.0 + (re * 0.5))) return tmp
function code(re, im) tmp = 0.0 if (re <= 305.0) tmp = 1.0; elseif (re <= 1.18e+157) tmp = Float64(re * Float64(1.0 + Float64(-0.5 * Float64(im * im)))); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 305.0) tmp = 1.0; elseif (re <= 1.18e+157) tmp = re * (1.0 + (-0.5 * (im * im))); else tmp = 1.0 + (re * (1.0 + (re * 0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 305.0], 1.0, If[LessEqual[re, 1.18e+157], N[(re * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 305:\\
\;\;\;\;1\\
\mathbf{elif}\;re \leq 1.18 \cdot 10^{+157}:\\
\;\;\;\;re \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 305Initial program 100.0%
Taylor expanded in re around 0 63.7%
*-rgt-identity63.7%
distribute-rgt-in63.7%
*-commutative63.7%
associate-*l*63.7%
*-commutative63.7%
associate-*l*63.7%
distribute-lft-out63.7%
distribute-lft-out63.7%
*-commutative63.7%
distribute-rgt1-in63.7%
+-commutative63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in im around 0 30.5%
+-commutative30.5%
distribute-rgt-in30.5%
*-commutative30.5%
distribute-rgt-in30.5%
associate-+l+30.5%
Simplified30.5%
Taylor expanded in re around inf 30.5%
unpow230.5%
*-commutative30.5%
Simplified30.5%
Taylor expanded in re around 0 34.0%
if 305 < re < 1.1799999999999999e157Initial program 100.0%
Taylor expanded in re around 0 3.8%
distribute-rgt1-in3.8%
*-commutative3.8%
Simplified3.8%
Taylor expanded in re around inf 3.8%
*-commutative3.8%
Simplified3.8%
Taylor expanded in im around 0 18.5%
*-lft-identity18.5%
associate-*r*18.5%
distribute-rgt-in18.5%
unpow218.5%
Simplified18.5%
if 1.1799999999999999e157 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-rgt-identity100.0%
distribute-rgt-in100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
distribute-lft-out100.0%
*-commutative100.0%
distribute-rgt1-in100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around 0 71.9%
distribute-rgt-in71.9%
*-commutative71.9%
distribute-rgt-in71.9%
Simplified71.9%
(FPCore (re im) :precision binary64 (if (<= re 260.0) 1.0 (* (* re re) (+ 0.5 (* (* im im) -0.25)))))
double code(double re, double im) {
double tmp;
if (re <= 260.0) {
tmp = 1.0;
} else {
tmp = (re * re) * (0.5 + ((im * im) * -0.25));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 260.0d0) then
tmp = 1.0d0
else
tmp = (re * re) * (0.5d0 + ((im * im) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 260.0) {
tmp = 1.0;
} else {
tmp = (re * re) * (0.5 + ((im * im) * -0.25));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 260.0: tmp = 1.0 else: tmp = (re * re) * (0.5 + ((im * im) * -0.25)) return tmp
function code(re, im) tmp = 0.0 if (re <= 260.0) tmp = 1.0; else tmp = Float64(Float64(re * re) * Float64(0.5 + Float64(Float64(im * im) * -0.25))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 260.0) tmp = 1.0; else tmp = (re * re) * (0.5 + ((im * im) * -0.25)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 260.0], 1.0, N[(N[(re * re), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 260:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if re < 260Initial program 100.0%
Taylor expanded in re around 0 63.7%
*-rgt-identity63.7%
distribute-rgt-in63.7%
*-commutative63.7%
associate-*l*63.7%
*-commutative63.7%
associate-*l*63.7%
distribute-lft-out63.7%
distribute-lft-out63.7%
*-commutative63.7%
distribute-rgt1-in63.7%
+-commutative63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in im around 0 30.5%
+-commutative30.5%
distribute-rgt-in30.5%
*-commutative30.5%
distribute-rgt-in30.5%
associate-+l+30.5%
Simplified30.5%
Taylor expanded in re around inf 30.5%
unpow230.5%
*-commutative30.5%
Simplified30.5%
Taylor expanded in re around 0 34.0%
if 260 < re Initial program 100.0%
Taylor expanded in re around 0 51.8%
*-rgt-identity51.8%
distribute-rgt-in51.8%
*-commutative51.8%
associate-*l*51.8%
*-commutative51.8%
associate-*l*51.8%
distribute-lft-out51.8%
distribute-lft-out51.8%
*-commutative51.8%
distribute-rgt1-in51.8%
+-commutative51.8%
*-commutative51.8%
Simplified51.8%
Taylor expanded in im around 0 7.3%
+-commutative7.3%
distribute-rgt-in7.3%
*-commutative7.3%
distribute-rgt-in7.3%
associate-+l+7.3%
Simplified7.3%
Taylor expanded in re around inf 43.5%
*-commutative43.5%
*-commutative43.5%
unpow243.5%
unpow243.5%
Simplified43.5%
Final simplification36.6%
(FPCore (re im) :precision binary64 (if (<= re 31.5) 1.0 (* re (+ 1.0 (* -0.5 (* im im))))))
double code(double re, double im) {
double tmp;
if (re <= 31.5) {
tmp = 1.0;
} else {
tmp = re * (1.0 + (-0.5 * (im * im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 31.5d0) then
tmp = 1.0d0
else
tmp = re * (1.0d0 + ((-0.5d0) * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 31.5) {
tmp = 1.0;
} else {
tmp = re * (1.0 + (-0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 31.5: tmp = 1.0 else: tmp = re * (1.0 + (-0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (re <= 31.5) tmp = 1.0; else tmp = Float64(re * Float64(1.0 + Float64(-0.5 * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 31.5) tmp = 1.0; else tmp = re * (1.0 + (-0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 31.5], 1.0, N[(re * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 31.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if re < 31.5Initial program 100.0%
Taylor expanded in re around 0 63.7%
*-rgt-identity63.7%
distribute-rgt-in63.7%
*-commutative63.7%
associate-*l*63.7%
*-commutative63.7%
associate-*l*63.7%
distribute-lft-out63.7%
distribute-lft-out63.7%
*-commutative63.7%
distribute-rgt1-in63.7%
+-commutative63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in im around 0 30.5%
+-commutative30.5%
distribute-rgt-in30.5%
*-commutative30.5%
distribute-rgt-in30.5%
associate-+l+30.5%
Simplified30.5%
Taylor expanded in re around inf 30.5%
unpow230.5%
*-commutative30.5%
Simplified30.5%
Taylor expanded in re around 0 34.0%
if 31.5 < re Initial program 100.0%
Taylor expanded in re around 0 5.4%
distribute-rgt1-in5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in re around inf 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in im around 0 24.5%
*-lft-identity24.5%
associate-*r*24.5%
distribute-rgt-in24.5%
unpow224.5%
Simplified24.5%
(FPCore (re im) :precision binary64 (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))
double code(double re, double im) {
return 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
end function
public static double code(double re, double im) {
return 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
def code(re, im): return 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))
function code(re, im) return Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))) end
function tmp = code(re, im) tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); end
code[re_, im_] := N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 64.3%
distribute-rgt-in64.3%
*-commutative64.3%
associate-+r+64.3%
distribute-rgt1-in64.3%
*-commutative64.3%
*-commutative64.3%
associate-*l*64.3%
+-commutative64.3%
associate-*r*64.3%
distribute-rgt-out64.3%
associate-*l*64.3%
distribute-lft-out64.3%
Simplified64.3%
Taylor expanded in im around 0 37.4%
*-rgt-identity37.4%
unpow237.4%
+-commutative37.4%
*-commutative37.4%
associate-*l*37.4%
*-commutative37.4%
+-commutative37.4%
distribute-lft-in37.4%
Simplified37.4%
Final simplification37.4%
(FPCore (re im) :precision binary64 (if (<= re 75.0) 1.0 (+ 1.0 (* -0.5 (* im im)))))
double code(double re, double im) {
double tmp;
if (re <= 75.0) {
tmp = 1.0;
} else {
tmp = 1.0 + (-0.5 * (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 75.0d0) then
tmp = 1.0d0
else
tmp = 1.0d0 + ((-0.5d0) * (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 75.0) {
tmp = 1.0;
} else {
tmp = 1.0 + (-0.5 * (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 75.0: tmp = 1.0 else: tmp = 1.0 + (-0.5 * (im * im)) return tmp
function code(re, im) tmp = 0.0 if (re <= 75.0) tmp = 1.0; else tmp = Float64(1.0 + Float64(-0.5 * Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 75.0) tmp = 1.0; else tmp = 1.0 + (-0.5 * (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 75.0], 1.0, N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 75:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if re < 75Initial program 100.0%
Taylor expanded in re around 0 63.7%
*-rgt-identity63.7%
distribute-rgt-in63.7%
*-commutative63.7%
associate-*l*63.7%
*-commutative63.7%
associate-*l*63.7%
distribute-lft-out63.7%
distribute-lft-out63.7%
*-commutative63.7%
distribute-rgt1-in63.7%
+-commutative63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in im around 0 30.5%
+-commutative30.5%
distribute-rgt-in30.5%
*-commutative30.5%
distribute-rgt-in30.5%
associate-+l+30.5%
Simplified30.5%
Taylor expanded in re around inf 30.5%
unpow230.5%
*-commutative30.5%
Simplified30.5%
Taylor expanded in re around 0 34.0%
if 75 < re Initial program 100.0%
Taylor expanded in re around 0 51.8%
*-rgt-identity51.8%
distribute-rgt-in51.8%
*-commutative51.8%
associate-*l*51.8%
*-commutative51.8%
associate-*l*51.8%
distribute-lft-out51.8%
distribute-lft-out51.8%
*-commutative51.8%
distribute-rgt1-in51.8%
+-commutative51.8%
*-commutative51.8%
Simplified51.8%
Taylor expanded in im around 0 7.3%
+-commutative7.3%
distribute-rgt-in7.3%
*-commutative7.3%
distribute-rgt-in7.3%
associate-+l+7.3%
Simplified7.3%
Taylor expanded in re around 0 18.0%
unpow218.0%
Simplified18.0%
(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 48.0%
distribute-rgt1-in48.0%
*-commutative48.0%
Simplified48.0%
Taylor expanded in im around 0 25.7%
+-commutative25.7%
Simplified25.7%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 60.5%
*-rgt-identity60.5%
distribute-rgt-in60.5%
*-commutative60.5%
associate-*l*60.5%
*-commutative60.5%
associate-*l*60.5%
distribute-lft-out60.5%
distribute-lft-out60.5%
*-commutative60.5%
distribute-rgt1-in60.5%
+-commutative60.5%
*-commutative60.5%
Simplified60.5%
Taylor expanded in im around 0 24.2%
+-commutative24.2%
distribute-rgt-in24.2%
*-commutative24.2%
distribute-rgt-in24.2%
associate-+l+24.2%
Simplified24.2%
Taylor expanded in re around inf 24.3%
unpow224.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in re around 0 25.5%
herbie shell --seed 2024107
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))