
(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 20 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%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (log1p (expm1 (* re -0.16666666666666666))))
(t_1 (* 0.041666666666666664 (* re (pow im 4.0)))))
(if (<= im 2.6e-15)
(sin re)
(if (<= im 3.3e+19)
(log1p (expm1 re))
(if (<= im 3.3e+61)
t_0
(if (<= im 2.7e+208)
t_1
(if (<= im 1.58e+227)
(* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0))))
(if (<= im 6.5e+239)
t_1
(if (or (<= im 6.6e+252) (not (<= im 6.6e+273)))
t_0
(* (fma im im 2.0) (* 0.5 re)))))))))))
double code(double re, double im) {
double t_0 = log1p(expm1((re * -0.16666666666666666)));
double t_1 = 0.041666666666666664 * (re * pow(im, 4.0));
double tmp;
if (im <= 2.6e-15) {
tmp = sin(re);
} else if (im <= 3.3e+19) {
tmp = log1p(expm1(re));
} else if (im <= 3.3e+61) {
tmp = t_0;
} else if (im <= 2.7e+208) {
tmp = t_1;
} else if (im <= 1.58e+227) {
tmp = re * (1.0 + (-0.16666666666666666 * pow(re, 2.0)));
} else if (im <= 6.5e+239) {
tmp = t_1;
} else if ((im <= 6.6e+252) || !(im <= 6.6e+273)) {
tmp = t_0;
} else {
tmp = fma(im, im, 2.0) * (0.5 * re);
}
return tmp;
}
function code(re, im) t_0 = log1p(expm1(Float64(re * -0.16666666666666666))) t_1 = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))) tmp = 0.0 if (im <= 2.6e-15) tmp = sin(re); elseif (im <= 3.3e+19) tmp = log1p(expm1(re)); elseif (im <= 3.3e+61) tmp = t_0; elseif (im <= 2.7e+208) tmp = t_1; elseif (im <= 1.58e+227) tmp = Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))); elseif (im <= 6.5e+239) tmp = t_1; elseif ((im <= 6.6e+252) || !(im <= 6.6e+273)) tmp = t_0; else tmp = Float64(fma(im, im, 2.0) * Float64(0.5 * re)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[Log[1 + N[(Exp[N[(re * -0.16666666666666666), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 2.6e-15], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.3e+19], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 3.3e+61], t$95$0, If[LessEqual[im, 2.7e+208], t$95$1, If[LessEqual[im, 1.58e+227], N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5e+239], t$95$1, If[Or[LessEqual[im, 6.6e+252], N[Not[LessEqual[im, 6.6e+273]], $MachinePrecision]], t$95$0, N[(N[(im * im + 2.0), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot -0.16666666666666666\right)\right)\\
t_1 := 0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{if}\;im \leq 2.6 \cdot 10^{-15}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3.3 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\
\mathbf{elif}\;im \leq 3.3 \cdot 10^{+61}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 2.7 \cdot 10^{+208}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;im \leq 1.58 \cdot 10^{+227}:\\
\;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+239}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;im \leq 6.6 \cdot 10^{+252} \lor \neg \left(im \leq 6.6 \cdot 10^{+273}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < 2.60000000000000004e-15Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.7%
if 2.60000000000000004e-15 < im < 3.3e19Initial program 99.8%
distribute-rgt-in99.8%
cancel-sign-sub99.8%
distribute-rgt-out--99.8%
sub-neg99.8%
remove-double-neg99.8%
neg-sub099.8%
Simplified99.8%
Taylor expanded in re around 0 72.4%
Applied egg-rr44.3%
if 3.3e19 < im < 3.2999999999999998e61 or 6.5e239 < im < 6.6000000000000002e252 or 6.59999999999999971e273 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.9%
Taylor expanded in re around 0 54.7%
+-commutative54.7%
distribute-rgt-in54.7%
*-lft-identity54.7%
associate-*l*54.7%
fma-define54.7%
pow-plus54.7%
metadata-eval54.7%
Simplified54.7%
Taylor expanded in re around inf 54.3%
Applied egg-rr65.0%
if 3.2999999999999998e61 < im < 2.7e208 or 1.57999999999999994e227 < im < 6.5e239Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 88.3%
+-commutative88.3%
fma-define88.3%
associate-*r*88.3%
distribute-rgt-out88.3%
+-commutative88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in im around inf 97.2%
Taylor expanded in re around 0 69.0%
if 2.7e208 < im < 1.57999999999999994e227Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.7%
Taylor expanded in re around 0 60.9%
*-commutative60.9%
Simplified60.9%
if 6.6000000000000002e252 < im < 6.59999999999999971e273Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
unpow2100.0%
fma-define100.0%
Simplified100.0%
Final simplification62.5%
(FPCore (re im)
:precision binary64
(if (<= im 0.2)
(* (* 0.5 (sin re)) (fma im im 2.0))
(if (<= im 2.75e+26)
(log1p (expm1 re))
(if (<= im 1.15e+62)
(log1p (expm1 (* re -0.16666666666666666)))
(* 0.041666666666666664 (* (sin re) (pow im 4.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 0.2) {
tmp = (0.5 * sin(re)) * fma(im, im, 2.0);
} else if (im <= 2.75e+26) {
tmp = log1p(expm1(re));
} else if (im <= 1.15e+62) {
tmp = log1p(expm1((re * -0.16666666666666666)));
} else {
tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 0.2) tmp = Float64(Float64(0.5 * sin(re)) * fma(im, im, 2.0)); elseif (im <= 2.75e+26) tmp = log1p(expm1(re)); elseif (im <= 1.15e+62) tmp = log1p(expm1(Float64(re * -0.16666666666666666))); else tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0))); end return tmp end
code[re_, im_] := If[LessEqual[im, 0.2], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.75e+26], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.15e+62], N[Log[1 + N[(Exp[N[(re * -0.16666666666666666), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.2:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\
\mathbf{elif}\;im \leq 2.75 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 0.20000000000000001Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 85.9%
+-commutative85.9%
unpow285.9%
fma-define85.9%
Simplified85.9%
if 0.20000000000000001 < im < 2.7499999999999998e26Initial program 99.7%
distribute-rgt-in99.7%
cancel-sign-sub99.7%
distribute-rgt-out--99.7%
sub-neg99.7%
remove-double-neg99.7%
neg-sub099.7%
Simplified99.7%
Taylor expanded in re around 0 81.1%
Applied egg-rr41.9%
if 2.7499999999999998e26 < im < 1.14999999999999992e62Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.8%
Taylor expanded in re around 0 41.5%
+-commutative41.5%
distribute-rgt-in41.5%
*-lft-identity41.5%
associate-*l*41.5%
fma-define41.5%
pow-plus41.5%
metadata-eval41.5%
Simplified41.5%
Taylor expanded in re around inf 41.0%
Applied egg-rr50.5%
if 1.14999999999999992e62 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 92.5%
+-commutative92.5%
fma-define92.5%
associate-*r*92.5%
distribute-rgt-out92.5%
+-commutative92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in im around inf 98.2%
Final simplification86.0%
(FPCore (re im)
:precision binary64
(if (<= im 2.6e-15)
(sin re)
(if (<= im 1.1e+21)
(log1p (expm1 re))
(if (<= im 1.15e+62)
(log1p (expm1 (* re -0.16666666666666666)))
(* 0.041666666666666664 (* (sin re) (pow im 4.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 2.6e-15) {
tmp = sin(re);
} else if (im <= 1.1e+21) {
tmp = log1p(expm1(re));
} else if (im <= 1.15e+62) {
tmp = log1p(expm1((re * -0.16666666666666666)));
} else {
tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.0));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= 2.6e-15) {
tmp = Math.sin(re);
} else if (im <= 1.1e+21) {
tmp = Math.log1p(Math.expm1(re));
} else if (im <= 1.15e+62) {
tmp = Math.log1p(Math.expm1((re * -0.16666666666666666)));
} else {
tmp = 0.041666666666666664 * (Math.sin(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.6e-15: tmp = math.sin(re) elif im <= 1.1e+21: tmp = math.log1p(math.expm1(re)) elif im <= 1.15e+62: tmp = math.log1p(math.expm1((re * -0.16666666666666666))) else: tmp = 0.041666666666666664 * (math.sin(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.6e-15) tmp = sin(re); elseif (im <= 1.1e+21) tmp = log1p(expm1(re)); elseif (im <= 1.15e+62) tmp = log1p(expm1(Float64(re * -0.16666666666666666))); else tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0))); end return tmp end
code[re_, im_] := If[LessEqual[im, 2.6e-15], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.1e+21], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.15e+62], N[Log[1 + N[(Exp[N[(re * -0.16666666666666666), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.6 \cdot 10^{-15}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 2.60000000000000004e-15Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.7%
if 2.60000000000000004e-15 < im < 1.1e21Initial program 99.8%
distribute-rgt-in99.8%
cancel-sign-sub99.8%
distribute-rgt-out--99.8%
sub-neg99.8%
remove-double-neg99.8%
neg-sub099.8%
Simplified99.8%
Taylor expanded in re around 0 72.4%
Applied egg-rr44.3%
if 1.1e21 < im < 1.14999999999999992e62Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.8%
Taylor expanded in re around 0 41.5%
+-commutative41.5%
distribute-rgt-in41.5%
*-lft-identity41.5%
associate-*l*41.5%
fma-define41.5%
pow-plus41.5%
metadata-eval41.5%
Simplified41.5%
Taylor expanded in re around inf 41.0%
Applied egg-rr50.5%
if 1.14999999999999992e62 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 92.5%
+-commutative92.5%
fma-define92.5%
associate-*r*92.5%
distribute-rgt-out92.5%
+-commutative92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in im around inf 98.2%
Final simplification67.2%
(FPCore (re im)
:precision binary64
(if (<= im 0.102)
(* (* 0.5 (sin re)) (fma im im 2.0))
(if (<= im 4.2e+66)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(* 0.041666666666666664 (* (sin re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 0.102) {
tmp = (0.5 * sin(re)) * fma(im, im, 2.0);
} else if (im <= 4.2e+66) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 0.102) tmp = Float64(Float64(0.5 * sin(re)) * fma(im, im, 2.0)); elseif (im <= 4.2e+66) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0))); end return tmp end
code[re_, im_] := If[LessEqual[im, 0.102], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.2e+66], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.102:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+66}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 0.101999999999999993Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 85.9%
+-commutative85.9%
unpow285.9%
fma-define85.9%
Simplified85.9%
if 0.101999999999999993 < im < 4.20000000000000011e66Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 60.4%
if 4.20000000000000011e66 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 92.5%
+-commutative92.5%
fma-define92.5%
associate-*r*92.5%
distribute-rgt-out92.5%
+-commutative92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in im around inf 98.2%
Final simplification86.8%
(FPCore (re im)
:precision binary64
(if (<= im 2.6e-15)
(sin re)
(if (<= im 1.9e+19)
(log1p (expm1 re))
(if (<= im 2.45e+67)
(pow re -4.0)
(if (<= im 2.3e+208)
(* 0.041666666666666664 (* re (pow im 4.0)))
(if (<= im 1.58e+227)
(* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0))))
(* 0.5 (* re (pow im 2.0)))))))))
double code(double re, double im) {
double tmp;
if (im <= 2.6e-15) {
tmp = sin(re);
} else if (im <= 1.9e+19) {
tmp = log1p(expm1(re));
} else if (im <= 2.45e+67) {
tmp = pow(re, -4.0);
} else if (im <= 2.3e+208) {
tmp = 0.041666666666666664 * (re * pow(im, 4.0));
} else if (im <= 1.58e+227) {
tmp = re * (1.0 + (-0.16666666666666666 * pow(re, 2.0)));
} else {
tmp = 0.5 * (re * pow(im, 2.0));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= 2.6e-15) {
tmp = Math.sin(re);
} else if (im <= 1.9e+19) {
tmp = Math.log1p(Math.expm1(re));
} else if (im <= 2.45e+67) {
tmp = Math.pow(re, -4.0);
} else if (im <= 2.3e+208) {
tmp = 0.041666666666666664 * (re * Math.pow(im, 4.0));
} else if (im <= 1.58e+227) {
tmp = re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0)));
} else {
tmp = 0.5 * (re * Math.pow(im, 2.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.6e-15: tmp = math.sin(re) elif im <= 1.9e+19: tmp = math.log1p(math.expm1(re)) elif im <= 2.45e+67: tmp = math.pow(re, -4.0) elif im <= 2.3e+208: tmp = 0.041666666666666664 * (re * math.pow(im, 4.0)) elif im <= 1.58e+227: tmp = re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0))) else: tmp = 0.5 * (re * math.pow(im, 2.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.6e-15) tmp = sin(re); elseif (im <= 1.9e+19) tmp = log1p(expm1(re)); elseif (im <= 2.45e+67) tmp = re ^ -4.0; elseif (im <= 2.3e+208) tmp = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))); elseif (im <= 1.58e+227) tmp = Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))); else tmp = Float64(0.5 * Float64(re * (im ^ 2.0))); end return tmp end
code[re_, im_] := If[LessEqual[im, 2.6e-15], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.9e+19], N[Log[1 + N[(Exp[re] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 2.45e+67], N[Power[re, -4.0], $MachinePrecision], If[LessEqual[im, 2.3e+208], N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.58e+227], N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.6 \cdot 10^{-15}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re\right)\right)\\
\mathbf{elif}\;im \leq 2.45 \cdot 10^{+67}:\\
\;\;\;\;{re}^{-4}\\
\mathbf{elif}\;im \leq 2.3 \cdot 10^{+208}:\\
\;\;\;\;0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq 1.58 \cdot 10^{+227}:\\
\;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot {im}^{2}\right)\\
\end{array}
\end{array}
if im < 2.60000000000000004e-15Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.7%
if 2.60000000000000004e-15 < im < 1.9e19Initial program 99.8%
distribute-rgt-in99.8%
cancel-sign-sub99.8%
distribute-rgt-out--99.8%
sub-neg99.8%
remove-double-neg99.8%
neg-sub099.8%
Simplified99.8%
Taylor expanded in re around 0 72.4%
Applied egg-rr44.3%
if 1.9e19 < im < 2.44999999999999995e67Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 50.0%
Applied egg-rr21.5%
if 2.44999999999999995e67 < im < 2.3e208Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 86.6%
+-commutative86.6%
fma-define86.6%
associate-*r*86.6%
distribute-rgt-out86.6%
+-commutative86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in im around inf 96.7%
Taylor expanded in re around 0 64.6%
if 2.3e208 < im < 1.57999999999999994e227Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.7%
Taylor expanded in re around 0 60.9%
*-commutative60.9%
Simplified60.9%
if 1.57999999999999994e227 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 64.7%
Taylor expanded in im around 0 64.7%
+-commutative100.0%
unpow2100.0%
fma-define100.0%
Simplified64.7%
Taylor expanded in im around inf 64.7%
Final simplification59.4%
(FPCore (re im)
:precision binary64
(if (<= im 0.056)
(sin re)
(if (<= im 3.1e+83)
(pow re -4.0)
(if (<= im 9e+109)
(pow re 6.0)
(if (or (<= im 9.6e+144)
(and (not (<= im 4.5e+158))
(or (<= im 6.8e+198)
(and (not (<= im 1.72e+227)) (<= im 1.85e+239)))))
(pow re -4.0)
(* -0.16666666666666666 (pow re 3.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = sin(re);
} else if (im <= 3.1e+83) {
tmp = pow(re, -4.0);
} else if (im <= 9e+109) {
tmp = pow(re, 6.0);
} else if ((im <= 9.6e+144) || (!(im <= 4.5e+158) && ((im <= 6.8e+198) || (!(im <= 1.72e+227) && (im <= 1.85e+239))))) {
tmp = pow(re, -4.0);
} else {
tmp = -0.16666666666666666 * pow(re, 3.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.056d0) then
tmp = sin(re)
else if (im <= 3.1d+83) then
tmp = re ** (-4.0d0)
else if (im <= 9d+109) then
tmp = re ** 6.0d0
else if ((im <= 9.6d+144) .or. (.not. (im <= 4.5d+158)) .and. (im <= 6.8d+198) .or. (.not. (im <= 1.72d+227)) .and. (im <= 1.85d+239)) then
tmp = re ** (-4.0d0)
else
tmp = (-0.16666666666666666d0) * (re ** 3.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = Math.sin(re);
} else if (im <= 3.1e+83) {
tmp = Math.pow(re, -4.0);
} else if (im <= 9e+109) {
tmp = Math.pow(re, 6.0);
} else if ((im <= 9.6e+144) || (!(im <= 4.5e+158) && ((im <= 6.8e+198) || (!(im <= 1.72e+227) && (im <= 1.85e+239))))) {
tmp = Math.pow(re, -4.0);
} else {
tmp = -0.16666666666666666 * Math.pow(re, 3.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.056: tmp = math.sin(re) elif im <= 3.1e+83: tmp = math.pow(re, -4.0) elif im <= 9e+109: tmp = math.pow(re, 6.0) elif (im <= 9.6e+144) or (not (im <= 4.5e+158) and ((im <= 6.8e+198) or (not (im <= 1.72e+227) and (im <= 1.85e+239)))): tmp = math.pow(re, -4.0) else: tmp = -0.16666666666666666 * math.pow(re, 3.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.056) tmp = sin(re); elseif (im <= 3.1e+83) tmp = re ^ -4.0; elseif (im <= 9e+109) tmp = re ^ 6.0; elseif ((im <= 9.6e+144) || (!(im <= 4.5e+158) && ((im <= 6.8e+198) || (!(im <= 1.72e+227) && (im <= 1.85e+239))))) tmp = re ^ -4.0; else tmp = Float64(-0.16666666666666666 * (re ^ 3.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.056) tmp = sin(re); elseif (im <= 3.1e+83) tmp = re ^ -4.0; elseif (im <= 9e+109) tmp = re ^ 6.0; elseif ((im <= 9.6e+144) || (~((im <= 4.5e+158)) && ((im <= 6.8e+198) || (~((im <= 1.72e+227)) && (im <= 1.85e+239))))) tmp = re ^ -4.0; else tmp = -0.16666666666666666 * (re ^ 3.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.056], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.1e+83], N[Power[re, -4.0], $MachinePrecision], If[LessEqual[im, 9e+109], N[Power[re, 6.0], $MachinePrecision], If[Or[LessEqual[im, 9.6e+144], And[N[Not[LessEqual[im, 4.5e+158]], $MachinePrecision], Or[LessEqual[im, 6.8e+198], And[N[Not[LessEqual[im, 1.72e+227]], $MachinePrecision], LessEqual[im, 1.85e+239]]]]], N[Power[re, -4.0], $MachinePrecision], N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.056:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3.1 \cdot 10^{+83}:\\
\;\;\;\;{re}^{-4}\\
\mathbf{elif}\;im \leq 9 \cdot 10^{+109}:\\
\;\;\;\;{re}^{6}\\
\mathbf{elif}\;im \leq 9.6 \cdot 10^{+144} \lor \neg \left(im \leq 4.5 \cdot 10^{+158}\right) \land \left(im \leq 6.8 \cdot 10^{+198} \lor \neg \left(im \leq 1.72 \cdot 10^{+227}\right) \land im \leq 1.85 \cdot 10^{+239}\right):\\
\;\;\;\;{re}^{-4}\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\
\end{array}
\end{array}
if im < 0.0560000000000000012Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.9%
if 0.0560000000000000012 < im < 3.09999999999999992e83 or 8.9999999999999992e109 < im < 9.6000000000000002e144 or 4.50000000000000046e158 < im < 6.8000000000000001e198 or 1.71999999999999995e227 < im < 1.84999999999999999e239Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 69.6%
Applied egg-rr31.6%
if 3.09999999999999992e83 < im < 8.9999999999999992e109Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
Applied egg-rr0.0%
Applied egg-rr50.0%
if 9.6000000000000002e144 < im < 4.50000000000000046e158 or 6.8000000000000001e198 < im < 1.71999999999999995e227 or 1.84999999999999999e239 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.8%
Taylor expanded in re around 0 40.6%
+-commutative40.6%
distribute-rgt-in40.6%
*-lft-identity40.6%
associate-*l*40.6%
fma-define40.6%
pow-plus40.6%
metadata-eval40.6%
Simplified40.6%
Taylor expanded in re around inf 40.3%
Final simplification54.5%
(FPCore (re im)
:precision binary64
(if (<= im 0.056)
(sin re)
(if (<= im 1.7e+49)
(pow re -4.0)
(if (<= im 2.7e+208)
(* 0.041666666666666664 (* re (pow im 4.0)))
(if (<= im 1.58e+227)
(* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0))))
(* 0.5 (* re (pow im 2.0))))))))
double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = sin(re);
} else if (im <= 1.7e+49) {
tmp = pow(re, -4.0);
} else if (im <= 2.7e+208) {
tmp = 0.041666666666666664 * (re * pow(im, 4.0));
} else if (im <= 1.58e+227) {
tmp = re * (1.0 + (-0.16666666666666666 * pow(re, 2.0)));
} else {
tmp = 0.5 * (re * pow(im, 2.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.056d0) then
tmp = sin(re)
else if (im <= 1.7d+49) then
tmp = re ** (-4.0d0)
else if (im <= 2.7d+208) then
tmp = 0.041666666666666664d0 * (re * (im ** 4.0d0))
else if (im <= 1.58d+227) then
tmp = re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0)))
else
tmp = 0.5d0 * (re * (im ** 2.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = Math.sin(re);
} else if (im <= 1.7e+49) {
tmp = Math.pow(re, -4.0);
} else if (im <= 2.7e+208) {
tmp = 0.041666666666666664 * (re * Math.pow(im, 4.0));
} else if (im <= 1.58e+227) {
tmp = re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0)));
} else {
tmp = 0.5 * (re * Math.pow(im, 2.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.056: tmp = math.sin(re) elif im <= 1.7e+49: tmp = math.pow(re, -4.0) elif im <= 2.7e+208: tmp = 0.041666666666666664 * (re * math.pow(im, 4.0)) elif im <= 1.58e+227: tmp = re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0))) else: tmp = 0.5 * (re * math.pow(im, 2.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.056) tmp = sin(re); elseif (im <= 1.7e+49) tmp = re ^ -4.0; elseif (im <= 2.7e+208) tmp = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))); elseif (im <= 1.58e+227) tmp = Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))); else tmp = Float64(0.5 * Float64(re * (im ^ 2.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.056) tmp = sin(re); elseif (im <= 1.7e+49) tmp = re ^ -4.0; elseif (im <= 2.7e+208) tmp = 0.041666666666666664 * (re * (im ^ 4.0)); elseif (im <= 1.58e+227) tmp = re * (1.0 + (-0.16666666666666666 * (re ^ 2.0))); else tmp = 0.5 * (re * (im ^ 2.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.056], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.7e+49], N[Power[re, -4.0], $MachinePrecision], If[LessEqual[im, 2.7e+208], N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.58e+227], N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.056:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+49}:\\
\;\;\;\;{re}^{-4}\\
\mathbf{elif}\;im \leq 2.7 \cdot 10^{+208}:\\
\;\;\;\;0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq 1.58 \cdot 10^{+227}:\\
\;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot {im}^{2}\right)\\
\end{array}
\end{array}
if im < 0.0560000000000000012Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.9%
if 0.0560000000000000012 < im < 1.7e49Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 58.9%
Applied egg-rr26.7%
if 1.7e49 < im < 2.7e208Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 76.4%
+-commutative76.4%
fma-define76.4%
associate-*r*76.4%
distribute-rgt-out76.4%
+-commutative76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in im around inf 85.3%
Taylor expanded in re around 0 56.8%
if 2.7e208 < im < 1.57999999999999994e227Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.7%
Taylor expanded in re around 0 60.9%
*-commutative60.9%
Simplified60.9%
if 1.57999999999999994e227 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 64.7%
Taylor expanded in im around 0 64.7%
+-commutative100.0%
unpow2100.0%
fma-define100.0%
Simplified64.7%
Taylor expanded in im around inf 64.7%
Final simplification59.1%
(FPCore (re im)
:precision binary64
(if (<= im 0.056)
(sin re)
(if (<= im 1.7e+49)
(pow re -4.0)
(if (or (<= im 2.7e+208) (not (<= im 1.58e+227)))
(* 0.041666666666666664 (* re (pow im 4.0)))
(* -0.16666666666666666 (pow re 3.0))))))
double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = sin(re);
} else if (im <= 1.7e+49) {
tmp = pow(re, -4.0);
} else if ((im <= 2.7e+208) || !(im <= 1.58e+227)) {
tmp = 0.041666666666666664 * (re * pow(im, 4.0));
} else {
tmp = -0.16666666666666666 * pow(re, 3.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.056d0) then
tmp = sin(re)
else if (im <= 1.7d+49) then
tmp = re ** (-4.0d0)
else if ((im <= 2.7d+208) .or. (.not. (im <= 1.58d+227))) then
tmp = 0.041666666666666664d0 * (re * (im ** 4.0d0))
else
tmp = (-0.16666666666666666d0) * (re ** 3.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = Math.sin(re);
} else if (im <= 1.7e+49) {
tmp = Math.pow(re, -4.0);
} else if ((im <= 2.7e+208) || !(im <= 1.58e+227)) {
tmp = 0.041666666666666664 * (re * Math.pow(im, 4.0));
} else {
tmp = -0.16666666666666666 * Math.pow(re, 3.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.056: tmp = math.sin(re) elif im <= 1.7e+49: tmp = math.pow(re, -4.0) elif (im <= 2.7e+208) or not (im <= 1.58e+227): tmp = 0.041666666666666664 * (re * math.pow(im, 4.0)) else: tmp = -0.16666666666666666 * math.pow(re, 3.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.056) tmp = sin(re); elseif (im <= 1.7e+49) tmp = re ^ -4.0; elseif ((im <= 2.7e+208) || !(im <= 1.58e+227)) tmp = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))); else tmp = Float64(-0.16666666666666666 * (re ^ 3.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.056) tmp = sin(re); elseif (im <= 1.7e+49) tmp = re ^ -4.0; elseif ((im <= 2.7e+208) || ~((im <= 1.58e+227))) tmp = 0.041666666666666664 * (re * (im ^ 4.0)); else tmp = -0.16666666666666666 * (re ^ 3.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.056], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.7e+49], N[Power[re, -4.0], $MachinePrecision], If[Or[LessEqual[im, 2.7e+208], N[Not[LessEqual[im, 1.58e+227]], $MachinePrecision]], N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.056:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+49}:\\
\;\;\;\;{re}^{-4}\\
\mathbf{elif}\;im \leq 2.7 \cdot 10^{+208} \lor \neg \left(im \leq 1.58 \cdot 10^{+227}\right):\\
\;\;\;\;0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\
\end{array}
\end{array}
if im < 0.0560000000000000012Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.9%
if 0.0560000000000000012 < im < 1.7e49Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 58.9%
Applied egg-rr26.7%
if 1.7e49 < im < 2.7e208 or 1.57999999999999994e227 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 84.6%
+-commutative84.6%
fma-define84.6%
associate-*r*84.6%
distribute-rgt-out84.6%
+-commutative84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in im around inf 90.4%
Taylor expanded in re around 0 59.5%
if 2.7e208 < im < 1.57999999999999994e227Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.7%
Taylor expanded in re around 0 60.9%
+-commutative60.9%
distribute-rgt-in60.9%
*-lft-identity60.9%
associate-*l*60.9%
fma-define60.9%
pow-plus60.9%
metadata-eval60.9%
Simplified60.9%
Taylor expanded in re around inf 60.6%
Final simplification59.1%
(FPCore (re im)
:precision binary64
(if (<= im 0.056)
(sin re)
(if (<= im 1.7e+49)
(pow re -4.0)
(if (<= im 2.7e+208)
(* 0.041666666666666664 (* re (pow im 4.0)))
(if (<= im 1.58e+227)
(* -0.16666666666666666 (pow re 3.0))
(* 0.5 (* re (pow im 2.0))))))))
double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = sin(re);
} else if (im <= 1.7e+49) {
tmp = pow(re, -4.0);
} else if (im <= 2.7e+208) {
tmp = 0.041666666666666664 * (re * pow(im, 4.0));
} else if (im <= 1.58e+227) {
tmp = -0.16666666666666666 * pow(re, 3.0);
} else {
tmp = 0.5 * (re * pow(im, 2.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.056d0) then
tmp = sin(re)
else if (im <= 1.7d+49) then
tmp = re ** (-4.0d0)
else if (im <= 2.7d+208) then
tmp = 0.041666666666666664d0 * (re * (im ** 4.0d0))
else if (im <= 1.58d+227) then
tmp = (-0.16666666666666666d0) * (re ** 3.0d0)
else
tmp = 0.5d0 * (re * (im ** 2.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = Math.sin(re);
} else if (im <= 1.7e+49) {
tmp = Math.pow(re, -4.0);
} else if (im <= 2.7e+208) {
tmp = 0.041666666666666664 * (re * Math.pow(im, 4.0));
} else if (im <= 1.58e+227) {
tmp = -0.16666666666666666 * Math.pow(re, 3.0);
} else {
tmp = 0.5 * (re * Math.pow(im, 2.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.056: tmp = math.sin(re) elif im <= 1.7e+49: tmp = math.pow(re, -4.0) elif im <= 2.7e+208: tmp = 0.041666666666666664 * (re * math.pow(im, 4.0)) elif im <= 1.58e+227: tmp = -0.16666666666666666 * math.pow(re, 3.0) else: tmp = 0.5 * (re * math.pow(im, 2.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.056) tmp = sin(re); elseif (im <= 1.7e+49) tmp = re ^ -4.0; elseif (im <= 2.7e+208) tmp = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))); elseif (im <= 1.58e+227) tmp = Float64(-0.16666666666666666 * (re ^ 3.0)); else tmp = Float64(0.5 * Float64(re * (im ^ 2.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.056) tmp = sin(re); elseif (im <= 1.7e+49) tmp = re ^ -4.0; elseif (im <= 2.7e+208) tmp = 0.041666666666666664 * (re * (im ^ 4.0)); elseif (im <= 1.58e+227) tmp = -0.16666666666666666 * (re ^ 3.0); else tmp = 0.5 * (re * (im ^ 2.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.056], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.7e+49], N[Power[re, -4.0], $MachinePrecision], If[LessEqual[im, 2.7e+208], N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.58e+227], N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.056:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+49}:\\
\;\;\;\;{re}^{-4}\\
\mathbf{elif}\;im \leq 2.7 \cdot 10^{+208}:\\
\;\;\;\;0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq 1.58 \cdot 10^{+227}:\\
\;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot {im}^{2}\right)\\
\end{array}
\end{array}
if im < 0.0560000000000000012Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.9%
if 0.0560000000000000012 < im < 1.7e49Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 58.9%
Applied egg-rr26.7%
if 1.7e49 < im < 2.7e208Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 76.4%
+-commutative76.4%
fma-define76.4%
associate-*r*76.4%
distribute-rgt-out76.4%
+-commutative76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in im around inf 85.3%
Taylor expanded in re around 0 56.8%
if 2.7e208 < im < 1.57999999999999994e227Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 2.7%
Taylor expanded in re around 0 60.9%
+-commutative60.9%
distribute-rgt-in60.9%
*-lft-identity60.9%
associate-*l*60.9%
fma-define60.9%
pow-plus60.9%
metadata-eval60.9%
Simplified60.9%
Taylor expanded in re around inf 60.6%
if 1.57999999999999994e227 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 64.7%
Taylor expanded in im around 0 64.7%
+-commutative100.0%
unpow2100.0%
fma-define100.0%
Simplified64.7%
Taylor expanded in im around inf 64.7%
Final simplification59.1%
(FPCore (re im) :precision binary64 (if (<= im 0.056) (sin re) (if (or (<= im 3.6e+83) (not (<= im 5e+108))) (pow re -4.0) (pow re 6.0))))
double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = sin(re);
} else if ((im <= 3.6e+83) || !(im <= 5e+108)) {
tmp = pow(re, -4.0);
} else {
tmp = pow(re, 6.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.056d0) then
tmp = sin(re)
else if ((im <= 3.6d+83) .or. (.not. (im <= 5d+108))) then
tmp = re ** (-4.0d0)
else
tmp = re ** 6.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = Math.sin(re);
} else if ((im <= 3.6e+83) || !(im <= 5e+108)) {
tmp = Math.pow(re, -4.0);
} else {
tmp = Math.pow(re, 6.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.056: tmp = math.sin(re) elif (im <= 3.6e+83) or not (im <= 5e+108): tmp = math.pow(re, -4.0) else: tmp = math.pow(re, 6.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.056) tmp = sin(re); elseif ((im <= 3.6e+83) || !(im <= 5e+108)) tmp = re ^ -4.0; else tmp = re ^ 6.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.056) tmp = sin(re); elseif ((im <= 3.6e+83) || ~((im <= 5e+108))) tmp = re ^ -4.0; else tmp = re ^ 6.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.056], N[Sin[re], $MachinePrecision], If[Or[LessEqual[im, 3.6e+83], N[Not[LessEqual[im, 5e+108]], $MachinePrecision]], N[Power[re, -4.0], $MachinePrecision], N[Power[re, 6.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.056:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3.6 \cdot 10^{+83} \lor \neg \left(im \leq 5 \cdot 10^{+108}\right):\\
\;\;\;\;{re}^{-4}\\
\mathbf{else}:\\
\;\;\;\;{re}^{6}\\
\end{array}
\end{array}
if im < 0.0560000000000000012Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.9%
if 0.0560000000000000012 < im < 3.5999999999999997e83 or 4.99999999999999991e108 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 64.2%
Applied egg-rr26.3%
if 3.5999999999999997e83 < im < 4.99999999999999991e108Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
Applied egg-rr0.0%
Applied egg-rr50.0%
Final simplification52.2%
(FPCore (re im) :precision binary64 (if (<= im 0.056) (sin re) (if (or (<= im 4.1e+83) (not (<= im 3.5e+112))) (pow re -4.0) (* re re))))
double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = sin(re);
} else if ((im <= 4.1e+83) || !(im <= 3.5e+112)) {
tmp = pow(re, -4.0);
} 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 <= 0.056d0) then
tmp = sin(re)
else if ((im <= 4.1d+83) .or. (.not. (im <= 3.5d+112))) then
tmp = re ** (-4.0d0)
else
tmp = re * re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.056) {
tmp = Math.sin(re);
} else if ((im <= 4.1e+83) || !(im <= 3.5e+112)) {
tmp = Math.pow(re, -4.0);
} else {
tmp = re * re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.056: tmp = math.sin(re) elif (im <= 4.1e+83) or not (im <= 3.5e+112): tmp = math.pow(re, -4.0) else: tmp = re * re return tmp
function code(re, im) tmp = 0.0 if (im <= 0.056) tmp = sin(re); elseif ((im <= 4.1e+83) || !(im <= 3.5e+112)) tmp = re ^ -4.0; else tmp = Float64(re * re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.056) tmp = sin(re); elseif ((im <= 4.1e+83) || ~((im <= 3.5e+112))) tmp = re ^ -4.0; else tmp = re * re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.056], N[Sin[re], $MachinePrecision], If[Or[LessEqual[im, 4.1e+83], N[Not[LessEqual[im, 3.5e+112]], $MachinePrecision]], N[Power[re, -4.0], $MachinePrecision], N[(re * re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.056:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4.1 \cdot 10^{+83} \lor \neg \left(im \leq 3.5 \cdot 10^{+112}\right):\\
\;\;\;\;{re}^{-4}\\
\mathbf{else}:\\
\;\;\;\;re \cdot re\\
\end{array}
\end{array}
if im < 0.0560000000000000012Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.9%
if 0.0560000000000000012 < im < 4.1000000000000001e83 or 3.49999999999999997e112 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 63.0%
Applied egg-rr25.5%
if 4.1000000000000001e83 < im < 3.49999999999999997e112Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 50.0%
Applied egg-rr25.5%
Applied egg-rr1.5%
Final simplification51.4%
(FPCore (re im) :precision binary64 (if (<= im 2.6e-15) (sin re) (* re re)))
double code(double re, double im) {
double tmp;
if (im <= 2.6e-15) {
tmp = sin(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.6d-15) then
tmp = sin(re)
else
tmp = re * re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.6e-15) {
tmp = Math.sin(re);
} else {
tmp = re * re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.6e-15: tmp = math.sin(re) else: tmp = re * re return tmp
function code(re, im) tmp = 0.0 if (im <= 2.6e-15) tmp = sin(re); else tmp = Float64(re * re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.6e-15) tmp = sin(re); else tmp = re * re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.6e-15], N[Sin[re], $MachinePrecision], N[(re * re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.6 \cdot 10^{-15}:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;re \cdot re\\
\end{array}
\end{array}
if im < 2.60000000000000004e-15Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 60.7%
if 2.60000000000000004e-15 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 62.8%
Applied egg-rr17.5%
Applied egg-rr10.8%
(FPCore (re im) :precision binary64 (if (<= im 0.056) re (* re re)))
double code(double re, double im) {
double tmp;
if (im <= 0.056) {
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 <= 0.056d0) 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 <= 0.056) {
tmp = re;
} else {
tmp = re * re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.056: tmp = re else: tmp = re * re return tmp
function code(re, im) tmp = 0.0 if (im <= 0.056) tmp = re; else tmp = Float64(re * re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.056) tmp = re; else tmp = re * re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.056], re, N[(re * re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.056:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;re \cdot re\\
\end{array}
\end{array}
if im < 0.0560000000000000012Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 57.8%
Taylor expanded in im around 0 30.6%
if 0.0560000000000000012 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 62.2%
Applied egg-rr16.3%
Applied egg-rr10.9%
(FPCore (re im) :precision binary64 (if (<= re 1.75e-21) re -1.0))
double code(double re, double im) {
double tmp;
if (re <= 1.75e-21) {
tmp = re;
} else {
tmp = -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 <= 1.75d-21) then
tmp = re
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.75e-21) {
tmp = re;
} else {
tmp = -1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.75e-21: tmp = re else: tmp = -1.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 1.75e-21) tmp = re; else tmp = -1.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.75e-21) tmp = re; else tmp = -1.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.75e-21], re, -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.75 \cdot 10^{-21}:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if re < 1.7500000000000002e-21Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 73.5%
Taylor expanded in im around 0 31.2%
if 1.7500000000000002e-21 < re Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 21.1%
Applied egg-rr2.5%
sub-neg2.5%
metadata-eval2.5%
+-commutative2.5%
log1p-undefine2.5%
rem-exp-log2.5%
+-commutative2.5%
Simplified2.5%
Applied egg-rr7.9%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr4.0%
+-inverses4.0%
+-rgt-identity4.0%
*-inverses4.0%
Simplified4.0%
(FPCore (re im) :precision binary64 0.5)
double code(double re, double im) {
return 0.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0
end function
public static double code(double re, double im) {
return 0.5;
}
def code(re, im): return 0.5
function code(re, im) return 0.5 end
function tmp = code(re, im) tmp = 0.5; end
code[re_, im_] := 0.5
\begin{array}{l}
\\
0.5
\end{array}
Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 58.9%
Applied egg-rr1.9%
sub-neg1.9%
metadata-eval1.9%
+-commutative1.9%
log1p-undefine1.9%
rem-exp-log2.7%
+-commutative2.7%
Simplified2.7%
Applied egg-rr4.0%
(FPCore (re im) :precision binary64 0.125)
double code(double re, double im) {
return 0.125;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.125d0
end function
public static double code(double re, double im) {
return 0.125;
}
def code(re, im): return 0.125
function code(re, im) return 0.125 end
function tmp = code(re, im) tmp = 0.125; end
code[re_, im_] := 0.125
\begin{array}{l}
\\
0.125
\end{array}
Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 58.9%
Applied egg-rr1.9%
sub-neg1.9%
metadata-eval1.9%
+-commutative1.9%
log1p-undefine1.9%
rem-exp-log2.7%
+-commutative2.7%
Simplified2.7%
Applied egg-rr3.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%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 58.9%
Applied egg-rr1.9%
sub-neg1.9%
metadata-eval1.9%
+-commutative1.9%
log1p-undefine1.9%
rem-exp-log2.7%
+-commutative2.7%
Simplified2.7%
Applied egg-rr5.1%
(FPCore (re im) :precision binary64 -4.0)
double code(double re, double im) {
return -4.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -4.0d0
end function
public static double code(double re, double im) {
return -4.0;
}
def code(re, im): return -4.0
function code(re, im) return -4.0 end
function tmp = code(re, im) tmp = -4.0; end
code[re_, im_] := -4.0
\begin{array}{l}
\\
-4
\end{array}
Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 58.9%
Applied egg-rr1.9%
sub-neg1.9%
metadata-eval1.9%
+-commutative1.9%
log1p-undefine1.9%
rem-exp-log2.7%
+-commutative2.7%
Simplified2.7%
Applied egg-rr4.3%
herbie shell --seed 2024107
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))