
(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 16 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%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (pow im 2.0))))
(if (<= im 72000000000.0)
(sin re)
(if (<= im 4.9e+119)
(sqrt (/ 0.0625 (pow re 4.0)))
(if (<= im 1.5e+150) (* re t_0) (* (sin re) t_0))))))
double code(double re, double im) {
double t_0 = 0.5 * pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else if (im <= 4.9e+119) {
tmp = sqrt((0.0625 / pow(re, 4.0)));
} else if (im <= 1.5e+150) {
tmp = re * t_0;
} else {
tmp = sin(re) * t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (im ** 2.0d0)
if (im <= 72000000000.0d0) then
tmp = sin(re)
else if (im <= 4.9d+119) then
tmp = sqrt((0.0625d0 / (re ** 4.0d0)))
else if (im <= 1.5d+150) then
tmp = re * t_0
else
tmp = sin(re) * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = Math.sin(re);
} else if (im <= 4.9e+119) {
tmp = Math.sqrt((0.0625 / Math.pow(re, 4.0)));
} else if (im <= 1.5e+150) {
tmp = re * t_0;
} else {
tmp = Math.sin(re) * t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.pow(im, 2.0) tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) elif im <= 4.9e+119: tmp = math.sqrt((0.0625 / math.pow(re, 4.0))) elif im <= 1.5e+150: tmp = re * t_0 else: tmp = math.sin(re) * t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * (im ^ 2.0)) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 4.9e+119) tmp = sqrt(Float64(0.0625 / (re ^ 4.0))); elseif (im <= 1.5e+150) tmp = Float64(re * t_0); else tmp = Float64(sin(re) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (im ^ 2.0); tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 4.9e+119) tmp = sqrt((0.0625 / (re ^ 4.0))); elseif (im <= 1.5e+150) tmp = re * t_0; else tmp = sin(re) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 4.9e+119], N[Sqrt[N[(0.0625 / N[Power[re, 4.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.5e+150], N[(re * t$95$0), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot {im}^{2}\\
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4.9 \cdot 10^{+119}:\\
\;\;\;\;\sqrt{\frac{0.0625}{{re}^{4}}}\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+150}:\\
\;\;\;\;re \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot t\_0\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < im < 4.89999999999999996e119Initial 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-rr8.7%
Taylor expanded in re around 0 8.8%
add-sqr-sqrt8.8%
sqrt-unprod18.9%
frac-times18.9%
metadata-eval18.9%
pow-prod-up18.9%
metadata-eval18.9%
Applied egg-rr18.9%
if 4.89999999999999996e119 < im < 1.50000000000000006e150Initial 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-rr100.0%
Taylor expanded in im around 0 6.4%
associate-*r*6.4%
distribute-rgt1-in6.4%
Simplified6.4%
Taylor expanded in im around inf 6.4%
associate-*r*6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in re around 0 3.1%
associate-*r*3.1%
*-commutative3.1%
Simplified3.1%
if 1.50000000000000006e150 < 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%
Applied egg-rr100.0%
Taylor expanded in im around 0 95.2%
associate-*r*95.2%
distribute-rgt1-in95.2%
Simplified95.2%
Taylor expanded in im around inf 95.2%
associate-*r*95.2%
*-commutative95.2%
Simplified95.2%
Final simplification62.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (pow im 2.0))))
(if (<= im 72000000000.0)
(* (sin re) (+ t_0 1.0))
(if (<= im 7e+119)
(sqrt (/ 0.0625 (pow re 4.0)))
(if (<= im 1.16e+150) (* re t_0) (* (sin re) t_0))))))
double code(double re, double im) {
double t_0 = 0.5 * pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re) * (t_0 + 1.0);
} else if (im <= 7e+119) {
tmp = sqrt((0.0625 / pow(re, 4.0)));
} else if (im <= 1.16e+150) {
tmp = re * t_0;
} else {
tmp = sin(re) * t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (im ** 2.0d0)
if (im <= 72000000000.0d0) then
tmp = sin(re) * (t_0 + 1.0d0)
else if (im <= 7d+119) then
tmp = sqrt((0.0625d0 / (re ** 4.0d0)))
else if (im <= 1.16d+150) then
tmp = re * t_0
else
tmp = sin(re) * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = Math.sin(re) * (t_0 + 1.0);
} else if (im <= 7e+119) {
tmp = Math.sqrt((0.0625 / Math.pow(re, 4.0)));
} else if (im <= 1.16e+150) {
tmp = re * t_0;
} else {
tmp = Math.sin(re) * t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.pow(im, 2.0) tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) * (t_0 + 1.0) elif im <= 7e+119: tmp = math.sqrt((0.0625 / math.pow(re, 4.0))) elif im <= 1.16e+150: tmp = re * t_0 else: tmp = math.sin(re) * t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * (im ^ 2.0)) tmp = 0.0 if (im <= 72000000000.0) tmp = Float64(sin(re) * Float64(t_0 + 1.0)); elseif (im <= 7e+119) tmp = sqrt(Float64(0.0625 / (re ^ 4.0))); elseif (im <= 1.16e+150) tmp = Float64(re * t_0); else tmp = Float64(sin(re) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (im ^ 2.0); tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re) * (t_0 + 1.0); elseif (im <= 7e+119) tmp = sqrt((0.0625 / (re ^ 4.0))); elseif (im <= 1.16e+150) tmp = re * t_0; else tmp = sin(re) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 72000000000.0], N[(N[Sin[re], $MachinePrecision] * N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7e+119], N[Sqrt[N[(0.0625 / N[Power[re, 4.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.16e+150], N[(re * t$95$0), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot {im}^{2}\\
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re \cdot \left(t\_0 + 1\right)\\
\mathbf{elif}\;im \leq 7 \cdot 10^{+119}:\\
\;\;\;\;\sqrt{\frac{0.0625}{{re}^{4}}}\\
\mathbf{elif}\;im \leq 1.16 \cdot 10^{+150}:\\
\;\;\;\;re \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot t\_0\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 79.7%
*-lft-identity79.7%
associate-*r*79.7%
distribute-rgt-out79.7%
Simplified79.7%
if 7.2e10 < im < 7.0000000000000001e119Initial 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-rr8.7%
Taylor expanded in re around 0 8.8%
add-sqr-sqrt8.8%
sqrt-unprod18.9%
frac-times18.9%
metadata-eval18.9%
pow-prod-up18.9%
metadata-eval18.9%
Applied egg-rr18.9%
if 7.0000000000000001e119 < im < 1.16000000000000008e150Initial 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-rr100.0%
Taylor expanded in im around 0 6.4%
associate-*r*6.4%
distribute-rgt1-in6.4%
Simplified6.4%
Taylor expanded in im around inf 6.4%
associate-*r*6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in re around 0 3.1%
associate-*r*3.1%
*-commutative3.1%
Simplified3.1%
if 1.16000000000000008e150 < 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%
Applied egg-rr100.0%
Taylor expanded in im around 0 95.2%
associate-*r*95.2%
distribute-rgt1-in95.2%
Simplified95.2%
Taylor expanded in im around inf 95.2%
associate-*r*95.2%
*-commutative95.2%
Simplified95.2%
Final simplification74.3%
(FPCore (re im)
:precision binary64
(if (<= im 1.15e-12)
(sin re)
(if (<= im 1.35e+154)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(* (sin re) (* 0.5 (pow im 2.0))))))
double code(double re, double im) {
double tmp;
if (im <= 1.15e-12) {
tmp = sin(re);
} else if (im <= 1.35e+154) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = sin(re) * (0.5 * 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 <= 1.15d-12) then
tmp = sin(re)
else if (im <= 1.35d+154) then
tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
else
tmp = sin(re) * (0.5d0 * (im ** 2.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.15e-12) {
tmp = Math.sin(re);
} else if (im <= 1.35e+154) {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
} else {
tmp = Math.sin(re) * (0.5 * Math.pow(im, 2.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.15e-12: tmp = math.sin(re) elif im <= 1.35e+154: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) else: tmp = math.sin(re) * (0.5 * math.pow(im, 2.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.15e-12) tmp = sin(re); elseif (im <= 1.35e+154) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = Float64(sin(re) * Float64(0.5 * (im ^ 2.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.15e-12) tmp = sin(re); elseif (im <= 1.35e+154) tmp = (exp(-im) + exp(im)) * (0.5 * re); else tmp = sin(re) * (0.5 * (im ^ 2.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.15e-12], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.15 \cdot 10^{-12}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(0.5 \cdot {im}^{2}\right)\\
\end{array}
\end{array}
if im < 1.14999999999999995e-12Initial 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 63.5%
if 1.14999999999999995e-12 < im < 1.35000000000000003e154Initial 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 61.5%
if 1.35000000000000003e154 < 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%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
associate-*r*100.0%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification68.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (pow im 2.0))))
(if (<= im 72000000000.0)
(sin re)
(if (<= im 6.2e+119)
(sqrt (/ 0.0625 (pow re 4.0)))
(if (<= im 3.1e+242)
(* re (+ t_0 1.0))
(if (<= im 7.2e+254)
(* 2.0 (* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0)))))
(* re t_0)))))))
double code(double re, double im) {
double t_0 = 0.5 * pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else if (im <= 6.2e+119) {
tmp = sqrt((0.0625 / pow(re, 4.0)));
} else if (im <= 3.1e+242) {
tmp = re * (t_0 + 1.0);
} else if (im <= 7.2e+254) {
tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * pow(re, 2.0))));
} else {
tmp = re * t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (im ** 2.0d0)
if (im <= 72000000000.0d0) then
tmp = sin(re)
else if (im <= 6.2d+119) then
tmp = sqrt((0.0625d0 / (re ** 4.0d0)))
else if (im <= 3.1d+242) then
tmp = re * (t_0 + 1.0d0)
else if (im <= 7.2d+254) then
tmp = 2.0d0 * (re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0))))
else
tmp = re * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = Math.sin(re);
} else if (im <= 6.2e+119) {
tmp = Math.sqrt((0.0625 / Math.pow(re, 4.0)));
} else if (im <= 3.1e+242) {
tmp = re * (t_0 + 1.0);
} else if (im <= 7.2e+254) {
tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0))));
} else {
tmp = re * t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.pow(im, 2.0) tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) elif im <= 6.2e+119: tmp = math.sqrt((0.0625 / math.pow(re, 4.0))) elif im <= 3.1e+242: tmp = re * (t_0 + 1.0) elif im <= 7.2e+254: tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0)))) else: tmp = re * t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * (im ^ 2.0)) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 6.2e+119) tmp = sqrt(Float64(0.0625 / (re ^ 4.0))); elseif (im <= 3.1e+242) tmp = Float64(re * Float64(t_0 + 1.0)); elseif (im <= 7.2e+254) tmp = Float64(2.0 * Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0))))); else tmp = Float64(re * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (im ^ 2.0); tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 6.2e+119) tmp = sqrt((0.0625 / (re ^ 4.0))); elseif (im <= 3.1e+242) tmp = re * (t_0 + 1.0); elseif (im <= 7.2e+254) tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * (re ^ 2.0)))); else tmp = re * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 6.2e+119], N[Sqrt[N[(0.0625 / N[Power[re, 4.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 3.1e+242], N[(re * N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.2e+254], N[(2.0 * N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot {im}^{2}\\
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 6.2 \cdot 10^{+119}:\\
\;\;\;\;\sqrt{\frac{0.0625}{{re}^{4}}}\\
\mathbf{elif}\;im \leq 3.1 \cdot 10^{+242}:\\
\;\;\;\;re \cdot \left(t\_0 + 1\right)\\
\mathbf{elif}\;im \leq 7.2 \cdot 10^{+254}:\\
\;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot t\_0\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < im < 6.1999999999999999e119Initial 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-rr8.7%
Taylor expanded in re around 0 8.8%
add-sqr-sqrt8.8%
sqrt-unprod18.9%
frac-times18.9%
metadata-eval18.9%
pow-prod-up18.9%
metadata-eval18.9%
Applied egg-rr18.9%
if 6.1999999999999999e119 < im < 3.1000000000000001e242Initial 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-rr100.0%
Taylor expanded in im around 0 78.3%
associate-*r*78.3%
distribute-rgt1-in78.3%
Simplified78.3%
Taylor expanded in re around 0 54.7%
if 3.1000000000000001e242 < im < 7.19999999999999954e254Initial 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-rr3.1%
count-23.1%
Simplified3.1%
Taylor expanded in re around 0 72.3%
if 7.19999999999999954e254 < 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%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
associate-*r*100.0%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 81.8%
associate-*r*81.8%
*-commutative81.8%
Simplified81.8%
Final simplification58.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (pow im 2.0))))
(if (<= im 72000000000.0)
(sin re)
(if (<= im 4.8e+119)
(pow re -2.0)
(if (<= im 3.1e+242)
(* re (+ t_0 1.0))
(if (<= im 7.2e+254)
(* 2.0 (* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0)))))
(* re t_0)))))))
double code(double re, double im) {
double t_0 = 0.5 * pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else if (im <= 4.8e+119) {
tmp = pow(re, -2.0);
} else if (im <= 3.1e+242) {
tmp = re * (t_0 + 1.0);
} else if (im <= 7.2e+254) {
tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * pow(re, 2.0))));
} else {
tmp = re * t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (im ** 2.0d0)
if (im <= 72000000000.0d0) then
tmp = sin(re)
else if (im <= 4.8d+119) then
tmp = re ** (-2.0d0)
else if (im <= 3.1d+242) then
tmp = re * (t_0 + 1.0d0)
else if (im <= 7.2d+254) then
tmp = 2.0d0 * (re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0))))
else
tmp = re * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = Math.sin(re);
} else if (im <= 4.8e+119) {
tmp = Math.pow(re, -2.0);
} else if (im <= 3.1e+242) {
tmp = re * (t_0 + 1.0);
} else if (im <= 7.2e+254) {
tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0))));
} else {
tmp = re * t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.pow(im, 2.0) tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) elif im <= 4.8e+119: tmp = math.pow(re, -2.0) elif im <= 3.1e+242: tmp = re * (t_0 + 1.0) elif im <= 7.2e+254: tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0)))) else: tmp = re * t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * (im ^ 2.0)) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 4.8e+119) tmp = re ^ -2.0; elseif (im <= 3.1e+242) tmp = Float64(re * Float64(t_0 + 1.0)); elseif (im <= 7.2e+254) tmp = Float64(2.0 * Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0))))); else tmp = Float64(re * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (im ^ 2.0); tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 4.8e+119) tmp = re ^ -2.0; elseif (im <= 3.1e+242) tmp = re * (t_0 + 1.0); elseif (im <= 7.2e+254) tmp = 2.0 * (re * (1.0 + (-0.16666666666666666 * (re ^ 2.0)))); else tmp = re * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 4.8e+119], N[Power[re, -2.0], $MachinePrecision], If[LessEqual[im, 3.1e+242], N[(re * N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.2e+254], N[(2.0 * N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot {im}^{2}\\
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{+119}:\\
\;\;\;\;{re}^{-2}\\
\mathbf{elif}\;im \leq 3.1 \cdot 10^{+242}:\\
\;\;\;\;re \cdot \left(t\_0 + 1\right)\\
\mathbf{elif}\;im \leq 7.2 \cdot 10^{+254}:\\
\;\;\;\;2 \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot t\_0\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < im < 4.8e119Initial 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%
Applied egg-rr8.7%
Taylor expanded in re around 0 8.8%
if 4.8e119 < im < 3.1000000000000001e242Initial 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-rr100.0%
Taylor expanded in im around 0 78.3%
associate-*r*78.3%
distribute-rgt1-in78.3%
Simplified78.3%
Taylor expanded in re around 0 54.7%
if 3.1000000000000001e242 < im < 7.19999999999999954e254Initial 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-rr3.1%
count-23.1%
Simplified3.1%
Taylor expanded in re around 0 72.3%
if 7.19999999999999954e254 < 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%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
associate-*r*100.0%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 81.8%
associate-*r*81.8%
*-commutative81.8%
Simplified81.8%
Final simplification57.3%
(FPCore (re im)
:precision binary64
(if (<= im 72000000000.0)
(sin re)
(if (<= im 5e+119)
(pow re -2.0)
(if (or (<= im 3.1e+242) (not (<= im 6.2e+254)))
(* re (* 0.5 (pow im 2.0)))
(* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0))))))))
double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else if (im <= 5e+119) {
tmp = pow(re, -2.0);
} else if ((im <= 3.1e+242) || !(im <= 6.2e+254)) {
tmp = re * (0.5 * pow(im, 2.0));
} else {
tmp = re * (1.0 + (-0.16666666666666666 * pow(re, 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 <= 72000000000.0d0) then
tmp = sin(re)
else if (im <= 5d+119) then
tmp = re ** (-2.0d0)
else if ((im <= 3.1d+242) .or. (.not. (im <= 6.2d+254))) then
tmp = re * (0.5d0 * (im ** 2.0d0))
else
tmp = re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = Math.sin(re);
} else if (im <= 5e+119) {
tmp = Math.pow(re, -2.0);
} else if ((im <= 3.1e+242) || !(im <= 6.2e+254)) {
tmp = re * (0.5 * Math.pow(im, 2.0));
} else {
tmp = re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) elif im <= 5e+119: tmp = math.pow(re, -2.0) elif (im <= 3.1e+242) or not (im <= 6.2e+254): tmp = re * (0.5 * math.pow(im, 2.0)) else: tmp = re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 5e+119) tmp = re ^ -2.0; elseif ((im <= 3.1e+242) || !(im <= 6.2e+254)) tmp = Float64(re * Float64(0.5 * (im ^ 2.0))); else tmp = Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 5e+119) tmp = re ^ -2.0; elseif ((im <= 3.1e+242) || ~((im <= 6.2e+254))) tmp = re * (0.5 * (im ^ 2.0)); else tmp = re * (1.0 + (-0.16666666666666666 * (re ^ 2.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 5e+119], N[Power[re, -2.0], $MachinePrecision], If[Or[LessEqual[im, 3.1e+242], N[Not[LessEqual[im, 6.2e+254]], $MachinePrecision]], N[(re * N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+119}:\\
\;\;\;\;{re}^{-2}\\
\mathbf{elif}\;im \leq 3.1 \cdot 10^{+242} \lor \neg \left(im \leq 6.2 \cdot 10^{+254}\right):\\
\;\;\;\;re \cdot \left(0.5 \cdot {im}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < im < 4.9999999999999999e119Initial 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%
Applied egg-rr8.7%
Taylor expanded in re around 0 8.8%
if 4.9999999999999999e119 < im < 3.1000000000000001e242 or 6.2000000000000004e254 < 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%
Applied egg-rr100.0%
Taylor expanded in im around 0 84.7%
associate-*r*84.7%
distribute-rgt1-in84.7%
Simplified84.7%
Taylor expanded in im around inf 84.7%
associate-*r*84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in re around 0 62.8%
associate-*r*62.8%
*-commutative62.8%
Simplified62.8%
if 3.1000000000000001e242 < im < 6.2000000000000004e254Initial 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 3.1%
Taylor expanded in re around 0 72.3%
Final simplification57.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (pow im 2.0))))
(if (<= im 72000000000.0)
(sin re)
(if (<= im 6.2e+119)
(pow re -2.0)
(if (<= im 3.1e+242)
(* re (+ t_0 1.0))
(if (<= im 6.2e+254)
(* re (+ 1.0 (* -0.16666666666666666 (pow re 2.0))))
(* re t_0)))))))
double code(double re, double im) {
double t_0 = 0.5 * pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else if (im <= 6.2e+119) {
tmp = pow(re, -2.0);
} else if (im <= 3.1e+242) {
tmp = re * (t_0 + 1.0);
} else if (im <= 6.2e+254) {
tmp = re * (1.0 + (-0.16666666666666666 * pow(re, 2.0)));
} else {
tmp = re * t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (im ** 2.0d0)
if (im <= 72000000000.0d0) then
tmp = sin(re)
else if (im <= 6.2d+119) then
tmp = re ** (-2.0d0)
else if (im <= 3.1d+242) then
tmp = re * (t_0 + 1.0d0)
else if (im <= 6.2d+254) then
tmp = re * (1.0d0 + ((-0.16666666666666666d0) * (re ** 2.0d0)))
else
tmp = re * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.pow(im, 2.0);
double tmp;
if (im <= 72000000000.0) {
tmp = Math.sin(re);
} else if (im <= 6.2e+119) {
tmp = Math.pow(re, -2.0);
} else if (im <= 3.1e+242) {
tmp = re * (t_0 + 1.0);
} else if (im <= 6.2e+254) {
tmp = re * (1.0 + (-0.16666666666666666 * Math.pow(re, 2.0)));
} else {
tmp = re * t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.pow(im, 2.0) tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) elif im <= 6.2e+119: tmp = math.pow(re, -2.0) elif im <= 3.1e+242: tmp = re * (t_0 + 1.0) elif im <= 6.2e+254: tmp = re * (1.0 + (-0.16666666666666666 * math.pow(re, 2.0))) else: tmp = re * t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * (im ^ 2.0)) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 6.2e+119) tmp = re ^ -2.0; elseif (im <= 3.1e+242) tmp = Float64(re * Float64(t_0 + 1.0)); elseif (im <= 6.2e+254) tmp = Float64(re * Float64(1.0 + Float64(-0.16666666666666666 * (re ^ 2.0)))); else tmp = Float64(re * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (im ^ 2.0); tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 6.2e+119) tmp = re ^ -2.0; elseif (im <= 3.1e+242) tmp = re * (t_0 + 1.0); elseif (im <= 6.2e+254) tmp = re * (1.0 + (-0.16666666666666666 * (re ^ 2.0))); else tmp = re * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 6.2e+119], N[Power[re, -2.0], $MachinePrecision], If[LessEqual[im, 3.1e+242], N[(re * N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.2e+254], N[(re * N[(1.0 + N[(-0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot {im}^{2}\\
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 6.2 \cdot 10^{+119}:\\
\;\;\;\;{re}^{-2}\\
\mathbf{elif}\;im \leq 3.1 \cdot 10^{+242}:\\
\;\;\;\;re \cdot \left(t\_0 + 1\right)\\
\mathbf{elif}\;im \leq 6.2 \cdot 10^{+254}:\\
\;\;\;\;re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot t\_0\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < im < 6.1999999999999999e119Initial 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%
Applied egg-rr8.7%
Taylor expanded in re around 0 8.8%
if 6.1999999999999999e119 < im < 3.1000000000000001e242Initial 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-rr100.0%
Taylor expanded in im around 0 78.3%
associate-*r*78.3%
distribute-rgt1-in78.3%
Simplified78.3%
Taylor expanded in re around 0 54.7%
if 3.1000000000000001e242 < im < 6.2000000000000004e254Initial 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 3.1%
Taylor expanded in re around 0 72.3%
if 6.2000000000000004e254 < 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%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
associate-*r*100.0%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 81.8%
associate-*r*81.8%
*-commutative81.8%
Simplified81.8%
Final simplification57.3%
(FPCore (re im)
:precision binary64
(if (<= im 72000000000.0)
(sin re)
(if (<= im 5.5e+119)
(pow re -2.0)
(if (or (<= im 3.1e+242) (not (<= im 6.2e+254)))
(* re (* 0.5 (pow im 2.0)))
(* -0.16666666666666666 (pow re 3.0))))))
double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else if (im <= 5.5e+119) {
tmp = pow(re, -2.0);
} else if ((im <= 3.1e+242) || !(im <= 6.2e+254)) {
tmp = re * (0.5 * pow(im, 2.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 <= 72000000000.0d0) then
tmp = sin(re)
else if (im <= 5.5d+119) then
tmp = re ** (-2.0d0)
else if ((im <= 3.1d+242) .or. (.not. (im <= 6.2d+254))) then
tmp = re * (0.5d0 * (im ** 2.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 <= 72000000000.0) {
tmp = Math.sin(re);
} else if (im <= 5.5e+119) {
tmp = Math.pow(re, -2.0);
} else if ((im <= 3.1e+242) || !(im <= 6.2e+254)) {
tmp = re * (0.5 * Math.pow(im, 2.0));
} else {
tmp = -0.16666666666666666 * Math.pow(re, 3.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) elif im <= 5.5e+119: tmp = math.pow(re, -2.0) elif (im <= 3.1e+242) or not (im <= 6.2e+254): tmp = re * (0.5 * math.pow(im, 2.0)) else: tmp = -0.16666666666666666 * math.pow(re, 3.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 5.5e+119) tmp = re ^ -2.0; elseif ((im <= 3.1e+242) || !(im <= 6.2e+254)) tmp = Float64(re * Float64(0.5 * (im ^ 2.0))); else tmp = Float64(-0.16666666666666666 * (re ^ 3.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); elseif (im <= 5.5e+119) tmp = re ^ -2.0; elseif ((im <= 3.1e+242) || ~((im <= 6.2e+254))) tmp = re * (0.5 * (im ^ 2.0)); else tmp = -0.16666666666666666 * (re ^ 3.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 5.5e+119], N[Power[re, -2.0], $MachinePrecision], If[Or[LessEqual[im, 3.1e+242], N[Not[LessEqual[im, 6.2e+254]], $MachinePrecision]], N[(re * N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 5.5 \cdot 10^{+119}:\\
\;\;\;\;{re}^{-2}\\
\mathbf{elif}\;im \leq 3.1 \cdot 10^{+242} \lor \neg \left(im \leq 6.2 \cdot 10^{+254}\right):\\
\;\;\;\;re \cdot \left(0.5 \cdot {im}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < im < 5.5000000000000003e119Initial 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%
Applied egg-rr8.7%
Taylor expanded in re around 0 8.8%
if 5.5000000000000003e119 < im < 3.1000000000000001e242 or 6.2000000000000004e254 < 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%
Applied egg-rr100.0%
Taylor expanded in im around 0 84.7%
associate-*r*84.7%
distribute-rgt1-in84.7%
Simplified84.7%
Taylor expanded in im around inf 84.7%
associate-*r*84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in re around 0 62.8%
associate-*r*62.8%
*-commutative62.8%
Simplified62.8%
if 3.1000000000000001e242 < im < 6.2000000000000004e254Initial 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 3.1%
Taylor expanded in re around 0 72.3%
Taylor expanded in re around inf 72.1%
Final simplification57.3%
(FPCore (re im)
:precision binary64
(if (<= im 72000000000.0)
(sin re)
(if (or (<= im 2.3e+241) (not (<= im 6.2e+254)))
(pow re -2.0)
(* -0.16666666666666666 (pow re 3.0)))))
double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else if ((im <= 2.3e+241) || !(im <= 6.2e+254)) {
tmp = pow(re, -2.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 <= 72000000000.0d0) then
tmp = sin(re)
else if ((im <= 2.3d+241) .or. (.not. (im <= 6.2d+254))) then
tmp = re ** (-2.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 <= 72000000000.0) {
tmp = Math.sin(re);
} else if ((im <= 2.3e+241) || !(im <= 6.2e+254)) {
tmp = Math.pow(re, -2.0);
} else {
tmp = -0.16666666666666666 * Math.pow(re, 3.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) elif (im <= 2.3e+241) or not (im <= 6.2e+254): tmp = math.pow(re, -2.0) else: tmp = -0.16666666666666666 * math.pow(re, 3.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); elseif ((im <= 2.3e+241) || !(im <= 6.2e+254)) tmp = re ^ -2.0; else tmp = Float64(-0.16666666666666666 * (re ^ 3.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); elseif ((im <= 2.3e+241) || ~((im <= 6.2e+254))) tmp = re ^ -2.0; else tmp = -0.16666666666666666 * (re ^ 3.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], If[Or[LessEqual[im, 2.3e+241], N[Not[LessEqual[im, 6.2e+254]], $MachinePrecision]], N[Power[re, -2.0], $MachinePrecision], N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 2.3 \cdot 10^{+241} \lor \neg \left(im \leq 6.2 \cdot 10^{+254}\right):\\
\;\;\;\;{re}^{-2}\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {re}^{3}\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < im < 2.2999999999999999e241 or 6.2000000000000004e254 < 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.7%
Applied egg-rr9.2%
Taylor expanded in re around 0 9.1%
if 2.2999999999999999e241 < im < 6.2000000000000004e254Initial 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 3.1%
Taylor expanded in re around 0 72.3%
Taylor expanded in re around inf 72.1%
Final simplification49.6%
(FPCore (re im) :precision binary64 (if (<= im 72000000000.0) (sin re) (pow re -2.0)))
double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else {
tmp = pow(re, -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 <= 72000000000.0d0) then
tmp = sin(re)
else
tmp = re ** (-2.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = Math.sin(re);
} else {
tmp = Math.pow(re, -2.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) else: tmp = math.pow(re, -2.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); else tmp = re ^ -2.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); else tmp = re ^ -2.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], N[Power[re, -2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;{re}^{-2}\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < 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.7%
Applied egg-rr8.5%
Taylor expanded in re around 0 8.4%
Final simplification47.7%
(FPCore (re im) :precision binary64 (if (<= im 72000000000.0) (sin re) (* (/ 0.5 re) (/ 0.5 re))))
double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = sin(re);
} else {
tmp = (0.5 / re) * (0.5 / re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 72000000000.0d0) then
tmp = sin(re)
else
tmp = (0.5d0 / re) * (0.5d0 / re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = Math.sin(re);
} else {
tmp = (0.5 / re) * (0.5 / re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 72000000000.0: tmp = math.sin(re) else: tmp = (0.5 / re) * (0.5 / re) return tmp
function code(re, im) tmp = 0.0 if (im <= 72000000000.0) tmp = sin(re); else tmp = Float64(Float64(0.5 / re) * Float64(0.5 / re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 72000000000.0) tmp = sin(re); else tmp = (0.5 / re) * (0.5 / re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 72000000000.0], N[Sin[re], $MachinePrecision], N[(N[(0.5 / re), $MachinePrecision] * N[(0.5 / re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{re} \cdot \frac{0.5}{re}\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
if 7.2e10 < 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%
Applied egg-rr8.5%
Taylor expanded in re around 0 8.4%
add-sqr-sqrt8.4%
sqrt-div8.4%
metadata-eval8.4%
sqrt-pow125.6%
metadata-eval25.6%
pow125.6%
sqrt-div25.6%
metadata-eval25.6%
sqrt-pow18.4%
metadata-eval8.4%
pow18.4%
Applied egg-rr8.4%
Final simplification47.7%
(FPCore (re im) :precision binary64 (if (<= im 72000000000.0) re (* (/ 0.5 re) (/ 0.5 re))))
double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = re;
} else {
tmp = (0.5 / re) * (0.5 / re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 72000000000.0d0) then
tmp = re
else
tmp = (0.5d0 / re) * (0.5d0 / re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 72000000000.0) {
tmp = re;
} else {
tmp = (0.5 / re) * (0.5 / re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 72000000000.0: tmp = re else: tmp = (0.5 / re) * (0.5 / re) return tmp
function code(re, im) tmp = 0.0 if (im <= 72000000000.0) tmp = re; else tmp = Float64(Float64(0.5 / re) * Float64(0.5 / re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 72000000000.0) tmp = re; else tmp = (0.5 / re) * (0.5 / re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 72000000000.0], re, N[(N[(0.5 / re), $MachinePrecision] * N[(0.5 / re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 72000000000:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{re} \cdot \frac{0.5}{re}\\
\end{array}
\end{array}
if im < 7.2e10Initial 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 63.1%
Taylor expanded in re around 0 31.5%
if 7.2e10 < 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%
Applied egg-rr8.5%
Taylor expanded in re around 0 8.4%
add-sqr-sqrt8.4%
sqrt-div8.4%
metadata-eval8.4%
sqrt-pow125.6%
metadata-eval25.6%
pow125.6%
sqrt-div25.6%
metadata-eval25.6%
sqrt-pow18.4%
metadata-eval8.4%
pow18.4%
Applied egg-rr8.4%
Final simplification25.0%
(FPCore (re im) :precision binary64 (if (<= re 1.0) re 1.0))
double code(double re, double im) {
double tmp;
if (re <= 1.0) {
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.0d0) 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.0) {
tmp = re;
} else {
tmp = 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.0: tmp = re else: tmp = 1.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 1.0) tmp = re; else tmp = 1.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.0) tmp = re; else tmp = 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.0], re, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if re < 1Initial 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 45.4%
Taylor expanded in re around 0 29.4%
if 1 < 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%
Applied egg-rr5.3%
+-inverses5.3%
+-rgt-identity5.3%
*-inverses5.3%
Simplified5.3%
Final simplification23.8%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\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-rr2.8%
pow-base-12.8%
metadata-eval2.8%
Simplified2.8%
Final simplification2.8%
(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-rr3.9%
+-inverses3.9%
+-rgt-identity3.9%
*-inverses3.9%
Simplified3.9%
Final simplification3.9%
herbie shell --seed 2024069
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))