
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (+ (exp (- im)) (exp im)) 0.75)))
(if (<= im 78.0)
(* (sin re) (fma im (* 0.5 im) 1.0))
(if (<= im 1.5e+114)
t_0
(if (<= im 2.3e+144)
(log1p (expm1 re))
(if (<= im 1.35e+154) t_0 (* (* 0.5 (sin re)) (* im im))))))))
double code(double re, double im) {
double t_0 = (exp(-im) + exp(im)) * 0.75;
double tmp;
if (im <= 78.0) {
tmp = sin(re) * fma(im, (0.5 * im), 1.0);
} else if (im <= 1.5e+114) {
tmp = t_0;
} else if (im <= 2.3e+144) {
tmp = log1p(expm1(re));
} else if (im <= 1.35e+154) {
tmp = t_0;
} else {
tmp = (0.5 * sin(re)) * (im * im);
}
return tmp;
}
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) + exp(im)) * 0.75) tmp = 0.0 if (im <= 78.0) tmp = Float64(sin(re) * fma(im, Float64(0.5 * im), 1.0)); elseif (im <= 1.5e+114) tmp = t_0; elseif (im <= 2.3e+144) tmp = log1p(expm1(re)); elseif (im <= 1.35e+154) tmp = t_0; else tmp = Float64(Float64(0.5 * sin(re)) * Float64(im * im)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * 0.75), $MachinePrecision]}, If[LessEqual[im, 78.0], N[(N[Sin[re], $MachinePrecision] * N[(im * N[(0.5 * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.5e+114], t$95$0, If[LessEqual[im, 2.3e+144], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$0, N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} + e^{im}\right) \cdot 0.75\\
\mathbf{if}\;im \leq 78:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(im, 0.5 \cdot im, 1\right)\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+114}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2.3 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 78Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr59.0%
Applied egg-rr59.0%
Taylor expanded in im around 0 82.9%
*-commutative82.9%
associate-*r*82.9%
distribute-rgt1-in82.9%
unpow282.9%
associate-*r*82.9%
*-commutative82.9%
fma-udef82.9%
Simplified82.9%
if 78 < im < 1.5e114 or 2.3000000000000001e144 < im < 1.35000000000000003e154Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr50.0%
Applied egg-rr50.0%
Applied egg-rr38.5%
if 1.5e114 < im < 2.3000000000000001e144Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Applied egg-rr58.1%
if 1.35000000000000003e154 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
unpow2100.0%
Simplified100.0%
Final simplification79.5%
(FPCore (re im)
:precision binary64
(if (<= im 9e-5)
(* (sin re) (fma im (* 0.5 im) 1.0))
(if (<= im 2.3e+151)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(* (* 0.5 (sin re)) (* im im)))))
double code(double re, double im) {
double tmp;
if (im <= 9e-5) {
tmp = sin(re) * fma(im, (0.5 * im), 1.0);
} else if (im <= 2.3e+151) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = (0.5 * sin(re)) * (im * im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 9e-5) tmp = Float64(sin(re) * fma(im, Float64(0.5 * im), 1.0)); elseif (im <= 2.3e+151) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(im * im)); end return tmp end
code[re_, im_] := If[LessEqual[im, 9e-5], N[(N[Sin[re], $MachinePrecision] * N[(im * N[(0.5 * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.3e+151], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9 \cdot 10^{-5}:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(im, 0.5 \cdot im, 1\right)\\
\mathbf{elif}\;im \leq 2.3 \cdot 10^{+151}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 9.00000000000000057e-5Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr59.3%
Applied egg-rr59.3%
Taylor expanded in im around 0 82.8%
*-commutative82.8%
associate-*r*82.8%
distribute-rgt1-in82.8%
unpow282.8%
associate-*r*82.8%
*-commutative82.8%
fma-udef82.8%
Simplified82.8%
if 9.00000000000000057e-5 < im < 2.3000000000000001e151Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 75.8%
if 2.3000000000000001e151 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.9%
Simplified96.9%
Taylor expanded in re around 0 96.9%
Taylor expanded in im around inf 96.9%
associate-*r*96.9%
unpow296.9%
Simplified96.9%
Final simplification83.4%
(FPCore (re im)
:precision binary64
(if (<= im 155000000.0)
(* (sin re) (fma im (* 0.5 im) 1.0))
(if (<= im 1.02e+113)
(+ re (* (* im im) (* 0.5 (+ re (* (pow re 3.0) -0.16666666666666666)))))
(if (<= im 2.3e+151) (log1p (expm1 re)) (* (* 0.5 (sin re)) (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 155000000.0) {
tmp = sin(re) * fma(im, (0.5 * im), 1.0);
} else if (im <= 1.02e+113) {
tmp = re + ((im * im) * (0.5 * (re + (pow(re, 3.0) * -0.16666666666666666))));
} else if (im <= 2.3e+151) {
tmp = log1p(expm1(re));
} else {
tmp = (0.5 * sin(re)) * (im * im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 155000000.0) tmp = Float64(sin(re) * fma(im, Float64(0.5 * im), 1.0)); elseif (im <= 1.02e+113) tmp = Float64(re + Float64(Float64(im * im) * Float64(0.5 * Float64(re + Float64((re ^ 3.0) * -0.16666666666666666))))); elseif (im <= 2.3e+151) tmp = log1p(expm1(re)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(im * im)); end return tmp end
code[re_, im_] := If[LessEqual[im, 155000000.0], N[(N[Sin[re], $MachinePrecision] * N[(im * N[(0.5 * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.02e+113], N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.3e+151], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 155000000:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(im, 0.5 \cdot im, 1\right)\\
\mathbf{elif}\;im \leq 1.02 \cdot 10^{+113}:\\
\;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot \left(re + {re}^{3} \cdot -0.16666666666666666\right)\right)\\
\mathbf{elif}\;im \leq 2.3 \cdot 10^{+151}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 1.55e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr58.9%
Applied egg-rr58.9%
Taylor expanded in im around 0 82.1%
*-commutative82.1%
associate-*r*82.1%
distribute-rgt1-in82.1%
unpow282.1%
associate-*r*82.1%
*-commutative82.1%
fma-udef82.1%
Simplified82.1%
if 1.55e8 < im < 1.02000000000000002e113Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.1%
Simplified4.1%
Taylor expanded in re around 0 2.8%
Taylor expanded in re around 0 37.0%
Simplified37.0%
if 1.02000000000000002e113 < im < 2.3000000000000001e151Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Applied egg-rr58.1%
if 2.3000000000000001e151 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.9%
Simplified96.9%
Taylor expanded in re around 0 96.9%
Taylor expanded in im around inf 96.9%
associate-*r*96.9%
unpow296.9%
Simplified96.9%
Final simplification79.0%
(FPCore (re im)
:precision binary64
(if (<= im 9e-5)
(sin re)
(if (<= im 4.3e+113)
(+ re (* (* im im) (* 0.5 (+ re (* (pow re 3.0) -0.16666666666666666)))))
(if (<= im 2.3e+151) (log1p (expm1 re)) (* (* 0.5 (sin re)) (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 9e-5) {
tmp = sin(re);
} else if (im <= 4.3e+113) {
tmp = re + ((im * im) * (0.5 * (re + (pow(re, 3.0) * -0.16666666666666666))));
} else if (im <= 2.3e+151) {
tmp = log1p(expm1(re));
} else {
tmp = (0.5 * sin(re)) * (im * im);
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= 9e-5) {
tmp = Math.sin(re);
} else if (im <= 4.3e+113) {
tmp = re + ((im * im) * (0.5 * (re + (Math.pow(re, 3.0) * -0.16666666666666666))));
} else if (im <= 2.3e+151) {
tmp = Math.log1p(Math.expm1(re));
} else {
tmp = (0.5 * Math.sin(re)) * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9e-5: tmp = math.sin(re) elif im <= 4.3e+113: tmp = re + ((im * im) * (0.5 * (re + (math.pow(re, 3.0) * -0.16666666666666666)))) elif im <= 2.3e+151: tmp = math.log1p(math.expm1(re)) else: tmp = (0.5 * math.sin(re)) * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 9e-5) tmp = sin(re); elseif (im <= 4.3e+113) tmp = Float64(re + Float64(Float64(im * im) * Float64(0.5 * Float64(re + Float64((re ^ 3.0) * -0.16666666666666666))))); elseif (im <= 2.3e+151) tmp = log1p(expm1(re)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(im * im)); end return tmp end
code[re_, im_] := If[LessEqual[im, 9e-5], N[Sin[re], $MachinePrecision], If[LessEqual[im, 4.3e+113], N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.3e+151], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9 \cdot 10^{-5}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4.3 \cdot 10^{+113}:\\
\;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot \left(re + {re}^{3} \cdot -0.16666666666666666\right)\right)\\
\mathbf{elif}\;im \leq 2.3 \cdot 10^{+151}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 9.00000000000000057e-5Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 68.4%
if 9.00000000000000057e-5 < im < 4.3000000000000003e113Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 7.7%
Simplified7.7%
Taylor expanded in re around 0 6.6%
Taylor expanded in re around 0 36.7%
Simplified36.7%
if 4.3000000000000003e113 < im < 2.3000000000000001e151Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Applied egg-rr58.1%
if 2.3000000000000001e151 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.9%
Simplified96.9%
Taylor expanded in re around 0 96.9%
Taylor expanded in im around inf 96.9%
associate-*r*96.9%
unpow296.9%
Simplified96.9%
Final simplification68.0%
(FPCore (re im)
:precision binary64
(if (<= im 9e-5)
(sin re)
(if (<= im 5e+112)
(+ re (* (* im im) (* 0.5 (+ re (* (pow re 3.0) -0.16666666666666666)))))
(if (<= im 2.3e+151)
(* im (* re (* 0.5 im)))
(* (* 0.5 (sin re)) (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 9e-5) {
tmp = sin(re);
} else if (im <= 5e+112) {
tmp = re + ((im * im) * (0.5 * (re + (pow(re, 3.0) * -0.16666666666666666))));
} else if (im <= 2.3e+151) {
tmp = im * (re * (0.5 * im));
} else {
tmp = (0.5 * sin(re)) * (im * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 9d-5) then
tmp = sin(re)
else if (im <= 5d+112) then
tmp = re + ((im * im) * (0.5d0 * (re + ((re ** 3.0d0) * (-0.16666666666666666d0)))))
else if (im <= 2.3d+151) then
tmp = im * (re * (0.5d0 * im))
else
tmp = (0.5d0 * sin(re)) * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9e-5) {
tmp = Math.sin(re);
} else if (im <= 5e+112) {
tmp = re + ((im * im) * (0.5 * (re + (Math.pow(re, 3.0) * -0.16666666666666666))));
} else if (im <= 2.3e+151) {
tmp = im * (re * (0.5 * im));
} else {
tmp = (0.5 * Math.sin(re)) * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9e-5: tmp = math.sin(re) elif im <= 5e+112: tmp = re + ((im * im) * (0.5 * (re + (math.pow(re, 3.0) * -0.16666666666666666)))) elif im <= 2.3e+151: tmp = im * (re * (0.5 * im)) else: tmp = (0.5 * math.sin(re)) * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 9e-5) tmp = sin(re); elseif (im <= 5e+112) tmp = Float64(re + Float64(Float64(im * im) * Float64(0.5 * Float64(re + Float64((re ^ 3.0) * -0.16666666666666666))))); elseif (im <= 2.3e+151) tmp = Float64(im * Float64(re * Float64(0.5 * im))); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9e-5) tmp = sin(re); elseif (im <= 5e+112) tmp = re + ((im * im) * (0.5 * (re + ((re ^ 3.0) * -0.16666666666666666)))); elseif (im <= 2.3e+151) tmp = im * (re * (0.5 * im)); else tmp = (0.5 * sin(re)) * (im * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9e-5], N[Sin[re], $MachinePrecision], If[LessEqual[im, 5e+112], N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.3e+151], N[(im * N[(re * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9 \cdot 10^{-5}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+112}:\\
\;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot \left(re + {re}^{3} \cdot -0.16666666666666666\right)\right)\\
\mathbf{elif}\;im \leq 2.3 \cdot 10^{+151}:\\
\;\;\;\;im \cdot \left(re \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 9.00000000000000057e-5Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 68.4%
if 9.00000000000000057e-5 < im < 5e112Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 7.8%
Simplified7.8%
Taylor expanded in re around 0 6.6%
Taylor expanded in re around 0 38.0%
Simplified38.0%
if 5e112 < im < 2.3000000000000001e151Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.7%
Simplified5.7%
Taylor expanded in re around 0 40.7%
Taylor expanded in im around 0 40.7%
unpow240.7%
Simplified40.7%
Taylor expanded in im around inf 40.7%
*-commutative40.7%
associate-*r*40.7%
*-commutative40.7%
unpow240.7%
associate-*l*40.7%
associate-*l*40.7%
*-commutative40.7%
Simplified40.7%
if 2.3000000000000001e151 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.9%
Simplified96.9%
Taylor expanded in re around 0 96.9%
Taylor expanded in im around inf 96.9%
associate-*r*96.9%
unpow296.9%
Simplified96.9%
Final simplification67.7%
(FPCore (re im)
:precision binary64
(if (<= im 220000000000.0)
(sin re)
(if (<= im 8.2e+96)
(+ re (* (pow re 3.0) -0.16666666666666666))
(if (<= im 2.3e+151)
(* im (* re (* 0.5 im)))
(* (* 0.5 (sin re)) (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 220000000000.0) {
tmp = sin(re);
} else if (im <= 8.2e+96) {
tmp = re + (pow(re, 3.0) * -0.16666666666666666);
} else if (im <= 2.3e+151) {
tmp = im * (re * (0.5 * im));
} else {
tmp = (0.5 * sin(re)) * (im * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 220000000000.0d0) then
tmp = sin(re)
else if (im <= 8.2d+96) then
tmp = re + ((re ** 3.0d0) * (-0.16666666666666666d0))
else if (im <= 2.3d+151) then
tmp = im * (re * (0.5d0 * im))
else
tmp = (0.5d0 * sin(re)) * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 220000000000.0) {
tmp = Math.sin(re);
} else if (im <= 8.2e+96) {
tmp = re + (Math.pow(re, 3.0) * -0.16666666666666666);
} else if (im <= 2.3e+151) {
tmp = im * (re * (0.5 * im));
} else {
tmp = (0.5 * Math.sin(re)) * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 220000000000.0: tmp = math.sin(re) elif im <= 8.2e+96: tmp = re + (math.pow(re, 3.0) * -0.16666666666666666) elif im <= 2.3e+151: tmp = im * (re * (0.5 * im)) else: tmp = (0.5 * math.sin(re)) * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 220000000000.0) tmp = sin(re); elseif (im <= 8.2e+96) tmp = Float64(re + Float64((re ^ 3.0) * -0.16666666666666666)); elseif (im <= 2.3e+151) tmp = Float64(im * Float64(re * Float64(0.5 * im))); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 220000000000.0) tmp = sin(re); elseif (im <= 8.2e+96) tmp = re + ((re ^ 3.0) * -0.16666666666666666); elseif (im <= 2.3e+151) tmp = im * (re * (0.5 * im)); else tmp = (0.5 * sin(re)) * (im * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 220000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 8.2e+96], N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.3e+151], N[(im * N[(re * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 220000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 8.2 \cdot 10^{+96}:\\
\;\;\;\;re + {re}^{3} \cdot -0.16666666666666666\\
\mathbf{elif}\;im \leq 2.3 \cdot 10^{+151}:\\
\;\;\;\;im \cdot \left(re \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 2.2e11Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 67.7%
if 2.2e11 < im < 8.19999999999999996e96Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 2.7%
Taylor expanded in re around 0 39.0%
Simplified39.0%
if 8.19999999999999996e96 < im < 2.3000000000000001e151Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.5%
Simplified5.5%
Taylor expanded in re around 0 31.4%
Taylor expanded in im around 0 31.4%
unpow231.4%
Simplified31.4%
Taylor expanded in im around inf 31.4%
*-commutative31.4%
associate-*r*31.4%
*-commutative31.4%
unpow231.4%
associate-*l*31.4%
associate-*l*31.4%
*-commutative31.4%
Simplified31.4%
if 2.3000000000000001e151 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.9%
Simplified96.9%
Taylor expanded in re around 0 96.9%
Taylor expanded in im around inf 96.9%
associate-*r*96.9%
unpow296.9%
Simplified96.9%
Final simplification67.1%
(FPCore (re im)
:precision binary64
(if (<= im 190000000000.0)
(sin re)
(if (<= im 5.8e+97)
(+ re (* (pow re 3.0) -0.16666666666666666))
(* (* 0.5 re) (* im im)))))
double code(double re, double im) {
double tmp;
if (im <= 190000000000.0) {
tmp = sin(re);
} else if (im <= 5.8e+97) {
tmp = re + (pow(re, 3.0) * -0.16666666666666666);
} else {
tmp = (0.5 * re) * (im * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 190000000000.0d0) then
tmp = sin(re)
else if (im <= 5.8d+97) then
tmp = re + ((re ** 3.0d0) * (-0.16666666666666666d0))
else
tmp = (0.5d0 * re) * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 190000000000.0) {
tmp = Math.sin(re);
} else if (im <= 5.8e+97) {
tmp = re + (Math.pow(re, 3.0) * -0.16666666666666666);
} else {
tmp = (0.5 * re) * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 190000000000.0: tmp = math.sin(re) elif im <= 5.8e+97: tmp = re + (math.pow(re, 3.0) * -0.16666666666666666) else: tmp = (0.5 * re) * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 190000000000.0) tmp = sin(re); elseif (im <= 5.8e+97) tmp = Float64(re + Float64((re ^ 3.0) * -0.16666666666666666)); else tmp = Float64(Float64(0.5 * re) * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 190000000000.0) tmp = sin(re); elseif (im <= 5.8e+97) tmp = re + ((re ^ 3.0) * -0.16666666666666666); else tmp = (0.5 * re) * (im * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 190000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 5.8e+97], N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 190000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 5.8 \cdot 10^{+97}:\\
\;\;\;\;re + {re}^{3} \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 1.9e11Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 67.7%
if 1.9e11 < im < 5.79999999999999974e97Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 2.7%
Taylor expanded in re around 0 39.0%
Simplified39.0%
if 5.79999999999999974e97 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 66.4%
Simplified66.4%
Taylor expanded in re around 0 58.1%
Taylor expanded in im around inf 58.1%
*-commutative58.1%
*-commutative58.1%
associate-*l*58.1%
unpow258.1%
Simplified58.1%
Final simplification64.3%
(FPCore (re im) :precision binary64 (if (<= im 155000000.0) (sin re) (if (<= im 1.6e+104) (pow re -512.0) (* (* 0.5 re) (* im im)))))
double code(double re, double im) {
double tmp;
if (im <= 155000000.0) {
tmp = sin(re);
} else if (im <= 1.6e+104) {
tmp = pow(re, -512.0);
} else {
tmp = (0.5 * re) * (im * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 155000000.0d0) then
tmp = sin(re)
else if (im <= 1.6d+104) then
tmp = re ** (-512.0d0)
else
tmp = (0.5d0 * re) * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 155000000.0) {
tmp = Math.sin(re);
} else if (im <= 1.6e+104) {
tmp = Math.pow(re, -512.0);
} else {
tmp = (0.5 * re) * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 155000000.0: tmp = math.sin(re) elif im <= 1.6e+104: tmp = math.pow(re, -512.0) else: tmp = (0.5 * re) * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 155000000.0) tmp = sin(re); elseif (im <= 1.6e+104) tmp = re ^ -512.0; else tmp = Float64(Float64(0.5 * re) * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 155000000.0) tmp = sin(re); elseif (im <= 1.6e+104) tmp = re ^ -512.0; else tmp = (0.5 * re) * (im * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 155000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.6e+104], N[Power[re, -512.0], $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 155000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.6 \cdot 10^{+104}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 1.55e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 67.7%
if 1.55e8 < im < 1.6e104Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 64.7%
Applied egg-rr24.1%
if 1.6e104 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 67.9%
Simplified67.9%
Taylor expanded in re around 0 59.4%
Taylor expanded in im around inf 59.4%
*-commutative59.4%
*-commutative59.4%
associate-*l*59.4%
unpow259.4%
Simplified59.4%
Final simplification63.5%
(FPCore (re im) :precision binary64 (if (<= im 6.2e-5) (sin re) (* re (+ 1.0 (* 0.5 (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 6.2e-5) {
tmp = sin(re);
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 6.2d-5) then
tmp = sin(re)
else
tmp = re * (1.0d0 + (0.5d0 * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 6.2e-5) {
tmp = Math.sin(re);
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 6.2e-5: tmp = math.sin(re) else: tmp = re * (1.0 + (0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= 6.2e-5) tmp = sin(re); else tmp = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 6.2e-5) tmp = sin(re); else tmp = re * (1.0 + (0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 6.2e-5], N[Sin[re], $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 6.2 \cdot 10^{-5}:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 6.20000000000000027e-5Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 68.4%
if 6.20000000000000027e-5 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 48.4%
Simplified48.4%
Taylor expanded in re around 0 42.3%
Taylor expanded in im around 0 42.3%
unpow242.3%
Simplified42.3%
Taylor expanded in re around 0 42.3%
*-commutative42.3%
unpow242.3%
Simplified42.3%
Final simplification62.2%
(FPCore (re im) :precision binary64 (if (<= re -3.4e+121) (* re re) (* re (+ 1.0 (* 0.5 (* im im))))))
double code(double re, double im) {
double tmp;
if (re <= -3.4e+121) {
tmp = re * re;
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-3.4d+121)) then
tmp = re * re
else
tmp = re * (1.0d0 + (0.5d0 * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -3.4e+121) {
tmp = re * re;
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3.4e+121: tmp = re * re else: tmp = re * (1.0 + (0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (re <= -3.4e+121) tmp = Float64(re * re); else tmp = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -3.4e+121) tmp = re * re; else tmp = re * (1.0 + (0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3.4e+121], N[(re * re), $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -3.4 \cdot 10^{+121}:\\
\;\;\;\;re \cdot re\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if re < -3.4000000000000001e121Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 13.0%
Applied egg-rr2.7%
Applied egg-rr27.0%
if -3.4000000000000001e121 < re Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 73.9%
Simplified73.9%
Taylor expanded in re around 0 49.5%
Taylor expanded in im around 0 49.5%
unpow249.5%
Simplified49.5%
Taylor expanded in re around 0 49.5%
*-commutative49.5%
unpow249.5%
Simplified49.5%
Final simplification45.7%
(FPCore (re im) :precision binary64 (if (<= im 1.45) re (* im (* re (* 0.5 im)))))
double code(double re, double im) {
double tmp;
if (im <= 1.45) {
tmp = re;
} else {
tmp = im * (re * (0.5 * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.45d0) then
tmp = re
else
tmp = im * (re * (0.5d0 * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.45) {
tmp = re;
} else {
tmp = im * (re * (0.5 * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.45: tmp = re else: tmp = im * (re * (0.5 * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.45) tmp = re; else tmp = Float64(im * Float64(re * Float64(0.5 * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.45) tmp = re; else tmp = im * (re * (0.5 * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.45], re, N[(im * N[(re * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.45:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(re \cdot \left(0.5 \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 1.44999999999999996Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 53.8%
Taylor expanded in im around 0 30.9%
if 1.44999999999999996 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 47.6%
Simplified47.6%
Taylor expanded in re around 0 41.3%
Taylor expanded in im around 0 41.3%
unpow241.3%
Simplified41.3%
Taylor expanded in im around inf 41.3%
*-commutative41.3%
associate-*r*41.3%
*-commutative41.3%
unpow241.3%
associate-*l*41.3%
associate-*l*32.0%
*-commutative32.0%
Simplified32.0%
Final simplification31.2%
(FPCore (re im) :precision binary64 (if (<= im 1.45) re (* (* 0.5 re) (* im im))))
double code(double re, double im) {
double tmp;
if (im <= 1.45) {
tmp = re;
} else {
tmp = (0.5 * re) * (im * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.45d0) then
tmp = re
else
tmp = (0.5d0 * re) * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.45) {
tmp = re;
} else {
tmp = (0.5 * re) * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.45: tmp = re else: tmp = (0.5 * re) * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.45) tmp = re; else tmp = Float64(Float64(0.5 * re) * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.45) tmp = re; else tmp = (0.5 * re) * (im * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.45], re, N[(N[(0.5 * re), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.45:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 1.44999999999999996Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 53.8%
Taylor expanded in im around 0 30.9%
if 1.44999999999999996 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 47.6%
Simplified47.6%
Taylor expanded in re around 0 41.3%
Taylor expanded in im around inf 41.3%
*-commutative41.3%
*-commutative41.3%
associate-*l*41.3%
unpow241.3%
Simplified41.3%
Final simplification33.4%
(FPCore (re im) :precision binary64 (if (<= im 2.35e+19) re (* re re)))
double code(double re, double im) {
double tmp;
if (im <= 2.35e+19) {
tmp = re;
} else {
tmp = re * re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2.35d+19) then
tmp = re
else
tmp = re * re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.35e+19) {
tmp = re;
} else {
tmp = re * re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.35e+19: tmp = re else: tmp = re * re return tmp
function code(re, im) tmp = 0.0 if (im <= 2.35e+19) tmp = re; else tmp = Float64(re * re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.35e+19) tmp = re; else tmp = re * re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.35e+19], re, N[(re * re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.35 \cdot 10^{+19}:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;re \cdot re\\
\end{array}
\end{array}
if im < 2.35e19Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 54.4%
Taylor expanded in im around 0 30.2%
if 2.35e19 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 72.7%
Applied egg-rr2.3%
Applied egg-rr12.5%
Final simplification26.4%
(FPCore (re im) :precision binary64 re)
double code(double re, double im) {
return re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re
end function
public static double code(double re, double im) {
return re;
}
def code(re, im): return re
function code(re, im) return re end
function tmp = code(re, im) tmp = re; end
code[re_, im_] := re
\begin{array}{l}
\\
re
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 58.3%
Taylor expanded in im around 0 24.2%
Final simplification24.2%
herbie shell --seed 2023201
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))