
(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-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= im 2.0)
(* (sin re) (fma (* im im) 0.5 1.0))
(if (<= im 1.28e+154)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(* 0.5 (* (sin re) (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 2.0) {
tmp = sin(re) * fma((im * im), 0.5, 1.0);
} else if (im <= 1.28e+154) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = 0.5 * (sin(re) * (im * im));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 2.0) tmp = Float64(sin(re) * fma(Float64(im * im), 0.5, 1.0)); elseif (im <= 1.28e+154) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = Float64(0.5 * Float64(sin(re) * Float64(im * im))); end return tmp end
code[re_, im_] := If[LessEqual[im, 2.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.28e+154], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(im \cdot im, 0.5, 1\right)\\
\mathbf{elif}\;im \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 2Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 83.2%
Simplified83.2%
Taylor expanded in re around inf 83.2%
associate-*r*83.2%
distribute-rgt1-in83.2%
*-commutative83.2%
fma-def83.2%
unpow283.2%
Simplified83.2%
if 2 < im < 1.2800000000000001e154Initial program 100.0%
distribute-lft-in99.9%
*-commutative99.9%
cancel-sign-sub99.9%
distribute-lft-neg-out99.9%
*-commutative99.9%
distribute-rgt-neg-out99.9%
neg-mul-199.9%
associate-*r*99.9%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 75.0%
if 1.2800000000000001e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification84.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (sin re) (* im im)))))
(if (<= im 2.0)
(+ (sin re) t_0)
(if (<= im 1.28e+154) (* (+ (exp (- im)) (exp im)) (* 0.5 re)) t_0))))
double code(double re, double im) {
double t_0 = 0.5 * (sin(re) * (im * im));
double tmp;
if (im <= 2.0) {
tmp = sin(re) + t_0;
} else if (im <= 1.28e+154) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (sin(re) * (im * im))
if (im <= 2.0d0) then
tmp = sin(re) + t_0
else if (im <= 1.28d+154) then
tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.sin(re) * (im * im));
double tmp;
if (im <= 2.0) {
tmp = Math.sin(re) + t_0;
} else if (im <= 1.28e+154) {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.sin(re) * (im * im)) tmp = 0 if im <= 2.0: tmp = math.sin(re) + t_0 elif im <= 1.28e+154: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(sin(re) * Float64(im * im))) tmp = 0.0 if (im <= 2.0) tmp = Float64(sin(re) + t_0); elseif (im <= 1.28e+154) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (sin(re) * (im * im)); tmp = 0.0; if (im <= 2.0) tmp = sin(re) + t_0; elseif (im <= 1.28e+154) tmp = (exp(-im) + exp(im)) * (0.5 * re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 2.0], N[(N[Sin[re], $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[im, 1.28e+154], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
\mathbf{if}\;im \leq 2:\\
\;\;\;\;\sin re + t_0\\
\mathbf{elif}\;im \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < 2Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 83.2%
Simplified83.2%
if 2 < im < 1.2800000000000001e154Initial program 100.0%
distribute-lft-in99.9%
*-commutative99.9%
cancel-sign-sub99.9%
distribute-lft-neg-out99.9%
*-commutative99.9%
distribute-rgt-neg-out99.9%
neg-mul-199.9%
associate-*r*99.9%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 75.0%
if 1.2800000000000001e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification84.7%
(FPCore (re im)
:precision binary64
(if (<= im 660.0)
(* (sin re) (fma (* im im) 0.5 1.0))
(if (<= im 3.25e+38)
(+
(/ 0.25 (* re re))
(fma re (* re 0.016666666666666666) 0.08333333333333333))
(if (<= im 1.28e+154)
(+ re (* 0.041666666666666664 (* re (pow im 4.0))))
(* 0.5 (* (sin re) (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= 660.0) {
tmp = sin(re) * fma((im * im), 0.5, 1.0);
} else if (im <= 3.25e+38) {
tmp = (0.25 / (re * re)) + fma(re, (re * 0.016666666666666666), 0.08333333333333333);
} else if (im <= 1.28e+154) {
tmp = re + (0.041666666666666664 * (re * pow(im, 4.0)));
} else {
tmp = 0.5 * (sin(re) * (im * im));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 660.0) tmp = Float64(sin(re) * fma(Float64(im * im), 0.5, 1.0)); elseif (im <= 3.25e+38) tmp = Float64(Float64(0.25 / Float64(re * re)) + fma(re, Float64(re * 0.016666666666666666), 0.08333333333333333)); elseif (im <= 1.28e+154) tmp = Float64(re + Float64(0.041666666666666664 * Float64(re * (im ^ 4.0)))); else tmp = Float64(0.5 * Float64(sin(re) * Float64(im * im))); end return tmp end
code[re_, im_] := If[LessEqual[im, 660.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.25e+38], N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re * N[(re * 0.016666666666666666), $MachinePrecision] + 0.08333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.28e+154], N[(re + N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 660:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(im \cdot im, 0.5, 1\right)\\
\mathbf{elif}\;im \leq 3.25 \cdot 10^{+38}:\\
\;\;\;\;\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)\\
\mathbf{elif}\;im \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;re + 0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 660Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 82.8%
Simplified82.8%
Taylor expanded in re around inf 82.8%
associate-*r*82.8%
distribute-rgt1-in82.8%
*-commutative82.8%
fma-def82.8%
unpow282.8%
Simplified82.8%
if 660 < im < 3.25e38Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr26.1%
Taylor expanded in re around 0 50.1%
+-commutative50.1%
+-commutative50.1%
associate-+l+50.1%
associate-*r/50.1%
metadata-eval50.1%
unpow250.1%
*-commutative50.1%
unpow250.1%
associate-*l*50.1%
fma-def50.1%
Simplified50.1%
if 3.25e38 < im < 1.2800000000000001e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 80.0%
Taylor expanded in im around 0 48.0%
associate-*r*48.0%
associate-*r*48.0%
distribute-rgt-out48.0%
+-commutative48.0%
*-commutative48.0%
unpow248.0%
Simplified48.0%
Taylor expanded in im around inf 48.0%
if 1.2800000000000001e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification82.5%
(FPCore (re im)
:precision binary64
(if (<= im 700.0)
(sin re)
(if (<= im 4e+38)
(+
(/ 0.25 (* re re))
(fma re (* re 0.016666666666666666) 0.08333333333333333))
(if (<= im 1.28e+154)
(+ re (* 0.041666666666666664 (* re (pow im 4.0))))
(* 0.5 (* (sin re) (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= 700.0) {
tmp = sin(re);
} else if (im <= 4e+38) {
tmp = (0.25 / (re * re)) + fma(re, (re * 0.016666666666666666), 0.08333333333333333);
} else if (im <= 1.28e+154) {
tmp = re + (0.041666666666666664 * (re * pow(im, 4.0)));
} else {
tmp = 0.5 * (sin(re) * (im * im));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 700.0) tmp = sin(re); elseif (im <= 4e+38) tmp = Float64(Float64(0.25 / Float64(re * re)) + fma(re, Float64(re * 0.016666666666666666), 0.08333333333333333)); elseif (im <= 1.28e+154) tmp = Float64(re + Float64(0.041666666666666664 * Float64(re * (im ^ 4.0)))); else tmp = Float64(0.5 * Float64(sin(re) * Float64(im * im))); end return tmp end
code[re_, im_] := If[LessEqual[im, 700.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 4e+38], N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(re * N[(re * 0.016666666666666666), $MachinePrecision] + 0.08333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.28e+154], N[(re + N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 700:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4 \cdot 10^{+38}:\\
\;\;\;\;\frac{0.25}{re \cdot re} + \mathsf{fma}\left(re, re \cdot 0.016666666666666666, 0.08333333333333333\right)\\
\mathbf{elif}\;im \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;re + 0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 700Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 65.2%
if 700 < im < 3.99999999999999991e38Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr26.1%
Taylor expanded in re around 0 50.1%
+-commutative50.1%
+-commutative50.1%
associate-+l+50.1%
associate-*r/50.1%
metadata-eval50.1%
unpow250.1%
*-commutative50.1%
unpow250.1%
associate-*l*50.1%
fma-def50.1%
Simplified50.1%
if 3.99999999999999991e38 < im < 1.2800000000000001e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 80.0%
Taylor expanded in im around 0 48.0%
associate-*r*48.0%
associate-*r*48.0%
distribute-rgt-out48.0%
+-commutative48.0%
*-commutative48.0%
unpow248.0%
Simplified48.0%
Taylor expanded in im around inf 48.0%
if 1.2800000000000001e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification68.5%
(FPCore (re im)
:precision binary64
(if (<= im 42000000.0)
(sin re)
(if (<= im 3.2e+52)
(+ re (* -0.16666666666666666 (pow re 3.0)))
(if (<= im 1.28e+154)
(+ re (* 0.041666666666666664 (* re (pow im 4.0))))
(* 0.5 (* (sin re) (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= 42000000.0) {
tmp = sin(re);
} else if (im <= 3.2e+52) {
tmp = re + (-0.16666666666666666 * pow(re, 3.0));
} else if (im <= 1.28e+154) {
tmp = re + (0.041666666666666664 * (re * pow(im, 4.0)));
} else {
tmp = 0.5 * (sin(re) * (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 42000000.0d0) then
tmp = sin(re)
else if (im <= 3.2d+52) then
tmp = re + ((-0.16666666666666666d0) * (re ** 3.0d0))
else if (im <= 1.28d+154) then
tmp = re + (0.041666666666666664d0 * (re * (im ** 4.0d0)))
else
tmp = 0.5d0 * (sin(re) * (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 42000000.0) {
tmp = Math.sin(re);
} else if (im <= 3.2e+52) {
tmp = re + (-0.16666666666666666 * Math.pow(re, 3.0));
} else if (im <= 1.28e+154) {
tmp = re + (0.041666666666666664 * (re * Math.pow(im, 4.0)));
} else {
tmp = 0.5 * (Math.sin(re) * (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 42000000.0: tmp = math.sin(re) elif im <= 3.2e+52: tmp = re + (-0.16666666666666666 * math.pow(re, 3.0)) elif im <= 1.28e+154: tmp = re + (0.041666666666666664 * (re * math.pow(im, 4.0))) else: tmp = 0.5 * (math.sin(re) * (im * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 42000000.0) tmp = sin(re); elseif (im <= 3.2e+52) tmp = Float64(re + Float64(-0.16666666666666666 * (re ^ 3.0))); elseif (im <= 1.28e+154) tmp = Float64(re + Float64(0.041666666666666664 * Float64(re * (im ^ 4.0)))); else tmp = Float64(0.5 * Float64(sin(re) * Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 42000000.0) tmp = sin(re); elseif (im <= 3.2e+52) tmp = re + (-0.16666666666666666 * (re ^ 3.0)); elseif (im <= 1.28e+154) tmp = re + (0.041666666666666664 * (re * (im ^ 4.0))); else tmp = 0.5 * (sin(re) * (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 42000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.2e+52], N[(re + N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.28e+154], N[(re + N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 42000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3.2 \cdot 10^{+52}:\\
\;\;\;\;re + -0.16666666666666666 \cdot {re}^{3}\\
\mathbf{elif}\;im \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;re + 0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 4.2e7Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 65.2%
if 4.2e7 < im < 3.2e52Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 2.9%
Taylor expanded in re around 0 42.0%
if 3.2e52 < im < 1.2800000000000001e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 85.7%
Taylor expanded in im around 0 51.4%
associate-*r*51.4%
associate-*r*51.4%
distribute-rgt-out51.4%
+-commutative51.4%
*-commutative51.4%
unpow251.4%
Simplified51.4%
Taylor expanded in im around inf 51.4%
if 1.2800000000000001e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification68.5%
(FPCore (re im)
:precision binary64
(if (<= im 900.0)
(sin re)
(if (<= im 1.7e+74)
(pow re -512.0)
(if (<= im 1.3e+176)
(* re (+ 1.0 (* 0.5 (* im im))))
(* im (* 0.5 (* (sin re) im)))))))
double code(double re, double im) {
double tmp;
if (im <= 900.0) {
tmp = sin(re);
} else if (im <= 1.7e+74) {
tmp = pow(re, -512.0);
} else if (im <= 1.3e+176) {
tmp = re * (1.0 + (0.5 * (im * im)));
} else {
tmp = im * (0.5 * (sin(re) * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 900.0d0) then
tmp = sin(re)
else if (im <= 1.7d+74) then
tmp = re ** (-512.0d0)
else if (im <= 1.3d+176) then
tmp = re * (1.0d0 + (0.5d0 * (im * im)))
else
tmp = im * (0.5d0 * (sin(re) * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 900.0) {
tmp = Math.sin(re);
} else if (im <= 1.7e+74) {
tmp = Math.pow(re, -512.0);
} else if (im <= 1.3e+176) {
tmp = re * (1.0 + (0.5 * (im * im)));
} else {
tmp = im * (0.5 * (Math.sin(re) * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 900.0: tmp = math.sin(re) elif im <= 1.7e+74: tmp = math.pow(re, -512.0) elif im <= 1.3e+176: tmp = re * (1.0 + (0.5 * (im * im))) else: tmp = im * (0.5 * (math.sin(re) * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 900.0) tmp = sin(re); elseif (im <= 1.7e+74) tmp = re ^ -512.0; elseif (im <= 1.3e+176) tmp = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im)))); else tmp = Float64(im * Float64(0.5 * Float64(sin(re) * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 900.0) tmp = sin(re); elseif (im <= 1.7e+74) tmp = re ^ -512.0; elseif (im <= 1.3e+176) tmp = re * (1.0 + (0.5 * (im * im))); else tmp = im * (0.5 * (sin(re) * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 900.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.7e+74], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 1.3e+176], N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * N[(0.5 * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 900:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+74}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 1.3 \cdot 10^{+176}:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(\sin re \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 900Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 65.2%
if 900 < im < 1.7e74Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 70.0%
Applied egg-rr30.6%
if 1.7e74 < im < 1.29999999999999995e176Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 52.5%
Simplified52.5%
Taylor expanded in re around 0 56.8%
*-commutative56.8%
unpow256.8%
Simplified56.8%
if 1.29999999999999995e176 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*96.0%
associate-*l*96.0%
Simplified96.0%
Final simplification66.2%
(FPCore (re im) :precision binary64 (if (<= im 1800.0) (sin re) (if (<= im 6.5e+131) (pow re -512.0) (* 0.5 (* (sin re) (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 1800.0) {
tmp = sin(re);
} else if (im <= 6.5e+131) {
tmp = pow(re, -512.0);
} else {
tmp = 0.5 * (sin(re) * (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1800.0d0) then
tmp = sin(re)
else if (im <= 6.5d+131) then
tmp = re ** (-512.0d0)
else
tmp = 0.5d0 * (sin(re) * (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1800.0) {
tmp = Math.sin(re);
} else if (im <= 6.5e+131) {
tmp = Math.pow(re, -512.0);
} else {
tmp = 0.5 * (Math.sin(re) * (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1800.0: tmp = math.sin(re) elif im <= 6.5e+131: tmp = math.pow(re, -512.0) else: tmp = 0.5 * (math.sin(re) * (im * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1800.0) tmp = sin(re); elseif (im <= 6.5e+131) tmp = re ^ -512.0; else tmp = Float64(0.5 * Float64(sin(re) * Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1800.0) tmp = sin(re); elseif (im <= 6.5e+131) tmp = re ^ -512.0; else tmp = 0.5 * (sin(re) * (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1800.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 6.5e+131], N[Power[re, -512.0], $MachinePrecision], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1800:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+131}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 1800Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 65.2%
if 1800 < im < 6.5e131Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 70.6%
Applied egg-rr24.4%
if 6.5e131 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 94.5%
Simplified94.5%
Taylor expanded in im around inf 94.5%
*-commutative94.5%
unpow294.5%
Simplified94.5%
Final simplification66.5%
(FPCore (re im) :precision binary64 (if (<= im 960.0) (sin re) (if (<= im 1.8e+74) (pow re -512.0) (* re (+ 1.0 (* 0.5 (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= 960.0) {
tmp = sin(re);
} else if (im <= 1.8e+74) {
tmp = pow(re, -512.0);
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 960.0d0) then
tmp = sin(re)
else if (im <= 1.8d+74) then
tmp = re ** (-512.0d0)
else
tmp = re * (1.0d0 + (0.5d0 * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 960.0) {
tmp = Math.sin(re);
} else if (im <= 1.8e+74) {
tmp = Math.pow(re, -512.0);
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 960.0: tmp = math.sin(re) elif im <= 1.8e+74: tmp = math.pow(re, -512.0) else: tmp = re * (1.0 + (0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= 960.0) tmp = sin(re); elseif (im <= 1.8e+74) tmp = re ^ -512.0; else tmp = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 960.0) tmp = sin(re); elseif (im <= 1.8e+74) tmp = re ^ -512.0; else tmp = re * (1.0 + (0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 960.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.8e+74], N[Power[re, -512.0], $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 960:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+74}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 960Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 65.2%
if 960 < im < 1.79999999999999994e74Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 70.0%
Applied egg-rr30.6%
if 1.79999999999999994e74 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 79.6%
Simplified79.6%
Taylor expanded in re around 0 55.3%
*-commutative55.3%
unpow255.3%
Simplified55.3%
Final simplification62.3%
(FPCore (re im) :precision binary64 (if (<= im 1150.0) (sin re) (if (<= im 4.2e+54) (/ 0.25 (* re re)) (* re (+ 1.0 (* 0.5 (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= 1150.0) {
tmp = sin(re);
} else if (im <= 4.2e+54) {
tmp = 0.25 / (re * re);
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1150.0d0) then
tmp = sin(re)
else if (im <= 4.2d+54) then
tmp = 0.25d0 / (re * re)
else
tmp = re * (1.0d0 + (0.5d0 * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1150.0) {
tmp = Math.sin(re);
} else if (im <= 4.2e+54) {
tmp = 0.25 / (re * re);
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1150.0: tmp = math.sin(re) elif im <= 4.2e+54: tmp = 0.25 / (re * re) else: tmp = re * (1.0 + (0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= 1150.0) tmp = sin(re); elseif (im <= 4.2e+54) tmp = Float64(0.25 / Float64(re * re)); else tmp = Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1150.0) tmp = sin(re); elseif (im <= 4.2e+54) tmp = 0.25 / (re * re); else tmp = re * (1.0 + (0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1150.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 4.2e+54], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1150:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+54}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 1150Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 65.2%
if 1150 < im < 4.19999999999999972e54Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr21.0%
Taylor expanded in re around 0 21.2%
unpow221.2%
Simplified21.2%
if 4.19999999999999972e54 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 71.5%
Simplified71.5%
Taylor expanded in re around 0 49.7%
*-commutative49.7%
unpow249.7%
Simplified49.7%
Final simplification61.5%
(FPCore (re im)
:precision binary64
(if (<= im 850.0)
re
(if (<= im 1.5e+236)
(+ (/ 0.25 (* re re)) 0.08333333333333333)
(* re (* re -4.0)))))
double code(double re, double im) {
double tmp;
if (im <= 850.0) {
tmp = re;
} else if (im <= 1.5e+236) {
tmp = (0.25 / (re * re)) + 0.08333333333333333;
} else {
tmp = re * (re * -4.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 850.0d0) then
tmp = re
else if (im <= 1.5d+236) then
tmp = (0.25d0 / (re * re)) + 0.08333333333333333d0
else
tmp = re * (re * (-4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 850.0) {
tmp = re;
} else if (im <= 1.5e+236) {
tmp = (0.25 / (re * re)) + 0.08333333333333333;
} else {
tmp = re * (re * -4.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 850.0: tmp = re elif im <= 1.5e+236: tmp = (0.25 / (re * re)) + 0.08333333333333333 else: tmp = re * (re * -4.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 850.0) tmp = re; elseif (im <= 1.5e+236) tmp = Float64(Float64(0.25 / Float64(re * re)) + 0.08333333333333333); else tmp = Float64(re * Float64(re * -4.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 850.0) tmp = re; elseif (im <= 1.5e+236) tmp = (0.25 / (re * re)) + 0.08333333333333333; else tmp = re * (re * -4.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 850.0], re, If[LessEqual[im, 1.5e+236], N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + 0.08333333333333333), $MachinePrecision], N[(re * N[(re * -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 850:\\
\;\;\;\;re\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+236}:\\
\;\;\;\;\frac{0.25}{re \cdot re} + 0.08333333333333333\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot -4\right)\\
\end{array}
\end{array}
if im < 850Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 57.0%
Taylor expanded in im around 0 32.8%
if 850 < im < 1.4999999999999999e236Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr12.3%
Taylor expanded in re around 0 12.3%
associate-*r/12.3%
metadata-eval12.3%
unpow212.3%
Simplified12.3%
if 1.4999999999999999e236 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 2.9%
Applied egg-rr1.9%
Taylor expanded in re around 0 20.5%
unpow220.5%
*-commutative20.5%
associate-*l*20.5%
Simplified20.5%
Final simplification29.1%
(FPCore (re im) :precision binary64 (if (<= im 1100.0) re (if (<= im 1.75e+236) (/ 0.25 (* re re)) (* re (* re -4.0)))))
double code(double re, double im) {
double tmp;
if (im <= 1100.0) {
tmp = re;
} else if (im <= 1.75e+236) {
tmp = 0.25 / (re * re);
} else {
tmp = re * (re * -4.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1100.0d0) then
tmp = re
else if (im <= 1.75d+236) then
tmp = 0.25d0 / (re * re)
else
tmp = re * (re * (-4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1100.0) {
tmp = re;
} else if (im <= 1.75e+236) {
tmp = 0.25 / (re * re);
} else {
tmp = re * (re * -4.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1100.0: tmp = re elif im <= 1.75e+236: tmp = 0.25 / (re * re) else: tmp = re * (re * -4.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 1100.0) tmp = re; elseif (im <= 1.75e+236) tmp = Float64(0.25 / Float64(re * re)); else tmp = Float64(re * Float64(re * -4.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1100.0) tmp = re; elseif (im <= 1.75e+236) tmp = 0.25 / (re * re); else tmp = re * (re * -4.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1100.0], re, If[LessEqual[im, 1.75e+236], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1100:\\
\;\;\;\;re\\
\mathbf{elif}\;im \leq 1.75 \cdot 10^{+236}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot -4\right)\\
\end{array}
\end{array}
if im < 1100Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 57.0%
Taylor expanded in im around 0 32.8%
if 1100 < im < 1.7499999999999999e236Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr12.3%
Taylor expanded in re around 0 12.3%
unpow212.3%
Simplified12.3%
if 1.7499999999999999e236 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 2.9%
Applied egg-rr1.9%
Taylor expanded in re around 0 20.5%
unpow220.5%
*-commutative20.5%
associate-*l*20.5%
Simplified20.5%
Final simplification29.1%
(FPCore (re im) :precision binary64 (* re (+ 1.0 (* 0.5 (* im im)))))
double code(double re, double im) {
return re * (1.0 + (0.5 * (im * im)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re * (1.0d0 + (0.5d0 * (im * im)))
end function
public static double code(double re, double im) {
return re * (1.0 + (0.5 * (im * im)));
}
def code(re, im): return re * (1.0 + (0.5 * (im * im)))
function code(re, im) return Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im)))) end
function tmp = code(re, im) tmp = re * (1.0 + (0.5 * (im * im))); end
code[re_, im_] := N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)
\end{array}
Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 79.2%
Simplified79.2%
Taylor expanded in re around 0 47.5%
*-commutative47.5%
unpow247.5%
Simplified47.5%
Final simplification47.5%
(FPCore (re im) :precision binary64 (if (<= im 2800000.0) re (* re (* re -4.0))))
double code(double re, double im) {
double tmp;
if (im <= 2800000.0) {
tmp = re;
} else {
tmp = re * (re * -4.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2800000.0d0) then
tmp = re
else
tmp = re * (re * (-4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2800000.0) {
tmp = re;
} else {
tmp = re * (re * -4.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2800000.0: tmp = re else: tmp = re * (re * -4.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 2800000.0) tmp = re; else tmp = Float64(re * Float64(re * -4.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2800000.0) tmp = re; else tmp = re * (re * -4.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2800000.0], re, N[(re * N[(re * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2800000:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot -4\right)\\
\end{array}
\end{array}
if im < 2.8e6Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 57.0%
Taylor expanded in im around 0 32.8%
if 2.8e6 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 2.7%
Applied egg-rr2.0%
Taylor expanded in re around 0 15.8%
unpow215.8%
*-commutative15.8%
associate-*l*15.8%
Simplified15.8%
Final simplification29.3%
(FPCore (re im) :precision binary64 -2.0)
double code(double re, double im) {
return -2.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -2.0d0
end function
public static double code(double re, double im) {
return -2.0;
}
def code(re, im): return -2.0
function code(re, im) return -2.0 end
function tmp = code(re, im) tmp = -2.0; end
code[re_, im_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 79.2%
Simplified79.2%
Applied egg-rr4.2%
Taylor expanded in re around 0 4.3%
Final simplification4.3%
(FPCore (re im) :precision binary64 re)
double code(double re, double im) {
return re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re
end function
public static double code(double re, double im) {
return re;
}
def code(re, im): return re
function code(re, im) return re end
function tmp = code(re, im) tmp = re; end
code[re_, im_] := re
\begin{array}{l}
\\
re
\end{array}
Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 59.1%
Taylor expanded in im around 0 26.6%
Final simplification26.6%
herbie shell --seed 2023279
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))