
(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 15 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 (let* ((t_0 (<= (exp re) 1.0))) (if t_0 (exp re) (if t_0 (cos im) (exp re)))))
double code(double re, double im) {
int t_0 = exp(re) <= 1.0;
double tmp;
if (t_0) {
tmp = exp(re);
} else if (t_0) {
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
logical :: t_0
real(8) :: tmp
t_0 = exp(re) <= 1.0d0
if (t_0) then
tmp = exp(re)
else if (t_0) then
tmp = cos(im)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
boolean t_0 = Math.exp(re) <= 1.0;
double tmp;
if (t_0) {
tmp = Math.exp(re);
} else if (t_0) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) <= 1.0 tmp = 0 if t_0: tmp = math.exp(re) elif t_0: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) t_0 = exp(re) <= 1.0 tmp = 0.0 if (t_0) tmp = exp(re); elseif (t_0) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) <= 1.0; tmp = 0.0; if (t_0) tmp = exp(re); elseif (t_0) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = LessEqual[N[Exp[re], $MachinePrecision], 1.0]}, If[t$95$0, N[Exp[re], $MachinePrecision], If[t$95$0, N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \leq 1\\
\mathbf{if}\;t_0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;t_0:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 1 or 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 71.4%
if 1 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0 47.0%
Final simplification71.4%
(FPCore (re im)
:precision binary64
(if (or (<= re -0.044) (and (not (<= re 0.075)) (<= re 2.7e+99)))
(exp re)
(*
(cos im)
(+ (* (* re re) (+ 0.5 (* re 0.16666666666666666))) (+ re 1.0)))))
double code(double re, double im) {
double tmp;
if ((re <= -0.044) || (!(re <= 0.075) && (re <= 2.7e+99))) {
tmp = exp(re);
} else {
tmp = cos(im) * (((re * re) * (0.5 + (re * 0.16666666666666666))) + (re + 1.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= (-0.044d0)) .or. (.not. (re <= 0.075d0)) .and. (re <= 2.7d+99)) then
tmp = exp(re)
else
tmp = cos(im) * (((re * re) * (0.5d0 + (re * 0.16666666666666666d0))) + (re + 1.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -0.044) || (!(re <= 0.075) && (re <= 2.7e+99))) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (((re * re) * (0.5 + (re * 0.16666666666666666))) + (re + 1.0));
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.044) or (not (re <= 0.075) and (re <= 2.7e+99)): tmp = math.exp(re) else: tmp = math.cos(im) * (((re * re) * (0.5 + (re * 0.16666666666666666))) + (re + 1.0)) return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.044) || (!(re <= 0.075) && (re <= 2.7e+99))) tmp = exp(re); else tmp = Float64(cos(im) * Float64(Float64(Float64(re * re) * Float64(0.5 + Float64(re * 0.16666666666666666))) + Float64(re + 1.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -0.044) || (~((re <= 0.075)) && (re <= 2.7e+99))) tmp = exp(re); else tmp = cos(im) * (((re * re) * (0.5 + (re * 0.16666666666666666))) + (re + 1.0)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.044], And[N[Not[LessEqual[re, 0.075]], $MachinePrecision], LessEqual[re, 2.7e+99]]], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.044 \lor \neg \left(re \leq 0.075\right) \land re \leq 2.7 \cdot 10^{+99}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(\left(re \cdot re\right) \cdot \left(0.5 + re \cdot 0.16666666666666666\right) + \left(re + 1\right)\right)\\
\end{array}
\end{array}
if re < -0.043999999999999997 or 0.0749999999999999972 < re < 2.69999999999999989e99Initial program 100.0%
Taylor expanded in im around 0 95.8%
if -0.043999999999999997 < re < 0.0749999999999999972 or 2.69999999999999989e99 < re Initial program 100.0%
Taylor expanded in re around 0 99.0%
associate-+r+99.0%
*-commutative99.0%
associate-*r*99.0%
*-commutative99.0%
associate-*r*99.0%
distribute-rgt-out99.0%
*-commutative99.0%
*-commutative99.0%
distribute-lft1-in99.0%
distribute-rgt-out99.0%
+-commutative99.0%
cube-mult99.0%
unpow299.0%
associate-*r*99.0%
Simplified99.0%
Final simplification97.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5))))
(if (<= re -0.043)
(exp re)
(if (<= re 0.015)
(* (cos im) (+ t_0 (+ re 1.0)))
(if (<= re 8.8e+138) (exp re) (* (cos im) t_0))))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double tmp;
if (re <= -0.043) {
tmp = exp(re);
} else if (re <= 0.015) {
tmp = cos(im) * (t_0 + (re + 1.0));
} else if (re <= 8.8e+138) {
tmp = exp(re);
} else {
tmp = cos(im) * t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = re * (re * 0.5d0)
if (re <= (-0.043d0)) then
tmp = exp(re)
else if (re <= 0.015d0) then
tmp = cos(im) * (t_0 + (re + 1.0d0))
else if (re <= 8.8d+138) then
tmp = exp(re)
else
tmp = cos(im) * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * 0.5);
double tmp;
if (re <= -0.043) {
tmp = Math.exp(re);
} else if (re <= 0.015) {
tmp = Math.cos(im) * (t_0 + (re + 1.0));
} else if (re <= 8.8e+138) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) tmp = 0 if re <= -0.043: tmp = math.exp(re) elif re <= 0.015: tmp = math.cos(im) * (t_0 + (re + 1.0)) elif re <= 8.8e+138: tmp = math.exp(re) else: tmp = math.cos(im) * t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) tmp = 0.0 if (re <= -0.043) tmp = exp(re); elseif (re <= 0.015) tmp = Float64(cos(im) * Float64(t_0 + Float64(re + 1.0))); elseif (re <= 8.8e+138) tmp = exp(re); else tmp = Float64(cos(im) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); tmp = 0.0; if (re <= -0.043) tmp = exp(re); elseif (re <= 0.015) tmp = cos(im) * (t_0 + (re + 1.0)); elseif (re <= 8.8e+138) tmp = exp(re); else tmp = cos(im) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.043], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.015], N[(N[Cos[im], $MachinePrecision] * N[(t$95$0 + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 8.8e+138], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
\mathbf{if}\;re \leq -0.043:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.015:\\
\;\;\;\;\cos im \cdot \left(t_0 + \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 8.8 \cdot 10^{+138}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot t_0\\
\end{array}
\end{array}
if re < -0.042999999999999997 or 0.014999999999999999 < re < 8.8000000000000003e138Initial program 100.0%
Taylor expanded in im around 0 92.4%
if -0.042999999999999997 < re < 0.014999999999999999Initial program 100.0%
Taylor expanded in re around 0 99.0%
*-commutative99.0%
associate-*r*99.0%
*-commutative99.0%
distribute-lft1-in99.0%
distribute-rgt-out99.0%
+-commutative99.0%
*-commutative99.0%
unpow299.0%
associate-*l*99.0%
Simplified99.0%
if 8.8000000000000003e138 < re Initial program 100.0%
Taylor expanded in re around 0 97.0%
*-commutative97.0%
associate-*r*97.0%
*-commutative97.0%
distribute-lft1-in97.0%
distribute-rgt-out97.0%
+-commutative97.0%
*-commutative97.0%
unpow297.0%
associate-*l*97.0%
Simplified97.0%
Taylor expanded in re around inf 97.0%
*-commutative97.0%
unpow297.0%
associate-*r*97.0%
associate-*r*97.0%
Simplified97.0%
Final simplification96.0%
(FPCore (re im)
:precision binary64
(if (<= re -0.00255)
(exp re)
(if (<= re 8.7e-16)
(* (cos im) (+ re 1.0))
(if (<= re 8.8e+138) (exp re) (* (cos im) (* re (* re 0.5)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.00255) {
tmp = exp(re);
} else if (re <= 8.7e-16) {
tmp = cos(im) * (re + 1.0);
} else if (re <= 8.8e+138) {
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.00255d0)) then
tmp = exp(re)
else if (re <= 8.7d-16) then
tmp = cos(im) * (re + 1.0d0)
else if (re <= 8.8d+138) 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.00255) {
tmp = Math.exp(re);
} else if (re <= 8.7e-16) {
tmp = Math.cos(im) * (re + 1.0);
} else if (re <= 8.8e+138) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.00255: tmp = math.exp(re) elif re <= 8.7e-16: tmp = math.cos(im) * (re + 1.0) elif re <= 8.8e+138: 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.00255) tmp = exp(re); elseif (re <= 8.7e-16) tmp = Float64(cos(im) * Float64(re + 1.0)); elseif (re <= 8.8e+138) 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.00255) tmp = exp(re); elseif (re <= 8.7e-16) tmp = cos(im) * (re + 1.0); elseif (re <= 8.8e+138) tmp = exp(re); else tmp = cos(im) * (re * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.00255], N[Exp[re], $MachinePrecision], If[LessEqual[re, 8.7e-16], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 8.8e+138], 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.00255:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 8.7 \cdot 10^{-16}:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 8.8 \cdot 10^{+138}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.0025500000000000002 or 8.70000000000000036e-16 < re < 8.8000000000000003e138Initial program 100.0%
Taylor expanded in im around 0 91.7%
if -0.0025500000000000002 < re < 8.70000000000000036e-16Initial program 100.0%
Taylor expanded in re around 0 99.2%
*-rgt-identity99.2%
distribute-lft-in99.2%
Simplified99.2%
if 8.8000000000000003e138 < re Initial program 100.0%
Taylor expanded in re around 0 97.0%
*-commutative97.0%
associate-*r*97.0%
*-commutative97.0%
distribute-lft1-in97.0%
distribute-rgt-out97.0%
+-commutative97.0%
*-commutative97.0%
unpow297.0%
associate-*l*97.0%
Simplified97.0%
Taylor expanded in re around inf 97.0%
*-commutative97.0%
unpow297.0%
associate-*r*97.0%
associate-*r*97.0%
Simplified97.0%
Final simplification95.7%
(FPCore (re im) :precision binary64 (if (<= re -0.00092) (exp re) (if (<= re 8.7e-16) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -0.00092) {
tmp = exp(re);
} else if (re <= 8.7e-16) {
tmp = cos(im) * (re + 1.0);
} else {
tmp = exp(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-0.00092d0)) then
tmp = exp(re)
else if (re <= 8.7d-16) then
tmp = cos(im) * (re + 1.0d0)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.00092) {
tmp = Math.exp(re);
} else if (re <= 8.7e-16) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.00092: tmp = math.exp(re) elif re <= 8.7e-16: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.00092) tmp = exp(re); elseif (re <= 8.7e-16) tmp = Float64(cos(im) * Float64(re + 1.0)); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.00092) tmp = exp(re); elseif (re <= 8.7e-16) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.00092], N[Exp[re], $MachinePrecision], If[LessEqual[re, 8.7e-16], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.00092:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 8.7 \cdot 10^{-16}:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -9.2000000000000003e-4 or 8.70000000000000036e-16 < re Initial program 100.0%
Taylor expanded in im around 0 87.1%
if -9.2000000000000003e-4 < re < 8.70000000000000036e-16Initial program 100.0%
Taylor expanded in re around 0 99.2%
*-rgt-identity99.2%
distribute-lft-in99.2%
Simplified99.2%
Final simplification92.6%
(FPCore (re im)
:precision binary64
(if (<= re -8500000000000.0)
(* -0.5 (* im im))
(if (<= re 1.35e+23)
(cos im)
(if (<= re 1.35e+154)
(+ 1.0 (+ re (* -0.5 (/ (* (* im im) (- 1.0 (* re re))) (- 1.0 re)))))
(* (* re re) 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= -8500000000000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 1.35e+23) {
tmp = cos(im);
} else if (re <= 1.35e+154) {
tmp = 1.0 + (re + (-0.5 * (((im * im) * (1.0 - (re * re))) / (1.0 - re))));
} 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 <= (-8500000000000.0d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 1.35d+23) then
tmp = cos(im)
else if (re <= 1.35d+154) then
tmp = 1.0d0 + (re + ((-0.5d0) * (((im * im) * (1.0d0 - (re * re))) / (1.0d0 - re))))
else
tmp = (re * re) * 0.5d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -8500000000000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 1.35e+23) {
tmp = Math.cos(im);
} else if (re <= 1.35e+154) {
tmp = 1.0 + (re + (-0.5 * (((im * im) * (1.0 - (re * re))) / (1.0 - re))));
} else {
tmp = (re * re) * 0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -8500000000000.0: tmp = -0.5 * (im * im) elif re <= 1.35e+23: tmp = math.cos(im) elif re <= 1.35e+154: tmp = 1.0 + (re + (-0.5 * (((im * im) * (1.0 - (re * re))) / (1.0 - re)))) else: tmp = (re * re) * 0.5 return tmp
function code(re, im) tmp = 0.0 if (re <= -8500000000000.0) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 1.35e+23) tmp = cos(im); elseif (re <= 1.35e+154) tmp = Float64(1.0 + Float64(re + Float64(-0.5 * Float64(Float64(Float64(im * im) * Float64(1.0 - Float64(re * re))) / Float64(1.0 - re))))); else tmp = Float64(Float64(re * re) * 0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -8500000000000.0) tmp = -0.5 * (im * im); elseif (re <= 1.35e+23) tmp = cos(im); elseif (re <= 1.35e+154) tmp = 1.0 + (re + (-0.5 * (((im * im) * (1.0 - (re * re))) / (1.0 - re)))); else tmp = (re * re) * 0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -8500000000000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.35e+23], N[Cos[im], $MachinePrecision], If[LessEqual[re, 1.35e+154], N[(1.0 + N[(re + N[(-0.5 * N[(N[(N[(im * im), $MachinePrecision] * N[(1.0 - N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -8500000000000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 1.35 \cdot 10^{+23}:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;1 + \left(re + -0.5 \cdot \frac{\left(im \cdot im\right) \cdot \left(1 - re \cdot re\right)}{1 - re}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.5\\
\end{array}
\end{array}
if re < -8.5e12Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-in2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
+-commutative2.0%
*-commutative2.0%
unpow22.0%
+-commutative2.0%
Simplified2.0%
Taylor expanded in re around 0 2.0%
unpow22.0%
Simplified2.0%
Taylor expanded in im around inf 37.0%
unpow237.0%
Simplified37.0%
if -8.5e12 < re < 1.3499999999999999e23Initial program 100.0%
Taylor expanded in re around 0 88.9%
if 1.3499999999999999e23 < re < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in re around 0 3.9%
*-rgt-identity3.9%
distribute-lft-in3.9%
Simplified3.9%
Taylor expanded in im around 0 25.3%
+-commutative25.3%
*-commutative25.3%
unpow225.3%
+-commutative25.3%
Simplified25.3%
*-commutative25.3%
flip-+25.3%
associate-*l/29.6%
metadata-eval29.6%
Applied egg-rr29.6%
if 1.35000000000000003e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*r*100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in im around 0 73.3%
*-commutative73.3%
unpow273.3%
Simplified73.3%
Final simplification67.2%
(FPCore (re im)
:precision binary64
(if (<= re -8500000000000.0)
(* -0.5 (* im im))
(if (<= re 1.7e+23)
(+ (* re (* re 0.5)) (+ re 1.0))
(if (<= re 1.35e+154)
(+ 1.0 (+ re (* -0.5 (/ (* (* im im) (- 1.0 (* re re))) (- 1.0 re)))))
(* (* re re) 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= -8500000000000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 1.7e+23) {
tmp = (re * (re * 0.5)) + (re + 1.0);
} else if (re <= 1.35e+154) {
tmp = 1.0 + (re + (-0.5 * (((im * im) * (1.0 - (re * re))) / (1.0 - re))));
} 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 <= (-8500000000000.0d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 1.7d+23) then
tmp = (re * (re * 0.5d0)) + (re + 1.0d0)
else if (re <= 1.35d+154) then
tmp = 1.0d0 + (re + ((-0.5d0) * (((im * im) * (1.0d0 - (re * re))) / (1.0d0 - re))))
else
tmp = (re * re) * 0.5d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -8500000000000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 1.7e+23) {
tmp = (re * (re * 0.5)) + (re + 1.0);
} else if (re <= 1.35e+154) {
tmp = 1.0 + (re + (-0.5 * (((im * im) * (1.0 - (re * re))) / (1.0 - re))));
} else {
tmp = (re * re) * 0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -8500000000000.0: tmp = -0.5 * (im * im) elif re <= 1.7e+23: tmp = (re * (re * 0.5)) + (re + 1.0) elif re <= 1.35e+154: tmp = 1.0 + (re + (-0.5 * (((im * im) * (1.0 - (re * re))) / (1.0 - re)))) else: tmp = (re * re) * 0.5 return tmp
function code(re, im) tmp = 0.0 if (re <= -8500000000000.0) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 1.7e+23) tmp = Float64(Float64(re * Float64(re * 0.5)) + Float64(re + 1.0)); elseif (re <= 1.35e+154) tmp = Float64(1.0 + Float64(re + Float64(-0.5 * Float64(Float64(Float64(im * im) * Float64(1.0 - Float64(re * re))) / Float64(1.0 - re))))); else tmp = Float64(Float64(re * re) * 0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -8500000000000.0) tmp = -0.5 * (im * im); elseif (re <= 1.7e+23) tmp = (re * (re * 0.5)) + (re + 1.0); elseif (re <= 1.35e+154) tmp = 1.0 + (re + (-0.5 * (((im * im) * (1.0 - (re * re))) / (1.0 - re)))); else tmp = (re * re) * 0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -8500000000000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.7e+23], N[(N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.35e+154], N[(1.0 + N[(re + N[(-0.5 * N[(N[(N[(im * im), $MachinePrecision] * N[(1.0 - N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -8500000000000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 1.7 \cdot 10^{+23}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right) + \left(re + 1\right)\\
\mathbf{elif}\;re \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;1 + \left(re + -0.5 \cdot \frac{\left(im \cdot im\right) \cdot \left(1 - re \cdot re\right)}{1 - re}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.5\\
\end{array}
\end{array}
if re < -8.5e12Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-in2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
+-commutative2.0%
*-commutative2.0%
unpow22.0%
+-commutative2.0%
Simplified2.0%
Taylor expanded in re around 0 2.0%
unpow22.0%
Simplified2.0%
Taylor expanded in im around inf 37.0%
unpow237.0%
Simplified37.0%
if -8.5e12 < re < 1.69999999999999996e23Initial program 100.0%
Taylor expanded in re around 0 91.0%
*-commutative91.0%
associate-*r*91.0%
*-commutative91.0%
distribute-lft1-in91.0%
distribute-rgt-out91.0%
+-commutative91.0%
*-commutative91.0%
unpow291.0%
associate-*l*91.0%
Simplified91.0%
Taylor expanded in im around 0 48.8%
fma-def48.8%
unpow248.8%
Simplified48.8%
fma-udef48.8%
*-commutative48.8%
associate-*r*48.8%
+-commutative48.8%
+-commutative48.8%
Applied egg-rr48.8%
if 1.69999999999999996e23 < re < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in re around 0 3.9%
*-rgt-identity3.9%
distribute-lft-in3.9%
Simplified3.9%
Taylor expanded in im around 0 25.3%
+-commutative25.3%
*-commutative25.3%
unpow225.3%
+-commutative25.3%
Simplified25.3%
*-commutative25.3%
flip-+25.3%
associate-*l/29.6%
metadata-eval29.6%
Applied egg-rr29.6%
if 1.35000000000000003e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*r*100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in im around 0 73.3%
*-commutative73.3%
unpow273.3%
Simplified73.3%
Final simplification46.6%
(FPCore (re im)
:precision binary64
(if (<= re -8500000000000.0)
(* -0.5 (* im im))
(if (<= re 1.35e+23)
(+ (* re (* re 0.5)) (+ re 1.0))
(if (<= re 1.12e+154)
(+ 1.0 (+ re (* -0.5 (* im (* re im)))))
(* (* re re) 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= -8500000000000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 1.35e+23) {
tmp = (re * (re * 0.5)) + (re + 1.0);
} else if (re <= 1.12e+154) {
tmp = 1.0 + (re + (-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 <= (-8500000000000.0d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 1.35d+23) then
tmp = (re * (re * 0.5d0)) + (re + 1.0d0)
else if (re <= 1.12d+154) then
tmp = 1.0d0 + (re + ((-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 <= -8500000000000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 1.35e+23) {
tmp = (re * (re * 0.5)) + (re + 1.0);
} else if (re <= 1.12e+154) {
tmp = 1.0 + (re + (-0.5 * (im * (re * im))));
} else {
tmp = (re * re) * 0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -8500000000000.0: tmp = -0.5 * (im * im) elif re <= 1.35e+23: tmp = (re * (re * 0.5)) + (re + 1.0) elif re <= 1.12e+154: tmp = 1.0 + (re + (-0.5 * (im * (re * im)))) else: tmp = (re * re) * 0.5 return tmp
function code(re, im) tmp = 0.0 if (re <= -8500000000000.0) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 1.35e+23) tmp = Float64(Float64(re * Float64(re * 0.5)) + Float64(re + 1.0)); elseif (re <= 1.12e+154) tmp = Float64(1.0 + Float64(re + Float64(-0.5 * Float64(im * Float64(re * im))))); else tmp = Float64(Float64(re * re) * 0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -8500000000000.0) tmp = -0.5 * (im * im); elseif (re <= 1.35e+23) tmp = (re * (re * 0.5)) + (re + 1.0); elseif (re <= 1.12e+154) tmp = 1.0 + (re + (-0.5 * (im * (re * im)))); else tmp = (re * re) * 0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -8500000000000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.35e+23], N[(N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.12e+154], N[(1.0 + N[(re + N[(-0.5 * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -8500000000000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 1.35 \cdot 10^{+23}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right) + \left(re + 1\right)\\
\mathbf{elif}\;re \leq 1.12 \cdot 10^{+154}:\\
\;\;\;\;1 + \left(re + -0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.5\\
\end{array}
\end{array}
if re < -8.5e12Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-in2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
+-commutative2.0%
*-commutative2.0%
unpow22.0%
+-commutative2.0%
Simplified2.0%
Taylor expanded in re around 0 2.0%
unpow22.0%
Simplified2.0%
Taylor expanded in im around inf 37.0%
unpow237.0%
Simplified37.0%
if -8.5e12 < re < 1.3499999999999999e23Initial program 100.0%
Taylor expanded in re around 0 91.0%
*-commutative91.0%
associate-*r*91.0%
*-commutative91.0%
distribute-lft1-in91.0%
distribute-rgt-out91.0%
+-commutative91.0%
*-commutative91.0%
unpow291.0%
associate-*l*91.0%
Simplified91.0%
Taylor expanded in im around 0 48.8%
fma-def48.8%
unpow248.8%
Simplified48.8%
fma-udef48.8%
*-commutative48.8%
associate-*r*48.8%
+-commutative48.8%
+-commutative48.8%
Applied egg-rr48.8%
if 1.3499999999999999e23 < re < 1.11999999999999994e154Initial program 100.0%
Taylor expanded in re around 0 3.9%
*-rgt-identity3.9%
distribute-lft-in3.9%
Simplified3.9%
Taylor expanded in im around 0 25.3%
+-commutative25.3%
*-commutative25.3%
unpow225.3%
+-commutative25.3%
Simplified25.3%
Taylor expanded in re around inf 25.3%
unpow225.3%
*-commutative25.3%
associate-*r*25.3%
Simplified25.3%
if 1.11999999999999994e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*r*100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in im around 0 73.3%
*-commutative73.3%
unpow273.3%
Simplified73.3%
Final simplification46.3%
(FPCore (re im)
:precision binary64
(if (<= re -0.0006)
(* -0.5 (* im im))
(if (<= re 1.42e+23)
(+ re 1.0)
(if (<= re 1.35e+154) (* (* im im) (* re -0.5)) (* (* re re) 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= -0.0006) {
tmp = -0.5 * (im * im);
} else if (re <= 1.42e+23) {
tmp = re + 1.0;
} else if (re <= 1.35e+154) {
tmp = (im * im) * (re * -0.5);
} 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 <= (-0.0006d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 1.42d+23) then
tmp = re + 1.0d0
else if (re <= 1.35d+154) then
tmp = (im * im) * (re * (-0.5d0))
else
tmp = (re * re) * 0.5d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.0006) {
tmp = -0.5 * (im * im);
} else if (re <= 1.42e+23) {
tmp = re + 1.0;
} else if (re <= 1.35e+154) {
tmp = (im * im) * (re * -0.5);
} else {
tmp = (re * re) * 0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0006: tmp = -0.5 * (im * im) elif re <= 1.42e+23: tmp = re + 1.0 elif re <= 1.35e+154: tmp = (im * im) * (re * -0.5) else: tmp = (re * re) * 0.5 return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0006) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 1.42e+23) tmp = Float64(re + 1.0); elseif (re <= 1.35e+154) tmp = Float64(Float64(im * im) * Float64(re * -0.5)); else tmp = Float64(Float64(re * re) * 0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.0006) tmp = -0.5 * (im * im); elseif (re <= 1.42e+23) tmp = re + 1.0; elseif (re <= 1.35e+154) tmp = (im * im) * (re * -0.5); else tmp = (re * re) * 0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0006], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.42e+23], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 1.35e+154], N[(N[(im * im), $MachinePrecision] * N[(re * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0006:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 1.42 \cdot 10^{+23}:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.5\\
\end{array}
\end{array}
if re < -5.99999999999999947e-4Initial program 100.0%
Taylor expanded in re around 0 2.9%
*-rgt-identity2.9%
distribute-lft-in2.9%
Simplified2.9%
Taylor expanded in im around 0 2.0%
+-commutative2.0%
*-commutative2.0%
unpow22.0%
+-commutative2.0%
Simplified2.0%
Taylor expanded in re around 0 2.1%
unpow22.1%
Simplified2.1%
Taylor expanded in im around inf 35.3%
unpow235.3%
Simplified35.3%
if -5.99999999999999947e-4 < re < 1.42000000000000004e23Initial program 100.0%
Taylor expanded in re around 0 92.5%
*-rgt-identity92.5%
distribute-lft-in92.5%
Simplified92.5%
Taylor expanded in im around 0 49.7%
if 1.42000000000000004e23 < re < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in re around 0 3.9%
*-rgt-identity3.9%
distribute-lft-in3.9%
Simplified3.9%
Taylor expanded in im around 0 25.3%
+-commutative25.3%
*-commutative25.3%
unpow225.3%
+-commutative25.3%
Simplified25.3%
Taylor expanded in re around inf 25.3%
unpow225.3%
*-commutative25.3%
associate-*r*25.3%
Simplified25.3%
Taylor expanded in im around inf 24.0%
associate-*r*24.0%
unpow224.0%
Simplified24.0%
if 1.35000000000000003e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*r*100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in im around 0 73.3%
*-commutative73.3%
unpow273.3%
Simplified73.3%
Final simplification45.9%
(FPCore (re im)
:precision binary64
(if (<= re -8500000000000.0)
(* -0.5 (* im im))
(if (<= re 2e+23)
(+ (* re (* re 0.5)) (+ re 1.0))
(if (<= re 5e+153) (* (* im im) (* re -0.5)) (* (* re re) 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= -8500000000000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 2e+23) {
tmp = (re * (re * 0.5)) + (re + 1.0);
} else if (re <= 5e+153) {
tmp = (im * im) * (re * -0.5);
} 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 <= (-8500000000000.0d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 2d+23) then
tmp = (re * (re * 0.5d0)) + (re + 1.0d0)
else if (re <= 5d+153) then
tmp = (im * im) * (re * (-0.5d0))
else
tmp = (re * re) * 0.5d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -8500000000000.0) {
tmp = -0.5 * (im * im);
} else if (re <= 2e+23) {
tmp = (re * (re * 0.5)) + (re + 1.0);
} else if (re <= 5e+153) {
tmp = (im * im) * (re * -0.5);
} else {
tmp = (re * re) * 0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -8500000000000.0: tmp = -0.5 * (im * im) elif re <= 2e+23: tmp = (re * (re * 0.5)) + (re + 1.0) elif re <= 5e+153: tmp = (im * im) * (re * -0.5) else: tmp = (re * re) * 0.5 return tmp
function code(re, im) tmp = 0.0 if (re <= -8500000000000.0) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 2e+23) tmp = Float64(Float64(re * Float64(re * 0.5)) + Float64(re + 1.0)); elseif (re <= 5e+153) tmp = Float64(Float64(im * im) * Float64(re * -0.5)); else tmp = Float64(Float64(re * re) * 0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -8500000000000.0) tmp = -0.5 * (im * im); elseif (re <= 2e+23) tmp = (re * (re * 0.5)) + (re + 1.0); elseif (re <= 5e+153) tmp = (im * im) * (re * -0.5); else tmp = (re * re) * 0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -8500000000000.0], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2e+23], N[(N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5e+153], N[(N[(im * im), $MachinePrecision] * N[(re * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -8500000000000:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 2 \cdot 10^{+23}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right) + \left(re + 1\right)\\
\mathbf{elif}\;re \leq 5 \cdot 10^{+153}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.5\\
\end{array}
\end{array}
if re < -8.5e12Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-in2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
+-commutative2.0%
*-commutative2.0%
unpow22.0%
+-commutative2.0%
Simplified2.0%
Taylor expanded in re around 0 2.0%
unpow22.0%
Simplified2.0%
Taylor expanded in im around inf 37.0%
unpow237.0%
Simplified37.0%
if -8.5e12 < re < 1.9999999999999998e23Initial program 100.0%
Taylor expanded in re around 0 91.0%
*-commutative91.0%
associate-*r*91.0%
*-commutative91.0%
distribute-lft1-in91.0%
distribute-rgt-out91.0%
+-commutative91.0%
*-commutative91.0%
unpow291.0%
associate-*l*91.0%
Simplified91.0%
Taylor expanded in im around 0 48.8%
fma-def48.8%
unpow248.8%
Simplified48.8%
fma-udef48.8%
*-commutative48.8%
associate-*r*48.8%
+-commutative48.8%
+-commutative48.8%
Applied egg-rr48.8%
if 1.9999999999999998e23 < re < 5.00000000000000018e153Initial program 100.0%
Taylor expanded in re around 0 3.9%
*-rgt-identity3.9%
distribute-lft-in3.9%
Simplified3.9%
Taylor expanded in im around 0 25.3%
+-commutative25.3%
*-commutative25.3%
unpow225.3%
+-commutative25.3%
Simplified25.3%
Taylor expanded in re around inf 25.3%
unpow225.3%
*-commutative25.3%
associate-*r*25.3%
Simplified25.3%
Taylor expanded in im around inf 24.0%
associate-*r*24.0%
unpow224.0%
Simplified24.0%
if 5.00000000000000018e153 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*r*100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in im around 0 73.3%
*-commutative73.3%
unpow273.3%
Simplified73.3%
Final simplification46.2%
(FPCore (re im) :precision binary64 (if (or (<= re -0.0006) (not (<= re 1.7e+23))) (* -0.5 (* im im)) (+ re 1.0)))
double code(double re, double im) {
double tmp;
if ((re <= -0.0006) || !(re <= 1.7e+23)) {
tmp = -0.5 * (im * im);
} else {
tmp = re + 1.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= (-0.0006d0)) .or. (.not. (re <= 1.7d+23))) then
tmp = (-0.5d0) * (im * im)
else
tmp = re + 1.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -0.0006) || !(re <= 1.7e+23)) {
tmp = -0.5 * (im * im);
} else {
tmp = re + 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.0006) or not (re <= 1.7e+23): tmp = -0.5 * (im * im) else: tmp = re + 1.0 return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.0006) || !(re <= 1.7e+23)) tmp = Float64(-0.5 * Float64(im * im)); else tmp = Float64(re + 1.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -0.0006) || ~((re <= 1.7e+23))) tmp = -0.5 * (im * im); else tmp = re + 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.0006], N[Not[LessEqual[re, 1.7e+23]], $MachinePrecision]], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], N[(re + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0006 \lor \neg \left(re \leq 1.7 \cdot 10^{+23}\right):\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;re + 1\\
\end{array}
\end{array}
if re < -5.99999999999999947e-4 or 1.69999999999999996e23 < re Initial program 100.0%
Taylor expanded in re around 0 4.1%
*-rgt-identity4.1%
distribute-lft-in4.1%
Simplified4.1%
Taylor expanded in im around 0 11.9%
+-commutative11.9%
*-commutative11.9%
unpow211.9%
+-commutative11.9%
Simplified11.9%
Taylor expanded in re around 0 9.7%
unpow29.7%
Simplified9.7%
Taylor expanded in im around inf 28.5%
unpow228.5%
Simplified28.5%
if -5.99999999999999947e-4 < re < 1.69999999999999996e23Initial program 100.0%
Taylor expanded in re around 0 92.5%
*-rgt-identity92.5%
distribute-lft-in92.5%
Simplified92.5%
Taylor expanded in im around 0 49.7%
Final simplification39.0%
(FPCore (re im) :precision binary64 (if (<= re -0.0006) (* -0.5 (* im im)) (if (<= re 2.1) (+ re 1.0) (* (* re re) 0.5))))
double code(double re, double im) {
double tmp;
if (re <= -0.0006) {
tmp = -0.5 * (im * im);
} else if (re <= 2.1) {
tmp = re + 1.0;
} else {
tmp = (re * re) * 0.5;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-0.0006d0)) then
tmp = (-0.5d0) * (im * im)
else if (re <= 2.1d0) then
tmp = re + 1.0d0
else
tmp = (re * re) * 0.5d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.0006) {
tmp = -0.5 * (im * im);
} else if (re <= 2.1) {
tmp = re + 1.0;
} else {
tmp = (re * re) * 0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0006: tmp = -0.5 * (im * im) elif re <= 2.1: tmp = re + 1.0 else: tmp = (re * re) * 0.5 return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0006) tmp = Float64(-0.5 * Float64(im * im)); elseif (re <= 2.1) tmp = Float64(re + 1.0); else tmp = Float64(Float64(re * re) * 0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.0006) tmp = -0.5 * (im * im); elseif (re <= 2.1) tmp = re + 1.0; else tmp = (re * re) * 0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0006], N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.1], N[(re + 1.0), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0006:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 2.1:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.5\\
\end{array}
\end{array}
if re < -5.99999999999999947e-4Initial program 100.0%
Taylor expanded in re around 0 2.9%
*-rgt-identity2.9%
distribute-lft-in2.9%
Simplified2.9%
Taylor expanded in im around 0 2.0%
+-commutative2.0%
*-commutative2.0%
unpow22.0%
+-commutative2.0%
Simplified2.0%
Taylor expanded in re around 0 2.1%
unpow22.1%
Simplified2.1%
Taylor expanded in im around inf 35.3%
unpow235.3%
Simplified35.3%
if -5.99999999999999947e-4 < re < 2.10000000000000009Initial program 100.0%
Taylor expanded in re around 0 97.4%
*-rgt-identity97.4%
distribute-lft-in97.4%
Simplified97.4%
Taylor expanded in im around 0 52.1%
if 2.10000000000000009 < re Initial program 100.0%
Taylor expanded in re around 0 53.9%
*-commutative53.9%
associate-*r*53.9%
*-commutative53.9%
distribute-lft1-in53.9%
distribute-rgt-out53.9%
+-commutative53.9%
*-commutative53.9%
unpow253.9%
associate-*l*53.9%
Simplified53.9%
Taylor expanded in re around inf 53.9%
*-commutative53.9%
unpow253.9%
associate-*r*53.9%
associate-*r*53.9%
Simplified53.9%
Taylor expanded in im around 0 39.6%
*-commutative39.6%
unpow239.6%
Simplified39.6%
Final simplification44.1%
(FPCore (re im) :precision binary64 (+ re 1.0))
double code(double re, double im) {
return re + 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re + 1.0d0
end function
public static double code(double re, double im) {
return re + 1.0;
}
def code(re, im): return re + 1.0
function code(re, im) return Float64(re + 1.0) end
function tmp = code(re, im) tmp = re + 1.0; end
code[re_, im_] := N[(re + 1.0), $MachinePrecision]
\begin{array}{l}
\\
re + 1
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 47.9%
*-rgt-identity47.9%
distribute-lft-in47.9%
Simplified47.9%
Taylor expanded in im around 0 26.2%
Final simplification26.2%
(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 59.3%
*-commutative59.3%
associate-*r*59.3%
*-commutative59.3%
distribute-lft1-in59.3%
distribute-rgt-out59.3%
+-commutative59.3%
*-commutative59.3%
unpow259.3%
associate-*l*59.3%
Simplified59.3%
Taylor expanded in im around 0 34.4%
fma-def34.4%
unpow234.4%
Simplified34.4%
Taylor expanded in re around 0 25.7%
Final simplification25.7%
herbie shell --seed 2023201
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))