
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (re im) :precision binary64 (if (<= (exp re) 0.0) (exp re) (if (<= (exp re) 2.0) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.0) {
tmp = exp(re);
} else if (exp(re) <= 2.0) {
tmp = cos(im) * (re + 1.0);
} else {
tmp = exp(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (exp(re) <= 0.0d0) then
tmp = exp(re)
else if (exp(re) <= 2.0d0) then
tmp = cos(im) * (re + 1.0d0)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.exp(re) <= 0.0) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 2.0) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.0: tmp = math.exp(re) elif math.exp(re) <= 2.0: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.0) tmp = exp(re); elseif (exp(re) <= 2.0) tmp = Float64(cos(im) * Float64(re + 1.0)); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.0) tmp = exp(re); elseif (exp(re) <= 2.0) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.0], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 2.0], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 2:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\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 85.5%
if 0.0 < (exp.f64 re) < 2Initial program 99.9%
Taylor expanded in re around 0 99.5%
*-rgt-identity99.5%
distribute-lft-out99.5%
Simplified99.5%
Final simplification92.7%
(FPCore (re im) :precision binary64 (if (<= (exp re) 0.999999999998) (exp re) (if (<= (exp re) 2.0) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.999999999998) {
tmp = exp(re);
} else if (exp(re) <= 2.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
real(8) :: tmp
if (exp(re) <= 0.999999999998d0) then
tmp = exp(re)
else if (exp(re) <= 2.0d0) then
tmp = cos(im)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.exp(re) <= 0.999999999998) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 2.0) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.999999999998: tmp = math.exp(re) elif math.exp(re) <= 2.0: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.999999999998) tmp = exp(re); elseif (exp(re) <= 2.0) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.999999999998) tmp = exp(re); elseif (exp(re) <= 2.0) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.999999999998], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 2.0], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.999999999998:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 2:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.99999999999800004 or 2 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 85.6%
if 0.99999999999800004 < (exp.f64 re) < 2Initial program 99.9%
Taylor expanded in re around 0 99.3%
Final simplification92.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos im) (+ (* 0.5 (* re re)) (+ re 1.0)))))
(if (<= re -0.0042)
(exp re)
(if (<= re 0.038)
t_0
(if (<= re 5e+65)
(exp re)
(if (<= re 8.2e+150) (* (exp re) (+ 1.0 (* -0.5 (* im im)))) t_0))))))
double code(double re, double im) {
double t_0 = cos(im) * ((0.5 * (re * re)) + (re + 1.0));
double tmp;
if (re <= -0.0042) {
tmp = exp(re);
} else if (re <= 0.038) {
tmp = t_0;
} else if (re <= 5e+65) {
tmp = exp(re);
} else if (re <= 8.2e+150) {
tmp = exp(re) * (1.0 + (-0.5 * (im * im)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(im) * ((0.5d0 * (re * re)) + (re + 1.0d0))
if (re <= (-0.0042d0)) then
tmp = exp(re)
else if (re <= 0.038d0) then
tmp = t_0
else if (re <= 5d+65) then
tmp = exp(re)
else if (re <= 8.2d+150) then
tmp = exp(re) * (1.0d0 + ((-0.5d0) * (im * im)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(im) * ((0.5 * (re * re)) + (re + 1.0));
double tmp;
if (re <= -0.0042) {
tmp = Math.exp(re);
} else if (re <= 0.038) {
tmp = t_0;
} else if (re <= 5e+65) {
tmp = Math.exp(re);
} else if (re <= 8.2e+150) {
tmp = Math.exp(re) * (1.0 + (-0.5 * (im * im)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(im) * ((0.5 * (re * re)) + (re + 1.0)) tmp = 0 if re <= -0.0042: tmp = math.exp(re) elif re <= 0.038: tmp = t_0 elif re <= 5e+65: tmp = math.exp(re) elif re <= 8.2e+150: tmp = math.exp(re) * (1.0 + (-0.5 * (im * im))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(im) * Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0))) tmp = 0.0 if (re <= -0.0042) tmp = exp(re); elseif (re <= 0.038) tmp = t_0; elseif (re <= 5e+65) tmp = exp(re); elseif (re <= 8.2e+150) tmp = Float64(exp(re) * Float64(1.0 + Float64(-0.5 * Float64(im * im)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(im) * ((0.5 * (re * re)) + (re + 1.0)); tmp = 0.0; if (re <= -0.0042) tmp = exp(re); elseif (re <= 0.038) tmp = t_0; elseif (re <= 5e+65) tmp = exp(re); elseif (re <= 8.2e+150) tmp = exp(re) * (1.0 + (-0.5 * (im * im))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[im], $MachinePrecision] * N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.0042], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.038], t$95$0, If[LessEqual[re, 5e+65], N[Exp[re], $MachinePrecision], If[LessEqual[re, 8.2e+150], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos im \cdot \left(0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\right)\\
\mathbf{if}\;re \leq -0.0042:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.038:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 5 \cdot 10^{+65}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 8.2 \cdot 10^{+150}:\\
\;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if re < -0.00419999999999999974 or 0.0379999999999999991 < re < 4.99999999999999973e65Initial program 100.0%
Taylor expanded in im around 0 97.4%
if -0.00419999999999999974 < re < 0.0379999999999999991 or 8.19999999999999988e150 < re Initial program 100.0%
Taylor expanded in re around 0 99.1%
+-commutative99.1%
+-commutative99.1%
*-rgt-identity99.1%
distribute-lft-out99.1%
*-commutative99.1%
associate-*l*99.1%
distribute-lft-out99.1%
+-commutative99.1%
*-commutative99.1%
unpow299.1%
Simplified99.1%
if 4.99999999999999973e65 < re < 8.19999999999999988e150Initial program 100.0%
Taylor expanded in im around 0 85.0%
unpow247.7%
Simplified85.0%
Final simplification97.5%
(FPCore (re im)
:precision binary64
(if (<= re -6.8e-5)
(exp re)
(if (<= re 0.0295)
(* (cos im) (+ re 1.0))
(if (<= re 5e+62) (exp re) (* (exp re) (+ 1.0 (* -0.5 (* im im))))))))
double code(double re, double im) {
double tmp;
if (re <= -6.8e-5) {
tmp = exp(re);
} else if (re <= 0.0295) {
tmp = cos(im) * (re + 1.0);
} else if (re <= 5e+62) {
tmp = exp(re);
} else {
tmp = exp(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 <= (-6.8d-5)) then
tmp = exp(re)
else if (re <= 0.0295d0) then
tmp = cos(im) * (re + 1.0d0)
else if (re <= 5d+62) then
tmp = exp(re)
else
tmp = exp(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 <= -6.8e-5) {
tmp = Math.exp(re);
} else if (re <= 0.0295) {
tmp = Math.cos(im) * (re + 1.0);
} else if (re <= 5e+62) {
tmp = Math.exp(re);
} else {
tmp = Math.exp(re) * (1.0 + (-0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -6.8e-5: tmp = math.exp(re) elif re <= 0.0295: tmp = math.cos(im) * (re + 1.0) elif re <= 5e+62: tmp = math.exp(re) else: tmp = math.exp(re) * (1.0 + (-0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (re <= -6.8e-5) tmp = exp(re); elseif (re <= 0.0295) tmp = Float64(cos(im) * Float64(re + 1.0)); elseif (re <= 5e+62) tmp = exp(re); else tmp = Float64(exp(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 <= -6.8e-5) tmp = exp(re); elseif (re <= 0.0295) tmp = cos(im) * (re + 1.0); elseif (re <= 5e+62) tmp = exp(re); else tmp = exp(re) * (1.0 + (-0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -6.8e-5], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0295], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5e+62], N[Exp[re], $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -6.8 \cdot 10^{-5}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0295:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 5 \cdot 10^{+62}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;e^{re} \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if re < -6.7999999999999999e-5 or 0.029499999999999998 < re < 5.00000000000000029e62Initial program 100.0%
Taylor expanded in im around 0 97.4%
if -6.7999999999999999e-5 < re < 0.029499999999999998Initial program 99.9%
Taylor expanded in re around 0 99.5%
*-rgt-identity99.5%
distribute-lft-out99.5%
Simplified99.5%
if 5.00000000000000029e62 < re Initial program 100.0%
Taylor expanded in im around 0 78.7%
unpow262.9%
Simplified78.7%
Final simplification95.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5))) (t_1 (- -1.0 t_0)))
(if (<= re -3400.0)
(* -0.5 (* (* im im) (+ re 1.0)))
(if (<= re 4.3e+19)
(cos im)
(if (<= re 1.1e+134)
(* (+ 1.0 (* -0.5 (* im im))) (+ (* 0.5 (* re re)) (+ re 1.0)))
(if (<= re 1.4e+154)
(/ (+ (* re re) (* (+ 1.0 t_0) t_1)) (+ re t_1))
t_0))))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = -1.0 - t_0;
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 4.3e+19) {
tmp = cos(im);
} else if (re <= 1.1e+134) {
tmp = (1.0 + (-0.5 * (im * im))) * ((0.5 * (re * re)) + (re + 1.0));
} else if (re <= 1.4e+154) {
tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = re * (re * 0.5d0)
t_1 = (-1.0d0) - t_0
if (re <= (-3400.0d0)) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else if (re <= 4.3d+19) then
tmp = cos(im)
else if (re <= 1.1d+134) then
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * ((0.5d0 * (re * re)) + (re + 1.0d0))
else if (re <= 1.4d+154) then
tmp = ((re * re) + ((1.0d0 + t_0) * t_1)) / (re + t_1)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = -1.0 - t_0;
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 4.3e+19) {
tmp = Math.cos(im);
} else if (re <= 1.1e+134) {
tmp = (1.0 + (-0.5 * (im * im))) * ((0.5 * (re * re)) + (re + 1.0));
} else if (re <= 1.4e+154) {
tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) t_1 = -1.0 - t_0 tmp = 0 if re <= -3400.0: tmp = -0.5 * ((im * im) * (re + 1.0)) elif re <= 4.3e+19: tmp = math.cos(im) elif re <= 1.1e+134: tmp = (1.0 + (-0.5 * (im * im))) * ((0.5 * (re * re)) + (re + 1.0)) elif re <= 1.4e+154: tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) t_1 = Float64(-1.0 - t_0) tmp = 0.0 if (re <= -3400.0) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); elseif (re <= 4.3e+19) tmp = cos(im); elseif (re <= 1.1e+134) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0))); elseif (re <= 1.4e+154) tmp = Float64(Float64(Float64(re * re) + Float64(Float64(1.0 + t_0) * t_1)) / Float64(re + t_1)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); t_1 = -1.0 - t_0; tmp = 0.0; if (re <= -3400.0) tmp = -0.5 * ((im * im) * (re + 1.0)); elseif (re <= 4.3e+19) tmp = cos(im); elseif (re <= 1.1e+134) tmp = (1.0 + (-0.5 * (im * im))) * ((0.5 * (re * re)) + (re + 1.0)); elseif (re <= 1.4e+154) tmp = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[re, -3400.0], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4.3e+19], N[Cos[im], $MachinePrecision], If[LessEqual[re, 1.1e+134], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.4e+154], N[(N[(N[(re * re), $MachinePrecision] + N[(N[(1.0 + t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(re + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
t_1 := -1 - t_0\\
\mathbf{if}\;re \leq -3400:\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 4.3 \cdot 10^{+19}:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 1.1 \cdot 10^{+134}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{re \cdot re + \left(1 + t_0\right) \cdot t_1}{re + t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if re < -3400Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-out2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 33.6%
unpow233.6%
+-commutative33.6%
*-commutative33.6%
+-commutative33.6%
Simplified33.6%
if -3400 < re < 4.3e19Initial program 99.9%
Taylor expanded in re around 0 94.3%
if 4.3e19 < re < 1.1e134Initial program 100.0%
Taylor expanded in re around 0 4.8%
+-commutative4.8%
+-commutative4.8%
*-rgt-identity4.8%
distribute-lft-out4.8%
*-commutative4.8%
associate-*l*4.8%
distribute-lft-out4.8%
+-commutative4.8%
*-commutative4.8%
unpow24.8%
Simplified4.8%
Taylor expanded in im around 0 35.3%
unpow235.3%
Simplified35.3%
if 1.1e134 < re < 1.4e154Initial program 100.0%
Taylor expanded in re around 0 9.6%
+-commutative9.6%
+-commutative9.6%
*-rgt-identity9.6%
distribute-lft-out9.6%
*-commutative9.6%
associate-*l*9.6%
distribute-lft-out9.6%
+-commutative9.6%
*-commutative9.6%
unpow29.6%
Simplified9.6%
Taylor expanded in im around 0 9.6%
associate-+l+9.6%
flip-+100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
Applied egg-rr100.0%
if 1.4e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
+-commutative100.0%
+-commutative100.0%
*-rgt-identity100.0%
distribute-lft-out100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around 0 76.9%
unpow276.9%
Simplified76.9%
Taylor expanded in re around inf 76.9%
unpow276.9%
*-commutative76.9%
associate-*r*76.9%
Simplified76.9%
Taylor expanded in im around 0 76.9%
unpow276.9%
*-commutative76.9%
associate-*r*76.9%
Simplified76.9%
Final simplification72.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5)))
(t_1 (- -1.0 t_0))
(t_2 (/ (+ (* re re) (* (+ 1.0 t_0) t_1)) (+ re t_1))))
(if (<= re -3400.0)
(* -0.5 (* (* im im) (+ re 1.0)))
(if (<= re 3e+83)
t_2
(if (<= re 1.1e+134)
(* (+ 1.0 (* -0.5 (* im im))) t_0)
(if (<= re 1.4e+154) t_2 t_0))))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = -1.0 - t_0;
double t_2 = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1);
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 3e+83) {
tmp = t_2;
} else if (re <= 1.1e+134) {
tmp = (1.0 + (-0.5 * (im * im))) * t_0;
} else if (re <= 1.4e+154) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = re * (re * 0.5d0)
t_1 = (-1.0d0) - t_0
t_2 = ((re * re) + ((1.0d0 + t_0) * t_1)) / (re + t_1)
if (re <= (-3400.0d0)) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else if (re <= 3d+83) then
tmp = t_2
else if (re <= 1.1d+134) then
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * t_0
else if (re <= 1.4d+154) then
tmp = t_2
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = -1.0 - t_0;
double t_2 = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1);
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 3e+83) {
tmp = t_2;
} else if (re <= 1.1e+134) {
tmp = (1.0 + (-0.5 * (im * im))) * t_0;
} else if (re <= 1.4e+154) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) t_1 = -1.0 - t_0 t_2 = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1) tmp = 0 if re <= -3400.0: tmp = -0.5 * ((im * im) * (re + 1.0)) elif re <= 3e+83: tmp = t_2 elif re <= 1.1e+134: tmp = (1.0 + (-0.5 * (im * im))) * t_0 elif re <= 1.4e+154: tmp = t_2 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) t_1 = Float64(-1.0 - t_0) t_2 = Float64(Float64(Float64(re * re) + Float64(Float64(1.0 + t_0) * t_1)) / Float64(re + t_1)) tmp = 0.0 if (re <= -3400.0) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); elseif (re <= 3e+83) tmp = t_2; elseif (re <= 1.1e+134) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * t_0); elseif (re <= 1.4e+154) tmp = t_2; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); t_1 = -1.0 - t_0; t_2 = ((re * re) + ((1.0 + t_0) * t_1)) / (re + t_1); tmp = 0.0; if (re <= -3400.0) tmp = -0.5 * ((im * im) * (re + 1.0)); elseif (re <= 3e+83) tmp = t_2; elseif (re <= 1.1e+134) tmp = (1.0 + (-0.5 * (im * im))) * t_0; elseif (re <= 1.4e+154) tmp = t_2; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(re * re), $MachinePrecision] + N[(N[(1.0 + t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(re + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -3400.0], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3e+83], t$95$2, If[LessEqual[re, 1.1e+134], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[re, 1.4e+154], t$95$2, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
t_1 := -1 - t_0\\
t_2 := \frac{re \cdot re + \left(1 + t_0\right) \cdot t_1}{re + t_1}\\
\mathbf{if}\;re \leq -3400:\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 3 \cdot 10^{+83}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;re \leq 1.1 \cdot 10^{+134}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot t_0\\
\mathbf{elif}\;re \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if re < -3400Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-out2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 33.6%
unpow233.6%
+-commutative33.6%
*-commutative33.6%
+-commutative33.6%
Simplified33.6%
if -3400 < re < 3e83 or 1.1e134 < re < 1.4e154Initial program 100.0%
Taylor expanded in re around 0 82.5%
+-commutative82.5%
+-commutative82.5%
*-rgt-identity82.5%
distribute-lft-out82.5%
*-commutative82.5%
associate-*l*82.5%
distribute-lft-out82.5%
+-commutative82.5%
*-commutative82.5%
unpow282.5%
Simplified82.5%
Taylor expanded in im around 0 49.0%
associate-+l+49.0%
flip-+52.3%
*-commutative52.3%
associate-*l*52.3%
*-commutative52.3%
associate-*l*52.3%
*-commutative52.3%
associate-*l*52.3%
Applied egg-rr52.3%
if 3e83 < re < 1.1e134Initial program 100.0%
Taylor expanded in re around 0 5.8%
+-commutative5.8%
+-commutative5.8%
*-rgt-identity5.8%
distribute-lft-out5.8%
*-commutative5.8%
associate-*l*5.8%
distribute-lft-out5.8%
+-commutative5.8%
*-commutative5.8%
unpow25.8%
Simplified5.8%
Taylor expanded in im around 0 70.2%
unpow270.2%
Simplified70.2%
Taylor expanded in re around inf 70.2%
unpow270.2%
*-commutative70.2%
associate-*r*70.2%
Simplified70.2%
if 1.4e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
+-commutative100.0%
+-commutative100.0%
*-rgt-identity100.0%
distribute-lft-out100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around 0 76.9%
unpow276.9%
Simplified76.9%
Taylor expanded in re around inf 76.9%
unpow276.9%
*-commutative76.9%
associate-*r*76.9%
Simplified76.9%
Taylor expanded in im around 0 76.9%
unpow276.9%
*-commutative76.9%
associate-*r*76.9%
Simplified76.9%
Final simplification51.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ (* 0.5 (* re re)) (+ re 1.0))))
(if (<= re -3400.0)
(* -0.5 (* (* im im) (+ re 1.0)))
(if (<= re 2.5e+19) t_0 (* (+ 1.0 (* -0.5 (* im im))) t_0)))))
double code(double re, double im) {
double t_0 = (0.5 * (re * re)) + (re + 1.0);
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 2.5e+19) {
tmp = t_0;
} else {
tmp = (1.0 + (-0.5 * (im * 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 = (0.5d0 * (re * re)) + (re + 1.0d0)
if (re <= (-3400.0d0)) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else if (re <= 2.5d+19) then
tmp = t_0
else
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (0.5 * (re * re)) + (re + 1.0);
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 2.5e+19) {
tmp = t_0;
} else {
tmp = (1.0 + (-0.5 * (im * im))) * t_0;
}
return tmp;
}
def code(re, im): t_0 = (0.5 * (re * re)) + (re + 1.0) tmp = 0 if re <= -3400.0: tmp = -0.5 * ((im * im) * (re + 1.0)) elif re <= 2.5e+19: tmp = t_0 else: tmp = (1.0 + (-0.5 * (im * im))) * t_0 return tmp
function code(re, im) t_0 = Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0)) tmp = 0.0 if (re <= -3400.0) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); elseif (re <= 2.5e+19) tmp = t_0; else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = (0.5 * (re * re)) + (re + 1.0); tmp = 0.0; if (re <= -3400.0) tmp = -0.5 * ((im * im) * (re + 1.0)); elseif (re <= 2.5e+19) tmp = t_0; else tmp = (1.0 + (-0.5 * (im * im))) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -3400.0], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.5e+19], t$95$0, N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\\
\mathbf{if}\;re \leq -3400:\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 2.5 \cdot 10^{+19}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot t_0\\
\end{array}
\end{array}
if re < -3400Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-out2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 33.6%
unpow233.6%
+-commutative33.6%
*-commutative33.6%
+-commutative33.6%
Simplified33.6%
if -3400 < re < 2.5e19Initial program 99.9%
Taylor expanded in re around 0 94.7%
+-commutative94.7%
+-commutative94.7%
*-rgt-identity94.7%
distribute-lft-out94.7%
*-commutative94.7%
associate-*l*94.7%
distribute-lft-out94.7%
+-commutative94.7%
*-commutative94.7%
unpow294.7%
Simplified94.7%
Taylor expanded in im around 0 55.9%
if 2.5e19 < re Initial program 100.0%
Taylor expanded in re around 0 45.8%
+-commutative45.8%
+-commutative45.8%
*-rgt-identity45.8%
distribute-lft-out45.8%
*-commutative45.8%
associate-*l*45.8%
distribute-lft-out45.8%
+-commutative45.8%
*-commutative45.8%
unpow245.8%
Simplified45.8%
Taylor expanded in im around 0 50.6%
unpow250.6%
Simplified50.6%
Final simplification49.8%
(FPCore (re im)
:precision binary64
(if (<= re -3400.0)
(* -0.5 (* (* im im) (+ re 1.0)))
(if (<= re 2.6e+19)
(+ (* 0.5 (* re re)) (+ re 1.0))
(* (+ 1.0 (* -0.5 (* im im))) (* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 2.6e+19) {
tmp = (0.5 * (re * re)) + (re + 1.0);
} else {
tmp = (1.0 + (-0.5 * (im * 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 <= (-3400.0d0)) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else if (re <= 2.6d+19) then
tmp = (0.5d0 * (re * re)) + (re + 1.0d0)
else
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * (re * (re * 0.5d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 2.6e+19) {
tmp = (0.5 * (re * re)) + (re + 1.0);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3400.0: tmp = -0.5 * ((im * im) * (re + 1.0)) elif re <= 2.6e+19: tmp = (0.5 * (re * re)) + (re + 1.0) else: tmp = (1.0 + (-0.5 * (im * im))) * (re * (re * 0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= -3400.0) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); elseif (re <= 2.6e+19) tmp = Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0)); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(re * Float64(re * 0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -3400.0) tmp = -0.5 * ((im * im) * (re + 1.0)); elseif (re <= 2.6e+19) tmp = (0.5 * (re * re)) + (re + 1.0); else tmp = (1.0 + (-0.5 * (im * im))) * (re * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3400.0], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.6e+19], N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -3400:\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 2.6 \cdot 10^{+19}:\\
\;\;\;\;0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -3400Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-out2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 33.6%
unpow233.6%
+-commutative33.6%
*-commutative33.6%
+-commutative33.6%
Simplified33.6%
if -3400 < re < 2.6e19Initial program 99.9%
Taylor expanded in re around 0 94.7%
+-commutative94.7%
+-commutative94.7%
*-rgt-identity94.7%
distribute-lft-out94.7%
*-commutative94.7%
associate-*l*94.7%
distribute-lft-out94.7%
+-commutative94.7%
*-commutative94.7%
unpow294.7%
Simplified94.7%
Taylor expanded in im around 0 55.9%
if 2.6e19 < re Initial program 100.0%
Taylor expanded in re around 0 45.8%
+-commutative45.8%
+-commutative45.8%
*-rgt-identity45.8%
distribute-lft-out45.8%
*-commutative45.8%
associate-*l*45.8%
distribute-lft-out45.8%
+-commutative45.8%
*-commutative45.8%
unpow245.8%
Simplified45.8%
Taylor expanded in im around 0 50.6%
unpow250.6%
Simplified50.6%
Taylor expanded in re around inf 50.6%
unpow250.6%
*-commutative50.6%
associate-*r*50.6%
Simplified50.6%
Final simplification49.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.5 (* (* im im) (+ re 1.0)))))
(if (<= re -3400.0)
t_0
(if (<= re 1.85e+25)
(+ re 1.0)
(if (<= re 6.8e+136) t_0 (* re (* re 0.5)))))))
double code(double re, double im) {
double t_0 = -0.5 * ((im * im) * (re + 1.0));
double tmp;
if (re <= -3400.0) {
tmp = t_0;
} else if (re <= 1.85e+25) {
tmp = re + 1.0;
} else if (re <= 6.8e+136) {
tmp = t_0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.5d0) * ((im * im) * (re + 1.0d0))
if (re <= (-3400.0d0)) then
tmp = t_0
else if (re <= 1.85d+25) then
tmp = re + 1.0d0
else if (re <= 6.8d+136) then
tmp = t_0
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.5 * ((im * im) * (re + 1.0));
double tmp;
if (re <= -3400.0) {
tmp = t_0;
} else if (re <= 1.85e+25) {
tmp = re + 1.0;
} else if (re <= 6.8e+136) {
tmp = t_0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): t_0 = -0.5 * ((im * im) * (re + 1.0)) tmp = 0 if re <= -3400.0: tmp = t_0 elif re <= 1.85e+25: tmp = re + 1.0 elif re <= 6.8e+136: tmp = t_0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) t_0 = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))) tmp = 0.0 if (re <= -3400.0) tmp = t_0; elseif (re <= 1.85e+25) tmp = Float64(re + 1.0); elseif (re <= 6.8e+136) tmp = t_0; else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.5 * ((im * im) * (re + 1.0)); tmp = 0.0; if (re <= -3400.0) tmp = t_0; elseif (re <= 1.85e+25) tmp = re + 1.0; elseif (re <= 6.8e+136) tmp = t_0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -3400.0], t$95$0, If[LessEqual[re, 1.85e+25], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 6.8e+136], t$95$0, N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{if}\;re \leq -3400:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 1.85 \cdot 10^{+25}:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 6.8 \cdot 10^{+136}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -3400 or 1.8499999999999999e25 < re < 6.79999999999999993e136Initial program 100.0%
Taylor expanded in re around 0 2.7%
*-rgt-identity2.7%
distribute-lft-out2.7%
Simplified2.7%
Taylor expanded in im around 0 12.3%
unpow213.4%
Simplified12.3%
Taylor expanded in im around inf 32.7%
unpow232.7%
+-commutative32.7%
*-commutative32.7%
+-commutative32.7%
Simplified32.7%
if -3400 < re < 1.8499999999999999e25Initial program 99.9%
Taylor expanded in re around 0 94.6%
*-rgt-identity94.6%
distribute-lft-out94.6%
Simplified94.6%
Taylor expanded in im around 0 55.9%
if 6.79999999999999993e136 < re Initial program 100.0%
Taylor expanded in re around 0 85.4%
+-commutative85.4%
+-commutative85.4%
*-rgt-identity85.4%
distribute-lft-out85.4%
*-commutative85.4%
associate-*l*85.4%
distribute-lft-out85.4%
+-commutative85.4%
*-commutative85.4%
unpow285.4%
Simplified85.4%
Taylor expanded in im around 0 65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in re around inf 65.4%
unpow265.4%
*-commutative65.4%
associate-*r*65.4%
Simplified65.4%
Taylor expanded in im around 0 66.1%
unpow266.1%
*-commutative66.1%
associate-*r*66.1%
Simplified66.1%
Final simplification49.4%
(FPCore (re im)
:precision binary64
(if (<= re -3400.0)
(* -0.5 (* (* im im) (+ re 1.0)))
(if (<= re 2.5e+19)
(+ re 1.0)
(if (<= re 2.7e+140)
(* -0.25 (* re (* re (* im im))))
(* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 2.5e+19) {
tmp = re + 1.0;
} else if (re <= 2.7e+140) {
tmp = -0.25 * (re * (re * (im * 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 <= (-3400.0d0)) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else if (re <= 2.5d+19) then
tmp = re + 1.0d0
else if (re <= 2.7d+140) then
tmp = (-0.25d0) * (re * (re * (im * 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 <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 2.5e+19) {
tmp = re + 1.0;
} else if (re <= 2.7e+140) {
tmp = -0.25 * (re * (re * (im * im)));
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3400.0: tmp = -0.5 * ((im * im) * (re + 1.0)) elif re <= 2.5e+19: tmp = re + 1.0 elif re <= 2.7e+140: tmp = -0.25 * (re * (re * (im * im))) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -3400.0) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); elseif (re <= 2.5e+19) tmp = Float64(re + 1.0); elseif (re <= 2.7e+140) tmp = Float64(-0.25 * Float64(re * Float64(re * Float64(im * im)))); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -3400.0) tmp = -0.5 * ((im * im) * (re + 1.0)); elseif (re <= 2.5e+19) tmp = re + 1.0; elseif (re <= 2.7e+140) tmp = -0.25 * (re * (re * (im * im))); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3400.0], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.5e+19], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 2.7e+140], N[(-0.25 * N[(re * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -3400:\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 2.5 \cdot 10^{+19}:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 2.7 \cdot 10^{+140}:\\
\;\;\;\;-0.25 \cdot \left(re \cdot \left(re \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -3400Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-out2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 33.6%
unpow233.6%
+-commutative33.6%
*-commutative33.6%
+-commutative33.6%
Simplified33.6%
if -3400 < re < 2.5e19Initial program 99.9%
Taylor expanded in re around 0 94.6%
*-rgt-identity94.6%
distribute-lft-out94.6%
Simplified94.6%
Taylor expanded in im around 0 55.9%
if 2.5e19 < re < 2.70000000000000018e140Initial program 100.0%
Taylor expanded in re around 0 4.8%
+-commutative4.8%
+-commutative4.8%
*-rgt-identity4.8%
distribute-lft-out4.8%
*-commutative4.8%
associate-*l*4.8%
distribute-lft-out4.8%
+-commutative4.8%
*-commutative4.8%
unpow24.8%
Simplified4.8%
Taylor expanded in im around 0 35.3%
unpow235.3%
Simplified35.3%
Taylor expanded in re around inf 35.3%
unpow235.3%
*-commutative35.3%
associate-*r*35.3%
Simplified35.3%
Taylor expanded in im around inf 34.3%
unpow234.3%
unpow234.3%
associate-*l*34.3%
Simplified34.3%
if 2.70000000000000018e140 < re Initial program 100.0%
Taylor expanded in re around 0 85.4%
+-commutative85.4%
+-commutative85.4%
*-rgt-identity85.4%
distribute-lft-out85.4%
*-commutative85.4%
associate-*l*85.4%
distribute-lft-out85.4%
+-commutative85.4%
*-commutative85.4%
unpow285.4%
Simplified85.4%
Taylor expanded in im around 0 65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in re around inf 65.4%
unpow265.4%
*-commutative65.4%
associate-*r*65.4%
Simplified65.4%
Taylor expanded in im around 0 66.1%
unpow266.1%
*-commutative66.1%
associate-*r*66.1%
Simplified66.1%
Final simplification49.7%
(FPCore (re im)
:precision binary64
(if (<= re -3400.0)
(* -0.5 (* (* im im) (+ re 1.0)))
(if (<= re 2.35e+20)
(+ (* 0.5 (* re re)) (+ re 1.0))
(if (<= re 2.7e+140)
(* -0.25 (* re (* re (* im im))))
(* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 2.35e+20) {
tmp = (0.5 * (re * re)) + (re + 1.0);
} else if (re <= 2.7e+140) {
tmp = -0.25 * (re * (re * (im * 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 <= (-3400.0d0)) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else if (re <= 2.35d+20) then
tmp = (0.5d0 * (re * re)) + (re + 1.0d0)
else if (re <= 2.7d+140) then
tmp = (-0.25d0) * (re * (re * (im * 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 <= -3400.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 2.35e+20) {
tmp = (0.5 * (re * re)) + (re + 1.0);
} else if (re <= 2.7e+140) {
tmp = -0.25 * (re * (re * (im * im)));
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3400.0: tmp = -0.5 * ((im * im) * (re + 1.0)) elif re <= 2.35e+20: tmp = (0.5 * (re * re)) + (re + 1.0) elif re <= 2.7e+140: tmp = -0.25 * (re * (re * (im * im))) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -3400.0) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); elseif (re <= 2.35e+20) tmp = Float64(Float64(0.5 * Float64(re * re)) + Float64(re + 1.0)); elseif (re <= 2.7e+140) tmp = Float64(-0.25 * Float64(re * Float64(re * Float64(im * im)))); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -3400.0) tmp = -0.5 * ((im * im) * (re + 1.0)); elseif (re <= 2.35e+20) tmp = (0.5 * (re * re)) + (re + 1.0); elseif (re <= 2.7e+140) tmp = -0.25 * (re * (re * (im * im))); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3400.0], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.35e+20], N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.7e+140], N[(-0.25 * N[(re * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -3400:\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 2.35 \cdot 10^{+20}:\\
\;\;\;\;0.5 \cdot \left(re \cdot re\right) + \left(re + 1\right)\\
\mathbf{elif}\;re \leq 2.7 \cdot 10^{+140}:\\
\;\;\;\;-0.25 \cdot \left(re \cdot \left(re \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -3400Initial program 100.0%
Taylor expanded in re around 0 2.2%
*-rgt-identity2.2%
distribute-lft-out2.2%
Simplified2.2%
Taylor expanded in im around 0 2.0%
unpow21.7%
Simplified2.0%
Taylor expanded in im around inf 33.6%
unpow233.6%
+-commutative33.6%
*-commutative33.6%
+-commutative33.6%
Simplified33.6%
if -3400 < re < 2.35e20Initial program 99.9%
Taylor expanded in re around 0 94.7%
+-commutative94.7%
+-commutative94.7%
*-rgt-identity94.7%
distribute-lft-out94.7%
*-commutative94.7%
associate-*l*94.7%
distribute-lft-out94.7%
+-commutative94.7%
*-commutative94.7%
unpow294.7%
Simplified94.7%
Taylor expanded in im around 0 55.9%
if 2.35e20 < re < 2.70000000000000018e140Initial program 100.0%
Taylor expanded in re around 0 4.8%
+-commutative4.8%
+-commutative4.8%
*-rgt-identity4.8%
distribute-lft-out4.8%
*-commutative4.8%
associate-*l*4.8%
distribute-lft-out4.8%
+-commutative4.8%
*-commutative4.8%
unpow24.8%
Simplified4.8%
Taylor expanded in im around 0 35.3%
unpow235.3%
Simplified35.3%
Taylor expanded in re around inf 35.3%
unpow235.3%
*-commutative35.3%
associate-*r*35.3%
Simplified35.3%
Taylor expanded in im around inf 34.3%
unpow234.3%
unpow234.3%
associate-*l*34.3%
Simplified34.3%
if 2.70000000000000018e140 < re Initial program 100.0%
Taylor expanded in re around 0 85.4%
+-commutative85.4%
+-commutative85.4%
*-rgt-identity85.4%
distribute-lft-out85.4%
*-commutative85.4%
associate-*l*85.4%
distribute-lft-out85.4%
+-commutative85.4%
*-commutative85.4%
unpow285.4%
Simplified85.4%
Taylor expanded in im around 0 65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in re around inf 65.4%
unpow265.4%
*-commutative65.4%
associate-*r*65.4%
Simplified65.4%
Taylor expanded in im around 0 66.1%
unpow266.1%
*-commutative66.1%
associate-*r*66.1%
Simplified66.1%
Final simplification49.7%
(FPCore (re im) :precision binary64 (if (<= re 2.5e+19) 1.0 (if (<= re 2.7e+140) (+ 1.0 (* -0.5 (* im im))) (* re (* re 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= 2.5e+19) {
tmp = 1.0;
} else if (re <= 2.7e+140) {
tmp = 1.0 + (-0.5 * (im * 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 <= 2.5d+19) then
tmp = 1.0d0
else if (re <= 2.7d+140) then
tmp = 1.0d0 + ((-0.5d0) * (im * 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 <= 2.5e+19) {
tmp = 1.0;
} else if (re <= 2.7e+140) {
tmp = 1.0 + (-0.5 * (im * im));
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.5e+19: tmp = 1.0 elif re <= 2.7e+140: tmp = 1.0 + (-0.5 * (im * im)) else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.5e+19) tmp = 1.0; elseif (re <= 2.7e+140) tmp = Float64(1.0 + Float64(-0.5 * Float64(im * im))); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.5e+19) tmp = 1.0; elseif (re <= 2.7e+140) tmp = 1.0 + (-0.5 * (im * im)); else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.5e+19], 1.0, If[LessEqual[re, 2.7e+140], N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.5 \cdot 10^{+19}:\\
\;\;\;\;1\\
\mathbf{elif}\;re \leq 2.7 \cdot 10^{+140}:\\
\;\;\;\;1 + -0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 2.5e19Initial program 100.0%
Taylor expanded in re around 0 68.1%
Taylor expanded in im around 0 40.6%
if 2.5e19 < re < 2.70000000000000018e140Initial program 100.0%
Taylor expanded in re around 0 3.1%
Taylor expanded in im around 0 25.3%
unpow235.3%
Simplified25.3%
if 2.70000000000000018e140 < re Initial program 100.0%
Taylor expanded in re around 0 85.4%
+-commutative85.4%
+-commutative85.4%
*-rgt-identity85.4%
distribute-lft-out85.4%
*-commutative85.4%
associate-*l*85.4%
distribute-lft-out85.4%
+-commutative85.4%
*-commutative85.4%
unpow285.4%
Simplified85.4%
Taylor expanded in im around 0 65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in re around inf 65.4%
unpow265.4%
*-commutative65.4%
associate-*r*65.4%
Simplified65.4%
Taylor expanded in im around 0 66.1%
unpow266.1%
*-commutative66.1%
associate-*r*66.1%
Simplified66.1%
Final simplification41.9%
(FPCore (re im) :precision binary64 (if (<= re 1.42) 1.0 (* re (* re 0.5))))
double code(double re, double im) {
double tmp;
if (re <= 1.42) {
tmp = 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 1.42d0) then
tmp = 1.0d0
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.42) {
tmp = 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.42: tmp = 1.0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.42) tmp = 1.0; else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.42) tmp = 1.0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.42], 1.0, N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.42:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 1.4199999999999999Initial program 100.0%
Taylor expanded in re around 0 70.2%
Taylor expanded in im around 0 41.8%
if 1.4199999999999999 < re Initial program 100.0%
Taylor expanded in re around 0 42.0%
+-commutative42.0%
+-commutative42.0%
*-rgt-identity42.0%
distribute-lft-out42.0%
*-commutative42.0%
associate-*l*42.0%
distribute-lft-out42.0%
+-commutative42.0%
*-commutative42.0%
unpow242.0%
Simplified42.0%
Taylor expanded in im around 0 46.2%
unpow246.2%
Simplified46.2%
Taylor expanded in re around inf 46.2%
unpow246.2%
*-commutative46.2%
associate-*r*46.2%
Simplified46.2%
Taylor expanded in im around 0 32.1%
unpow232.1%
*-commutative32.1%
associate-*r*32.1%
Simplified32.1%
Final simplification39.3%
(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 53.1%
*-rgt-identity53.1%
distribute-lft-out53.0%
Simplified53.0%
Taylor expanded in im around 0 31.7%
Final simplification31.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 52.6%
Taylor expanded in im around 0 31.5%
Final simplification31.5%
herbie shell --seed 2023188
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))