
(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 22 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 (* (sin re) (* 0.5 (+ (exp (- im)) (exp im)))))
double code(double re, double im) {
return sin(re) * (0.5 * (exp(-im) + exp(im)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (0.5d0 * (exp(-im) + exp(im)))
end function
public static double code(double re, double im) {
return Math.sin(re) * (0.5 * (Math.exp(-im) + Math.exp(im)));
}
def code(re, im): return math.sin(re) * (0.5 * (math.exp(-im) + math.exp(im)))
function code(re, im) return Float64(sin(re) * Float64(0.5 * Float64(exp(Float64(-im)) + exp(im)))) end
function tmp = code(re, im) tmp = sin(re) * (0.5 * (exp(-im) + exp(im))); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left(0.5 \cdot \left(e^{-im} + e^{im}\right)\right)
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* re 0.5) (+ (exp (- im)) (exp im)))))
(if (<= im -2.35e+103)
(*
(sin re)
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
(if (<= im -0.0225)
t_0
(if (<= im 4.7e-5)
(* (sin re) (+ 1.0 (* im (* 0.5 im))))
(if (<= im 2.8e+70)
t_0
(* 0.041666666666666664 (* (sin re) (pow im 4.0)))))))))
double code(double re, double im) {
double t_0 = (re * 0.5) * (exp(-im) + exp(im));
double tmp;
if (im <= -2.35e+103) {
tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
} else if (im <= -0.0225) {
tmp = t_0;
} else if (im <= 4.7e-5) {
tmp = sin(re) * (1.0 + (im * (0.5 * im)));
} else if (im <= 2.8e+70) {
tmp = t_0;
} else {
tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.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 = (re * 0.5d0) * (exp(-im) + exp(im))
if (im <= (-2.35d+103)) then
tmp = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
else if (im <= (-0.0225d0)) then
tmp = t_0
else if (im <= 4.7d-5) then
tmp = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
else if (im <= 2.8d+70) then
tmp = t_0
else
tmp = 0.041666666666666664d0 * (sin(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (re * 0.5) * (Math.exp(-im) + Math.exp(im));
double tmp;
if (im <= -2.35e+103) {
tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
} else if (im <= -0.0225) {
tmp = t_0;
} else if (im <= 4.7e-5) {
tmp = Math.sin(re) * (1.0 + (im * (0.5 * im)));
} else if (im <= 2.8e+70) {
tmp = t_0;
} else {
tmp = 0.041666666666666664 * (Math.sin(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): t_0 = (re * 0.5) * (math.exp(-im) + math.exp(im)) tmp = 0 if im <= -2.35e+103: tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) elif im <= -0.0225: tmp = t_0 elif im <= 4.7e-5: tmp = math.sin(re) * (1.0 + (im * (0.5 * im))) elif im <= 2.8e+70: tmp = t_0 else: tmp = 0.041666666666666664 * (math.sin(re) * math.pow(im, 4.0)) return tmp
function code(re, im) t_0 = Float64(Float64(re * 0.5) * Float64(exp(Float64(-im)) + exp(im))) tmp = 0.0 if (im <= -2.35e+103) tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); elseif (im <= -0.0225) tmp = t_0; elseif (im <= 4.7e-5) tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im)))); elseif (im <= 2.8e+70) tmp = t_0; else tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) t_0 = (re * 0.5) * (exp(-im) + exp(im)); tmp = 0.0; if (im <= -2.35e+103) tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); elseif (im <= -0.0225) tmp = t_0; elseif (im <= 4.7e-5) tmp = sin(re) * (1.0 + (im * (0.5 * im))); elseif (im <= 2.8e+70) tmp = t_0; else tmp = 0.041666666666666664 * (sin(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * 0.5), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.35e+103], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -0.0225], t$95$0, If[LessEqual[im, 4.7e-5], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.8e+70], t$95$0, N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(re \cdot 0.5\right) \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{if}\;im \leq -2.35 \cdot 10^{+103}:\\
\;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{elif}\;im \leq -0.0225:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 4.7 \cdot 10^{-5}:\\
\;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{elif}\;im \leq 2.8 \cdot 10^{+70}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < -2.35000000000000016e103Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-rgt-identity100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
distribute-lft-out100.0%
metadata-eval100.0%
pow-sqr100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
unpow2100.0%
unpow2100.0%
Simplified100.0%
if -2.35000000000000016e103 < im < -0.022499999999999999 or 4.69999999999999972e-5 < im < 2.7999999999999999e70Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 82.1%
associate-*r*82.1%
Simplified82.1%
if -0.022499999999999999 < im < 4.69999999999999972e-5Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt1-in100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
if 2.7999999999999999e70 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.1%
*-rgt-identity98.1%
*-commutative98.1%
associate-*r*98.1%
*-commutative98.1%
associate-*r*98.1%
distribute-rgt-out98.1%
distribute-lft-out98.1%
metadata-eval98.1%
pow-sqr98.1%
associate-*r*98.1%
distribute-rgt-out98.1%
unpow298.1%
unpow298.1%
Simplified98.1%
Taylor expanded in im around inf 98.1%
Final simplification96.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (sin re) (* im im))))
(t_1
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))
(t_2
(*
re
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
(if (<= im -5.8e+174)
t_0
(if (<= im -2.4e+68)
t_2
(if (<= im -210000000000.0)
t_1
(if (<= im 450.0)
(sin re)
(if (<= im 3.8e+55) t_1 (if (<= im 1.8e+150) t_2 t_0))))))))
double code(double re, double im) {
double t_0 = 0.5 * (sin(re) * (im * im));
double t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
double t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= -5.8e+174) {
tmp = t_0;
} else if (im <= -2.4e+68) {
tmp = t_2;
} else if (im <= -210000000000.0) {
tmp = t_1;
} else if (im <= 450.0) {
tmp = sin(re);
} else if (im <= 3.8e+55) {
tmp = t_1;
} else if (im <= 1.8e+150) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.5d0 * (sin(re) * (im * im))
t_1 = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
t_2 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
if (im <= (-5.8d+174)) then
tmp = t_0
else if (im <= (-2.4d+68)) then
tmp = t_2
else if (im <= (-210000000000.0d0)) then
tmp = t_1
else if (im <= 450.0d0) then
tmp = sin(re)
else if (im <= 3.8d+55) then
tmp = t_1
else if (im <= 1.8d+150) then
tmp = t_2
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.sin(re) * (im * im));
double t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
double t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= -5.8e+174) {
tmp = t_0;
} else if (im <= -2.4e+68) {
tmp = t_2;
} else if (im <= -210000000000.0) {
tmp = t_1;
} else if (im <= 450.0) {
tmp = Math.sin(re);
} else if (im <= 3.8e+55) {
tmp = t_1;
} else if (im <= 1.8e+150) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.sin(re) * (im * im)) t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) tmp = 0 if im <= -5.8e+174: tmp = t_0 elif im <= -2.4e+68: tmp = t_2 elif im <= -210000000000.0: tmp = t_1 elif im <= 450.0: tmp = math.sin(re) elif im <= 3.8e+55: tmp = t_1 elif im <= 1.8e+150: tmp = t_2 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(sin(re) * Float64(im * im))) t_1 = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))) t_2 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))) tmp = 0.0 if (im <= -5.8e+174) tmp = t_0; elseif (im <= -2.4e+68) tmp = t_2; elseif (im <= -210000000000.0) tmp = t_1; elseif (im <= 450.0) tmp = sin(re); elseif (im <= 3.8e+55) tmp = t_1; elseif (im <= 1.8e+150) tmp = t_2; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (sin(re) * (im * im)); t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); tmp = 0.0; if (im <= -5.8e+174) tmp = t_0; elseif (im <= -2.4e+68) tmp = t_2; elseif (im <= -210000000000.0) tmp = t_1; elseif (im <= 450.0) tmp = sin(re); elseif (im <= 3.8e+55) tmp = t_1; elseif (im <= 1.8e+150) tmp = t_2; 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]}, Block[{t$95$1 = N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.8e+174], t$95$0, If[LessEqual[im, -2.4e+68], t$95$2, If[LessEqual[im, -210000000000.0], t$95$1, If[LessEqual[im, 450.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.8e+55], t$95$1, If[LessEqual[im, 1.8e+150], t$95$2, t$95$0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
t_1 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
t_2 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq -5.8 \cdot 10^{+174}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -2.4 \cdot 10^{+68}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -210000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 450:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3.8 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.7999999999999999e174 or 1.79999999999999993e150 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
*-commutative98.3%
associate-*r*98.3%
distribute-rgt1-in98.3%
*-commutative98.3%
unpow298.3%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in im around inf 98.3%
*-commutative98.3%
unpow298.3%
Simplified98.3%
if -5.7999999999999999e174 < im < -2.40000000000000008e68 or 3.8e55 < im < 1.79999999999999993e150Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 92.5%
*-rgt-identity92.5%
*-commutative92.5%
associate-*r*92.5%
*-commutative92.5%
associate-*r*92.5%
distribute-rgt-out92.5%
distribute-lft-out92.5%
metadata-eval92.5%
pow-sqr92.5%
associate-*r*92.5%
distribute-rgt-out92.5%
unpow292.5%
unpow292.5%
Simplified92.5%
Taylor expanded in re around 0 65.4%
*-commutative65.4%
unpow265.4%
unpow265.4%
Simplified65.4%
if -2.40000000000000008e68 < im < -2.1e11 or 450 < im < 3.8e55Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr32.1%
Taylor expanded in re around 0 47.4%
associate-*r/47.4%
metadata-eval47.4%
unpow247.4%
*-commutative47.4%
unpow247.4%
Simplified47.4%
if -2.1e11 < im < 450Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.8%
Final simplification86.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (sin re) (* im im))))
(t_1
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))
(t_2
(*
re
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
(if (<= im -5.8e+174)
t_0
(if (<= im -1.2e+71)
t_2
(if (<= im -2.7e+21)
t_1
(if (<= im 700.0)
(* (sin re) (+ 1.0 (* im (* 0.5 im))))
(if (<= im 4.8e+54) t_1 (if (<= im 1.8e+150) t_2 t_0))))))))
double code(double re, double im) {
double t_0 = 0.5 * (sin(re) * (im * im));
double t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
double t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= -5.8e+174) {
tmp = t_0;
} else if (im <= -1.2e+71) {
tmp = t_2;
} else if (im <= -2.7e+21) {
tmp = t_1;
} else if (im <= 700.0) {
tmp = sin(re) * (1.0 + (im * (0.5 * im)));
} else if (im <= 4.8e+54) {
tmp = t_1;
} else if (im <= 1.8e+150) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.5d0 * (sin(re) * (im * im))
t_1 = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
t_2 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
if (im <= (-5.8d+174)) then
tmp = t_0
else if (im <= (-1.2d+71)) then
tmp = t_2
else if (im <= (-2.7d+21)) then
tmp = t_1
else if (im <= 700.0d0) then
tmp = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
else if (im <= 4.8d+54) then
tmp = t_1
else if (im <= 1.8d+150) then
tmp = t_2
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.sin(re) * (im * im));
double t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
double t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= -5.8e+174) {
tmp = t_0;
} else if (im <= -1.2e+71) {
tmp = t_2;
} else if (im <= -2.7e+21) {
tmp = t_1;
} else if (im <= 700.0) {
tmp = Math.sin(re) * (1.0 + (im * (0.5 * im)));
} else if (im <= 4.8e+54) {
tmp = t_1;
} else if (im <= 1.8e+150) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.sin(re) * (im * im)) t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) tmp = 0 if im <= -5.8e+174: tmp = t_0 elif im <= -1.2e+71: tmp = t_2 elif im <= -2.7e+21: tmp = t_1 elif im <= 700.0: tmp = math.sin(re) * (1.0 + (im * (0.5 * im))) elif im <= 4.8e+54: tmp = t_1 elif im <= 1.8e+150: tmp = t_2 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(sin(re) * Float64(im * im))) t_1 = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))) t_2 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))) tmp = 0.0 if (im <= -5.8e+174) tmp = t_0; elseif (im <= -1.2e+71) tmp = t_2; elseif (im <= -2.7e+21) tmp = t_1; elseif (im <= 700.0) tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im)))); elseif (im <= 4.8e+54) tmp = t_1; elseif (im <= 1.8e+150) tmp = t_2; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (sin(re) * (im * im)); t_1 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); t_2 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); tmp = 0.0; if (im <= -5.8e+174) tmp = t_0; elseif (im <= -1.2e+71) tmp = t_2; elseif (im <= -2.7e+21) tmp = t_1; elseif (im <= 700.0) tmp = sin(re) * (1.0 + (im * (0.5 * im))); elseif (im <= 4.8e+54) tmp = t_1; elseif (im <= 1.8e+150) tmp = t_2; 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]}, Block[{t$95$1 = N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.8e+174], t$95$0, If[LessEqual[im, -1.2e+71], t$95$2, If[LessEqual[im, -2.7e+21], t$95$1, If[LessEqual[im, 700.0], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.8e+54], t$95$1, If[LessEqual[im, 1.8e+150], t$95$2, t$95$0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
t_1 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
t_2 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq -5.8 \cdot 10^{+174}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.2 \cdot 10^{+71}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -2.7 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 700:\\
\;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.7999999999999999e174 or 1.79999999999999993e150 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
*-commutative98.3%
associate-*r*98.3%
distribute-rgt1-in98.3%
*-commutative98.3%
unpow298.3%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in im around inf 98.3%
*-commutative98.3%
unpow298.3%
Simplified98.3%
if -5.7999999999999999e174 < im < -1.1999999999999999e71 or 4.79999999999999997e54 < im < 1.79999999999999993e150Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 92.5%
*-rgt-identity92.5%
*-commutative92.5%
associate-*r*92.5%
*-commutative92.5%
associate-*r*92.5%
distribute-rgt-out92.5%
distribute-lft-out92.5%
metadata-eval92.5%
pow-sqr92.5%
associate-*r*92.5%
distribute-rgt-out92.5%
unpow292.5%
unpow292.5%
Simplified92.5%
Taylor expanded in re around 0 65.4%
*-commutative65.4%
unpow265.4%
unpow265.4%
Simplified65.4%
if -1.1999999999999999e71 < im < -2.7e21 or 700 < im < 4.79999999999999997e54Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr39.2%
Taylor expanded in re around 0 58.0%
associate-*r/58.0%
metadata-eval58.0%
unpow258.0%
*-commutative58.0%
unpow258.0%
Simplified58.0%
if -2.7e21 < im < 700Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 94.9%
*-commutative94.9%
associate-*r*94.9%
distribute-rgt1-in94.9%
*-commutative94.9%
unpow294.9%
associate-*l*94.9%
Simplified94.9%
Final simplification86.9%
(FPCore (re im)
:precision binary64
(let* ((t_0
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))
(t_1
(*
re
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
(if (<= im -3.8e+71)
t_1
(if (<= im -210000000000.0)
t_0
(if (<= im 600.0)
(sin re)
(if (<= im 1.65e+54)
t_0
(if (<= im 2.5e+193) t_1 (* 0.5 (* im (* (sin re) im))))))))))
double code(double re, double im) {
double t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= -3.8e+71) {
tmp = t_1;
} else if (im <= -210000000000.0) {
tmp = t_0;
} else if (im <= 600.0) {
tmp = sin(re);
} else if (im <= 1.65e+54) {
tmp = t_0;
} else if (im <= 2.5e+193) {
tmp = t_1;
} else {
tmp = 0.5 * (im * (sin(re) * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
t_1 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
if (im <= (-3.8d+71)) then
tmp = t_1
else if (im <= (-210000000000.0d0)) then
tmp = t_0
else if (im <= 600.0d0) then
tmp = sin(re)
else if (im <= 1.65d+54) then
tmp = t_0
else if (im <= 2.5d+193) then
tmp = t_1
else
tmp = 0.5d0 * (im * (sin(re) * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= -3.8e+71) {
tmp = t_1;
} else if (im <= -210000000000.0) {
tmp = t_0;
} else if (im <= 600.0) {
tmp = Math.sin(re);
} else if (im <= 1.65e+54) {
tmp = t_0;
} else if (im <= 2.5e+193) {
tmp = t_1;
} else {
tmp = 0.5 * (im * (Math.sin(re) * im));
}
return tmp;
}
def code(re, im): t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) tmp = 0 if im <= -3.8e+71: tmp = t_1 elif im <= -210000000000.0: tmp = t_0 elif im <= 600.0: tmp = math.sin(re) elif im <= 1.65e+54: tmp = t_0 elif im <= 2.5e+193: tmp = t_1 else: tmp = 0.5 * (im * (math.sin(re) * im)) return tmp
function code(re, im) t_0 = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))) t_1 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))) tmp = 0.0 if (im <= -3.8e+71) tmp = t_1; elseif (im <= -210000000000.0) tmp = t_0; elseif (im <= 600.0) tmp = sin(re); elseif (im <= 1.65e+54) tmp = t_0; elseif (im <= 2.5e+193) tmp = t_1; else tmp = Float64(0.5 * Float64(im * Float64(sin(re) * im))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); tmp = 0.0; if (im <= -3.8e+71) tmp = t_1; elseif (im <= -210000000000.0) tmp = t_0; elseif (im <= 600.0) tmp = sin(re); elseif (im <= 1.65e+54) tmp = t_0; elseif (im <= 2.5e+193) tmp = t_1; else tmp = 0.5 * (im * (sin(re) * im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+71], t$95$1, If[LessEqual[im, -210000000000.0], t$95$0, If[LessEqual[im, 600.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.65e+54], t$95$0, If[LessEqual[im, 2.5e+193], t$95$1, N[(0.5 * N[(im * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
t_1 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq -3.8 \cdot 10^{+71}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -210000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 600:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.65 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2.5 \cdot 10^{+193}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(\sin re \cdot im\right)\right)\\
\end{array}
\end{array}
if im < -3.8000000000000001e71 or 1.65e54 < im < 2.49999999999999986e193Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 95.3%
*-rgt-identity95.3%
*-commutative95.3%
associate-*r*95.3%
*-commutative95.3%
associate-*r*95.3%
distribute-rgt-out95.3%
distribute-lft-out95.3%
metadata-eval95.3%
pow-sqr95.3%
associate-*r*95.3%
distribute-rgt-out95.3%
unpow295.3%
unpow295.3%
Simplified95.3%
Taylor expanded in re around 0 69.7%
*-commutative69.7%
unpow269.7%
unpow269.7%
Simplified69.7%
if -3.8000000000000001e71 < im < -2.1e11 or 600 < im < 1.65e54Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr32.1%
Taylor expanded in re around 0 47.4%
associate-*r/47.4%
metadata-eval47.4%
unpow247.4%
*-commutative47.4%
unpow247.4%
Simplified47.4%
if -2.1e11 < im < 600Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.8%
if 2.49999999999999986e193 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt1-in100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*86.9%
Simplified86.9%
Final simplification83.1%
(FPCore (re im) :precision binary64 (* (sin re) (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))))
double code(double re, double im) {
return sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end function
public static double code(double re, double im) {
return Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
def code(re, im): return math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
function code(re, im) return Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))) end
function tmp = code(re, im) tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Final simplification88.1%
(FPCore (re im)
:precision binary64
(let* ((t_0
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))
(t_1
(*
re
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
(if (<= im -5.6e+69)
t_1
(if (<= im -210000000000.0)
t_0
(if (<= im 660.0) (sin re) (if (<= im 1.45e+57) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= -5.6e+69) {
tmp = t_1;
} else if (im <= -210000000000.0) {
tmp = t_0;
} else if (im <= 660.0) {
tmp = sin(re);
} else if (im <= 1.45e+57) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
t_1 = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
if (im <= (-5.6d+69)) then
tmp = t_1
else if (im <= (-210000000000.0d0)) then
tmp = t_0
else if (im <= 660.0d0) then
tmp = sin(re)
else if (im <= 1.45d+57) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
double t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= -5.6e+69) {
tmp = t_1;
} else if (im <= -210000000000.0) {
tmp = t_0;
} else if (im <= 660.0) {
tmp = Math.sin(re);
} else if (im <= 1.45e+57) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) tmp = 0 if im <= -5.6e+69: tmp = t_1 elif im <= -210000000000.0: tmp = t_0 elif im <= 660.0: tmp = math.sin(re) elif im <= 1.45e+57: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))) t_1 = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))) tmp = 0.0 if (im <= -5.6e+69) tmp = t_1; elseif (im <= -210000000000.0) tmp = t_0; elseif (im <= 660.0) tmp = sin(re); elseif (im <= 1.45e+57) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); t_1 = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); tmp = 0.0; if (im <= -5.6e+69) tmp = t_1; elseif (im <= -210000000000.0) tmp = t_0; elseif (im <= 660.0) tmp = sin(re); elseif (im <= 1.45e+57) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.6e+69], t$95$1, If[LessEqual[im, -210000000000.0], t$95$0, If[LessEqual[im, 660.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.45e+57], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
t_1 := re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq -5.6 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -210000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 660:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.45 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -5.59999999999999964e69 or 1.4500000000000001e57 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.3%
*-rgt-identity96.3%
*-commutative96.3%
associate-*r*96.3%
*-commutative96.3%
associate-*r*96.3%
distribute-rgt-out96.3%
distribute-lft-out96.3%
metadata-eval96.3%
pow-sqr96.3%
associate-*r*96.3%
distribute-rgt-out96.3%
unpow296.3%
unpow296.3%
Simplified96.3%
Taylor expanded in re around 0 69.0%
*-commutative69.0%
unpow269.0%
unpow269.0%
Simplified69.0%
if -5.59999999999999964e69 < im < -2.1e11 or 660 < im < 1.4500000000000001e57Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr32.1%
Taylor expanded in re around 0 47.4%
associate-*r/47.4%
metadata-eval47.4%
unpow247.4%
*-commutative47.4%
unpow247.4%
Simplified47.4%
if -2.1e11 < im < 660Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.8%
Final simplification81.5%
(FPCore (re im)
:precision binary64
(if (<= im -2.8e+138)
(* 0.5 (* re (* im im)))
(if (or (<= im -5e+41) (and (not (<= im 390.0)) (<= im 5.2e+146)))
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
(* re (+ 1.0 (* 0.5 (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= -2.8e+138) {
tmp = 0.5 * (re * (im * im));
} else if ((im <= -5e+41) || (!(im <= 390.0) && (im <= 5.2e+146))) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} 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 <= (-2.8d+138)) then
tmp = 0.5d0 * (re * (im * im))
else if ((im <= (-5d+41)) .or. (.not. (im <= 390.0d0)) .and. (im <= 5.2d+146)) then
tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
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 <= -2.8e+138) {
tmp = 0.5 * (re * (im * im));
} else if ((im <= -5e+41) || (!(im <= 390.0) && (im <= 5.2e+146))) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else {
tmp = re * (1.0 + (0.5 * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -2.8e+138: tmp = 0.5 * (re * (im * im)) elif (im <= -5e+41) or (not (im <= 390.0) and (im <= 5.2e+146)): tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) else: tmp = re * (1.0 + (0.5 * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= -2.8e+138) tmp = Float64(0.5 * Float64(re * Float64(im * im))); elseif ((im <= -5e+41) || (!(im <= 390.0) && (im <= 5.2e+146))) tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))); 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 <= -2.8e+138) tmp = 0.5 * (re * (im * im)); elseif ((im <= -5e+41) || (~((im <= 390.0)) && (im <= 5.2e+146))) tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); else tmp = re * (1.0 + (0.5 * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -2.8e+138], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -5e+41], And[N[Not[LessEqual[im, 390.0]], $MachinePrecision], LessEqual[im, 5.2e+146]]], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $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 -2.8 \cdot 10^{+138}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;im \leq -5 \cdot 10^{+41} \lor \neg \left(im \leq 390\right) \land im \leq 5.2 \cdot 10^{+146}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < -2.8000000000000001e138Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 90.0%
*-commutative90.0%
associate-*r*90.0%
distribute-rgt1-in90.0%
*-commutative90.0%
unpow290.0%
associate-*l*90.0%
Simplified90.0%
Taylor expanded in im around inf 90.0%
*-commutative90.0%
unpow290.0%
associate-*l*62.9%
Simplified62.9%
Taylor expanded in re around 0 72.1%
unpow272.1%
Simplified72.1%
if -2.8000000000000001e138 < im < -5.00000000000000022e41 or 390 < im < 5.20000000000000028e146Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr17.8%
Taylor expanded in re around 0 35.1%
associate-*r/35.1%
metadata-eval35.1%
unpow235.1%
*-commutative35.1%
unpow235.1%
Simplified35.1%
if -5.00000000000000022e41 < im < 390 or 5.20000000000000028e146 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 91.5%
*-commutative91.5%
associate-*r*91.5%
distribute-rgt1-in91.5%
*-commutative91.5%
unpow291.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in re around 0 57.1%
*-commutative57.1%
unpow257.1%
Simplified57.1%
Final simplification53.9%
(FPCore (re im)
:precision binary64
(if (<= re -7.2e+276)
(* 0.5 (* re (* im im)))
(if (<= re -4.4e+154)
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
(* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))))))
double code(double re, double im) {
double tmp;
if (re <= -7.2e+276) {
tmp = 0.5 * (re * (im * im));
} else if (re <= -4.4e+154) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-7.2d+276)) then
tmp = 0.5d0 * (re * (im * im))
else if (re <= (-4.4d+154)) then
tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
else
tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -7.2e+276) {
tmp = 0.5 * (re * (im * im));
} else if (re <= -4.4e+154) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -7.2e+276: tmp = 0.5 * (re * (im * im)) elif re <= -4.4e+154: tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) else: tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -7.2e+276) tmp = Float64(0.5 * Float64(re * Float64(im * im))); elseif (re <= -4.4e+154) tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))); else tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -7.2e+276) tmp = 0.5 * (re * (im * im)); elseif (re <= -4.4e+154) tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); else tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -7.2e+276], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -4.4e+154], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -7.2 \cdot 10^{+276}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq -4.4 \cdot 10^{+154}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if re < -7.19999999999999959e276Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 89.3%
*-commutative89.3%
associate-*r*89.3%
distribute-rgt1-in89.3%
*-commutative89.3%
unpow289.3%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in im around inf 47.0%
*-commutative47.0%
unpow247.0%
associate-*l*47.0%
Simplified47.0%
Taylor expanded in re around 0 56.9%
unpow256.9%
Simplified56.9%
if -7.19999999999999959e276 < re < -4.4000000000000002e154Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr4.8%
Taylor expanded in re around 0 57.8%
associate-*r/57.8%
metadata-eval57.8%
unpow257.8%
*-commutative57.8%
unpow257.8%
Simplified57.8%
if -4.4000000000000002e154 < re Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 87.7%
*-rgt-identity87.7%
*-commutative87.7%
associate-*r*87.7%
*-commutative87.7%
associate-*r*87.7%
distribute-rgt-out87.7%
distribute-lft-out87.7%
metadata-eval87.7%
pow-sqr87.7%
associate-*r*87.7%
distribute-rgt-out87.7%
unpow287.7%
unpow287.7%
Simplified87.7%
Taylor expanded in re around 0 60.8%
*-commutative60.8%
unpow260.8%
unpow260.8%
Simplified60.8%
Final simplification60.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* im (* re im)))))
(if (<= im -3.5e+184)
t_0
(if (<= im -2.6e+39)
(/ 0.25 (* re re))
(if (or (<= im -1.4) (not (<= im 1.4))) t_0 re)))))
double code(double re, double im) {
double t_0 = 0.5 * (im * (re * im));
double tmp;
if (im <= -3.5e+184) {
tmp = t_0;
} else if (im <= -2.6e+39) {
tmp = 0.25 / (re * re);
} else if ((im <= -1.4) || !(im <= 1.4)) {
tmp = t_0;
} else {
tmp = re;
}
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 * (re * im))
if (im <= (-3.5d+184)) then
tmp = t_0
else if (im <= (-2.6d+39)) then
tmp = 0.25d0 / (re * re)
else if ((im <= (-1.4d0)) .or. (.not. (im <= 1.4d0))) then
tmp = t_0
else
tmp = re
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (im * (re * im));
double tmp;
if (im <= -3.5e+184) {
tmp = t_0;
} else if (im <= -2.6e+39) {
tmp = 0.25 / (re * re);
} else if ((im <= -1.4) || !(im <= 1.4)) {
tmp = t_0;
} else {
tmp = re;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (im * (re * im)) tmp = 0 if im <= -3.5e+184: tmp = t_0 elif im <= -2.6e+39: tmp = 0.25 / (re * re) elif (im <= -1.4) or not (im <= 1.4): tmp = t_0 else: tmp = re return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(im * Float64(re * im))) tmp = 0.0 if (im <= -3.5e+184) tmp = t_0; elseif (im <= -2.6e+39) tmp = Float64(0.25 / Float64(re * re)); elseif ((im <= -1.4) || !(im <= 1.4)) tmp = t_0; else tmp = re; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (im * (re * im)); tmp = 0.0; if (im <= -3.5e+184) tmp = t_0; elseif (im <= -2.6e+39) tmp = 0.25 / (re * re); elseif ((im <= -1.4) || ~((im <= 1.4))) tmp = t_0; else tmp = re; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.5e+184], t$95$0, If[LessEqual[im, -2.6e+39], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -1.4], N[Not[LessEqual[im, 1.4]], $MachinePrecision]], t$95$0, re]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\
\mathbf{if}\;im \leq -3.5 \cdot 10^{+184}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -2.6 \cdot 10^{+39}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\mathbf{elif}\;im \leq -1.4 \lor \neg \left(im \leq 1.4\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re\\
\end{array}
\end{array}
if im < -3.49999999999999978e184 or -2.6e39 < im < -1.3999999999999999 or 1.3999999999999999 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 54.4%
*-commutative54.4%
associate-*r*54.4%
distribute-rgt1-in54.4%
*-commutative54.4%
unpow254.4%
associate-*l*54.4%
Simplified54.4%
Taylor expanded in im around inf 54.4%
*-commutative54.4%
unpow254.4%
associate-*l*45.7%
Simplified45.7%
Taylor expanded in re around 0 36.7%
if -3.49999999999999978e184 < im < -2.6e39Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr21.2%
Taylor expanded in re around 0 21.2%
unpow221.2%
Simplified21.2%
if -1.3999999999999999 < im < 1.3999999999999999Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 58.9%
associate-*r*58.9%
Simplified58.9%
Taylor expanded in im around 0 57.5%
Final simplification44.7%
(FPCore (re im) :precision binary64 (if (or (<= im -1.4) (not (<= im 1.4))) (* 0.5 (* re (* im im))) re))
double code(double re, double im) {
double tmp;
if ((im <= -1.4) || !(im <= 1.4)) {
tmp = 0.5 * (re * (im * im));
} else {
tmp = re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-1.4d0)) .or. (.not. (im <= 1.4d0))) then
tmp = 0.5d0 * (re * (im * im))
else
tmp = re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1.4) || !(im <= 1.4)) {
tmp = 0.5 * (re * (im * im));
} else {
tmp = re;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.4) or not (im <= 1.4): tmp = 0.5 * (re * (im * im)) else: tmp = re return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.4) || !(im <= 1.4)) tmp = Float64(0.5 * Float64(re * Float64(im * im))); else tmp = re; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.4) || ~((im <= 1.4))) tmp = 0.5 * (re * (im * im)); else tmp = re; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.4], N[Not[LessEqual[im, 1.4]], $MachinePrecision]], N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], re]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.4 \lor \neg \left(im \leq 1.4\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re\\
\end{array}
\end{array}
if im < -1.3999999999999999 or 1.3999999999999999 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 45.2%
*-commutative45.2%
associate-*r*45.2%
distribute-rgt1-in45.2%
*-commutative45.2%
unpow245.2%
associate-*l*45.2%
Simplified45.2%
Taylor expanded in im around inf 45.2%
*-commutative45.2%
unpow245.2%
associate-*l*34.9%
Simplified34.9%
Taylor expanded in re around 0 38.5%
unpow238.5%
Simplified38.5%
if -1.3999999999999999 < im < 1.3999999999999999Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 58.9%
associate-*r*58.9%
Simplified58.9%
Taylor expanded in im around 0 57.5%
Final simplification48.1%
(FPCore (re im) :precision binary64 (if (or (<= im -460000000000.0) (not (<= im 760000000000.0))) (/ 0.25 (* re re)) re))
double code(double re, double im) {
double tmp;
if ((im <= -460000000000.0) || !(im <= 760000000000.0)) {
tmp = 0.25 / (re * re);
} else {
tmp = re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-460000000000.0d0)) .or. (.not. (im <= 760000000000.0d0))) then
tmp = 0.25d0 / (re * re)
else
tmp = re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -460000000000.0) || !(im <= 760000000000.0)) {
tmp = 0.25 / (re * re);
} else {
tmp = re;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -460000000000.0) or not (im <= 760000000000.0): tmp = 0.25 / (re * re) else: tmp = re return tmp
function code(re, im) tmp = 0.0 if ((im <= -460000000000.0) || !(im <= 760000000000.0)) tmp = Float64(0.25 / Float64(re * re)); else tmp = re; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -460000000000.0) || ~((im <= 760000000000.0))) tmp = 0.25 / (re * re); else tmp = re; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -460000000000.0], N[Not[LessEqual[im, 760000000000.0]], $MachinePrecision]], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision], re]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -460000000000 \lor \neg \left(im \leq 760000000000\right):\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;re\\
\end{array}
\end{array}
if im < -4.6e11 or 7.6e11 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr18.0%
Taylor expanded in re around 0 17.8%
unpow217.8%
Simplified17.8%
if -4.6e11 < im < 7.6e11Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 59.8%
associate-*r*59.8%
Simplified59.8%
Taylor expanded in im around 0 56.3%
Final simplification37.7%
(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%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 72.4%
*-commutative72.4%
associate-*r*72.4%
distribute-rgt1-in72.4%
*-commutative72.4%
unpow272.4%
associate-*l*72.4%
Simplified72.4%
Taylor expanded in re around 0 48.3%
*-commutative48.3%
unpow248.3%
Simplified48.3%
Final simplification48.3%
(FPCore (re im) :precision binary64 -512.0)
double code(double re, double im) {
return -512.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -512.0d0
end function
public static double code(double re, double im) {
return -512.0;
}
def code(re, im): return -512.0
function code(re, im) return -512.0 end
function tmp = code(re, im) tmp = -512.0; end
code[re_, im_] := -512.0
\begin{array}{l}
\\
-512
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Applied egg-rr3.4%
Final simplification3.4%
(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%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Applied egg-rr4.1%
Final simplification4.1%
(FPCore (re im) :precision binary64 -0.5)
double code(double re, double im) {
return -0.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -0.5d0
end function
public static double code(double re, double im) {
return -0.5;
}
def code(re, im): return -0.5
function code(re, im) return -0.5 end
function tmp = code(re, im) tmp = -0.5; end
code[re_, im_] := -0.5
\begin{array}{l}
\\
-0.5
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Applied egg-rr4.1%
Final simplification4.1%
(FPCore (re im) :precision binary64 0.015625)
double code(double re, double im) {
return 0.015625;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.015625d0
end function
public static double code(double re, double im) {
return 0.015625;
}
def code(re, im): return 0.015625
function code(re, im) return 0.015625 end
function tmp = code(re, im) tmp = 0.015625; end
code[re_, im_] := 0.015625
\begin{array}{l}
\\
0.015625
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Applied egg-rr4.2%
Final simplification4.2%
(FPCore (re im) :precision binary64 0.125)
double code(double re, double im) {
return 0.125;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.125d0
end function
public static double code(double re, double im) {
return 0.125;
}
def code(re, im): return 0.125
function code(re, im) return 0.125 end
function tmp = code(re, im) tmp = 0.125; end
code[re_, im_] := 0.125
\begin{array}{l}
\\
0.125
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Applied egg-rr4.4%
Final simplification4.4%
(FPCore (re im) :precision binary64 0.25)
double code(double re, double im) {
return 0.25;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.25d0
end function
public static double code(double re, double im) {
return 0.25;
}
def code(re, im): return 0.25
function code(re, im) return 0.25 end
function tmp = code(re, im) tmp = 0.25; end
code[re_, im_] := 0.25
\begin{array}{l}
\\
0.25
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Applied egg-rr4.6%
Final simplification4.6%
(FPCore (re im) :precision binary64 0.5)
double code(double re, double im) {
return 0.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0
end function
public static double code(double re, double im) {
return 0.5;
}
def code(re, im): return 0.5
function code(re, im) return 0.5 end
function tmp = code(re, im) tmp = 0.5; end
code[re_, im_] := 0.5
\begin{array}{l}
\\
0.5
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Applied egg-rr4.7%
Final simplification4.7%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
*-rgt-identity88.1%
*-commutative88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
distribute-lft-out88.1%
metadata-eval88.1%
pow-sqr88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
unpow288.1%
unpow288.1%
Simplified88.1%
Applied egg-rr4.8%
Final simplification4.8%
(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%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 64.8%
associate-*r*64.8%
Simplified64.8%
Taylor expanded in im around 0 30.2%
Final simplification30.2%
herbie shell --seed 2023189
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))