
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))))
(if (<= im 1.02e+103)
(*
t_0
(+
(exp im)
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))))
(*
t_0
(+ 4.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))))))
double code(double re, double im) {
double t_0 = 0.5 * sin(re);
double tmp;
if (im <= 1.02e+103) {
tmp = t_0 * (exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))));
} else {
tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
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)
if (im <= 1.02d+103) then
tmp = t_0 * (exp(im) + (1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))))
else
tmp = t_0 * (4.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.sin(re);
double tmp;
if (im <= 1.02e+103) {
tmp = t_0 * (Math.exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))));
} else {
tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.sin(re) tmp = 0 if im <= 1.02e+103: tmp = t_0 * (math.exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)))) else: tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) return tmp
function code(re, im) t_0 = Float64(0.5 * sin(re)) tmp = 0.0 if (im <= 1.02e+103) tmp = Float64(t_0 * Float64(exp(im) + Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))))); else tmp = Float64(t_0 * Float64(4.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * sin(re); tmp = 0.0; if (im <= 1.02e+103) tmp = t_0 * (exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)))); else tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 1.02e+103], N[(t$95$0 * N[(N[Exp[im], $MachinePrecision] + N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(4.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
\mathbf{if}\;im \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;t\_0 \cdot \left(e^{im} + \left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(4 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if im < 1.01999999999999991e103Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 89.9%
if 1.01999999999999991e103 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification91.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))))
(if (<= im 2.1)
(*
t_0
(+
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))
(+ 1.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))))
(* t_0 (+ (exp im) 3.0)))))
double code(double re, double im) {
double t_0 = 0.5 * sin(re);
double tmp;
if (im <= 2.1) {
tmp = t_0 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))));
} else {
tmp = t_0 * (exp(im) + 3.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)
if (im <= 2.1d0) then
tmp = t_0 * ((1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))) + (1.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0)))))))
else
tmp = t_0 * (exp(im) + 3.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.sin(re);
double tmp;
if (im <= 2.1) {
tmp = t_0 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))));
} else {
tmp = t_0 * (Math.exp(im) + 3.0);
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.sin(re) tmp = 0 if im <= 2.1: tmp = t_0 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))))) else: tmp = t_0 * (math.exp(im) + 3.0) return tmp
function code(re, im) t_0 = Float64(0.5 * sin(re)) tmp = 0.0 if (im <= 2.1) tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))) + Float64(1.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666)))))))); else tmp = Float64(t_0 * Float64(exp(im) + 3.0)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * sin(re); tmp = 0.0; if (im <= 2.1) tmp = t_0 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))))); else tmp = t_0 * (exp(im) + 3.0); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 2.1], N[(t$95$0 * N[(N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[Exp[im], $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
\mathbf{if}\;im \leq 2.1:\\
\;\;\;\;t\_0 \cdot \left(\left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right) + \left(1 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(e^{im} + 3\right)\\
\end{array}
\end{array}
if im < 2.10000000000000009Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 88.5%
Taylor expanded in im around 0 67.6%
if 2.10000000000000009 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Final simplification76.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ (exp im) 3.0))
(t_1 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))
(t_2 (* 0.5 (sin re))))
(if (<= im 6.0)
(*
t_2
(+
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))
(+ 1.0 t_1)))
(if (<= im 1.9e+71)
(* t_0 (* 0.5 re))
(if (<= im 1.02e+103) (* t_0 (/ re -28.0)) (* t_2 (+ 4.0 t_1)))))))
double code(double re, double im) {
double t_0 = exp(im) + 3.0;
double t_1 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))));
double t_2 = 0.5 * sin(re);
double tmp;
if (im <= 6.0) {
tmp = t_2 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_1));
} else if (im <= 1.9e+71) {
tmp = t_0 * (0.5 * re);
} else if (im <= 1.02e+103) {
tmp = t_0 * (re / -28.0);
} else {
tmp = t_2 * (4.0 + 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) :: t_2
real(8) :: tmp
t_0 = exp(im) + 3.0d0
t_1 = im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))
t_2 = 0.5d0 * sin(re)
if (im <= 6.0d0) then
tmp = t_2 * ((1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))) + (1.0d0 + t_1))
else if (im <= 1.9d+71) then
tmp = t_0 * (0.5d0 * re)
else if (im <= 1.02d+103) then
tmp = t_0 * (re / (-28.0d0))
else
tmp = t_2 * (4.0d0 + t_1)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(im) + 3.0;
double t_1 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))));
double t_2 = 0.5 * Math.sin(re);
double tmp;
if (im <= 6.0) {
tmp = t_2 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_1));
} else if (im <= 1.9e+71) {
tmp = t_0 * (0.5 * re);
} else if (im <= 1.02e+103) {
tmp = t_0 * (re / -28.0);
} else {
tmp = t_2 * (4.0 + t_1);
}
return tmp;
}
def code(re, im): t_0 = math.exp(im) + 3.0 t_1 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))) t_2 = 0.5 * math.sin(re) tmp = 0 if im <= 6.0: tmp = t_2 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_1)) elif im <= 1.9e+71: tmp = t_0 * (0.5 * re) elif im <= 1.02e+103: tmp = t_0 * (re / -28.0) else: tmp = t_2 * (4.0 + t_1) return tmp
function code(re, im) t_0 = Float64(exp(im) + 3.0) t_1 = Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))) t_2 = Float64(0.5 * sin(re)) tmp = 0.0 if (im <= 6.0) tmp = Float64(t_2 * Float64(Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))) + Float64(1.0 + t_1))); elseif (im <= 1.9e+71) tmp = Float64(t_0 * Float64(0.5 * re)); elseif (im <= 1.02e+103) tmp = Float64(t_0 * Float64(re / -28.0)); else tmp = Float64(t_2 * Float64(4.0 + t_1)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(im) + 3.0; t_1 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))); t_2 = 0.5 * sin(re); tmp = 0.0; if (im <= 6.0) tmp = t_2 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_1)); elseif (im <= 1.9e+71) tmp = t_0 * (0.5 * re); elseif (im <= 1.02e+103) tmp = t_0 * (re / -28.0); else tmp = t_2 * (4.0 + t_1); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[im], $MachinePrecision] + 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 6.0], N[(t$95$2 * N[(N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+71], N[(t$95$0 * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.02e+103], N[(t$95$0 * N[(re / -28.0), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(4.0 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{im} + 3\\
t_1 := im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\\
t_2 := 0.5 \cdot \sin re\\
\mathbf{if}\;im \leq 6:\\
\;\;\;\;t\_2 \cdot \left(\left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right) + \left(1 + t\_1\right)\right)\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+71}:\\
\;\;\;\;t\_0 \cdot \left(0.5 \cdot re\right)\\
\mathbf{elif}\;im \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;t\_0 \cdot \frac{re}{-28}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(4 + t\_1\right)\\
\end{array}
\end{array}
if im < 6Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 88.5%
Taylor expanded in im around 0 67.6%
if 6 < im < 1.9e71Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Applied egg-rr99.9%
Taylor expanded in re around 0 81.2%
associate-*r*81.2%
*-commutative81.2%
Simplified81.2%
if 1.9e71 < im < 1.01999999999999991e103Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 33.3%
associate-*r*33.3%
*-commutative33.3%
Simplified33.3%
Applied egg-rr66.7%
if 1.01999999999999991e103 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification74.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))) (t_1 (+ (exp im) 3.0)))
(if (<= im 6.0)
(*
t_0
(+
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))
(+ 1.0 (* im (+ 1.0 (* 0.5 im))))))
(if (<= im 1.9e+71)
(* t_1 (* 0.5 re))
(if (<= im 4.3e+102)
(* t_1 (/ re -28.0))
(*
t_0
(+
4.0
(* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))))))))
double code(double re, double im) {
double t_0 = 0.5 * sin(re);
double t_1 = exp(im) + 3.0;
double tmp;
if (im <= 6.0) {
tmp = t_0 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (0.5 * im)))));
} else if (im <= 1.9e+71) {
tmp = t_1 * (0.5 * re);
} else if (im <= 4.3e+102) {
tmp = t_1 * (re / -28.0);
} else {
tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
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.5d0 * sin(re)
t_1 = exp(im) + 3.0d0
if (im <= 6.0d0) then
tmp = t_0 * ((1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))) + (1.0d0 + (im * (1.0d0 + (0.5d0 * im)))))
else if (im <= 1.9d+71) then
tmp = t_1 * (0.5d0 * re)
else if (im <= 4.3d+102) then
tmp = t_1 * (re / (-28.0d0))
else
tmp = t_0 * (4.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.sin(re);
double t_1 = Math.exp(im) + 3.0;
double tmp;
if (im <= 6.0) {
tmp = t_0 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (0.5 * im)))));
} else if (im <= 1.9e+71) {
tmp = t_1 * (0.5 * re);
} else if (im <= 4.3e+102) {
tmp = t_1 * (re / -28.0);
} else {
tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.sin(re) t_1 = math.exp(im) + 3.0 tmp = 0 if im <= 6.0: tmp = t_0 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (0.5 * im))))) elif im <= 1.9e+71: tmp = t_1 * (0.5 * re) elif im <= 4.3e+102: tmp = t_1 * (re / -28.0) else: tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) return tmp
function code(re, im) t_0 = Float64(0.5 * sin(re)) t_1 = Float64(exp(im) + 3.0) tmp = 0.0 if (im <= 6.0) tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))) + Float64(1.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))))); elseif (im <= 1.9e+71) tmp = Float64(t_1 * Float64(0.5 * re)); elseif (im <= 4.3e+102) tmp = Float64(t_1 * Float64(re / -28.0)); else tmp = Float64(t_0 * Float64(4.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * sin(re); t_1 = exp(im) + 3.0; tmp = 0.0; if (im <= 6.0) tmp = t_0 * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (0.5 * im))))); elseif (im <= 1.9e+71) tmp = t_1 * (0.5 * re); elseif (im <= 4.3e+102) tmp = t_1 * (re / -28.0); else tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[im], $MachinePrecision] + 3.0), $MachinePrecision]}, If[LessEqual[im, 6.0], N[(t$95$0 * N[(N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+71], N[(t$95$1 * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.3e+102], N[(t$95$1 * N[(re / -28.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(4.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
t_1 := e^{im} + 3\\
\mathbf{if}\;im \leq 6:\\
\;\;\;\;t\_0 \cdot \left(\left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right) + \left(1 + im \cdot \left(1 + 0.5 \cdot im\right)\right)\right)\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+71}:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot re\right)\\
\mathbf{elif}\;im \leq 4.3 \cdot 10^{+102}:\\
\;\;\;\;t\_1 \cdot \frac{re}{-28}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(4 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if im < 6Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 88.5%
Taylor expanded in im around 0 88.3%
if 6 < im < 1.9e71Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Applied egg-rr99.9%
Taylor expanded in re around 0 81.2%
associate-*r*81.2%
*-commutative81.2%
Simplified81.2%
if 1.9e71 < im < 4.3000000000000001e102Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 33.3%
associate-*r*33.3%
*-commutative33.3%
Simplified33.3%
Applied egg-rr66.7%
if 4.3000000000000001e102 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification89.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (sin re)))
(t_1
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))))
(if (<= im 0.0058)
(* t_0 (+ t_1 (+ im 1.0)))
(if (<= im 1.9e+71)
(* (+ (exp im) t_1) (* 0.5 re))
(if (<= im 1.75e+98)
(* (+ (exp im) 3.0) (/ re -28.0))
(*
t_0
(+
4.0
(* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))))))))
double code(double re, double im) {
double t_0 = 0.5 * sin(re);
double t_1 = 1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0));
double tmp;
if (im <= 0.0058) {
tmp = t_0 * (t_1 + (im + 1.0));
} else if (im <= 1.9e+71) {
tmp = (exp(im) + t_1) * (0.5 * re);
} else if (im <= 1.75e+98) {
tmp = (exp(im) + 3.0) * (re / -28.0);
} else {
tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
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.5d0 * sin(re)
t_1 = 1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))
if (im <= 0.0058d0) then
tmp = t_0 * (t_1 + (im + 1.0d0))
else if (im <= 1.9d+71) then
tmp = (exp(im) + t_1) * (0.5d0 * re)
else if (im <= 1.75d+98) then
tmp = (exp(im) + 3.0d0) * (re / (-28.0d0))
else
tmp = t_0 * (4.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.sin(re);
double t_1 = 1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0));
double tmp;
if (im <= 0.0058) {
tmp = t_0 * (t_1 + (im + 1.0));
} else if (im <= 1.9e+71) {
tmp = (Math.exp(im) + t_1) * (0.5 * re);
} else if (im <= 1.75e+98) {
tmp = (Math.exp(im) + 3.0) * (re / -28.0);
} else {
tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.sin(re) t_1 = 1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)) tmp = 0 if im <= 0.0058: tmp = t_0 * (t_1 + (im + 1.0)) elif im <= 1.9e+71: tmp = (math.exp(im) + t_1) * (0.5 * re) elif im <= 1.75e+98: tmp = (math.exp(im) + 3.0) * (re / -28.0) else: tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) return tmp
function code(re, im) t_0 = Float64(0.5 * sin(re)) t_1 = Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))) tmp = 0.0 if (im <= 0.0058) tmp = Float64(t_0 * Float64(t_1 + Float64(im + 1.0))); elseif (im <= 1.9e+71) tmp = Float64(Float64(exp(im) + t_1) * Float64(0.5 * re)); elseif (im <= 1.75e+98) tmp = Float64(Float64(exp(im) + 3.0) * Float64(re / -28.0)); else tmp = Float64(t_0 * Float64(4.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * sin(re); t_1 = 1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)); tmp = 0.0; if (im <= 0.0058) tmp = t_0 * (t_1 + (im + 1.0)); elseif (im <= 1.9e+71) tmp = (exp(im) + t_1) * (0.5 * re); elseif (im <= 1.75e+98) tmp = (exp(im) + 3.0) * (re / -28.0); else tmp = t_0 * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.0058], N[(t$95$0 * N[(t$95$1 + N[(im + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+71], N[(N[(N[Exp[im], $MachinePrecision] + t$95$1), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.75e+98], N[(N[(N[Exp[im], $MachinePrecision] + 3.0), $MachinePrecision] * N[(re / -28.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(4.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
t_1 := 1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{if}\;im \leq 0.0058:\\
\;\;\;\;t\_0 \cdot \left(t\_1 + \left(im + 1\right)\right)\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+71}:\\
\;\;\;\;\left(e^{im} + t\_1\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{elif}\;im \leq 1.75 \cdot 10^{+98}:\\
\;\;\;\;\left(e^{im} + 3\right) \cdot \frac{re}{-28}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(4 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if im < 0.0058Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 88.6%
Taylor expanded in im around 0 88.2%
if 0.0058 < im < 1.9e71Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in im around 0 98.2%
Taylor expanded in re around 0 80.6%
if 1.9e71 < im < 1.75e98Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 33.3%
associate-*r*33.3%
*-commutative33.3%
Simplified33.3%
Applied egg-rr66.7%
if 1.75e98 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification89.1%
(FPCore (re im)
:precision binary64
(if (<= im 0.00305)
(sin re)
(if (<= im 1.9e+71)
(*
(+
(exp im)
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0))))
(* 0.5 re))
(if (<= im 1.02e+103)
(* (+ (exp im) 3.0) (/ re -28.0))
(*
(* 0.5 (sin re))
(+ 4.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666)))))))))))
double code(double re, double im) {
double tmp;
if (im <= 0.00305) {
tmp = sin(re);
} else if (im <= 1.9e+71) {
tmp = (exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)))) * (0.5 * re);
} else if (im <= 1.02e+103) {
tmp = (exp(im) + 3.0) * (re / -28.0);
} else {
tmp = (0.5 * sin(re)) * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.00305d0) then
tmp = sin(re)
else if (im <= 1.9d+71) then
tmp = (exp(im) + (1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0))))) * (0.5d0 * re)
else if (im <= 1.02d+103) then
tmp = (exp(im) + 3.0d0) * (re / (-28.0d0))
else
tmp = (0.5d0 * sin(re)) * (4.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.00305) {
tmp = Math.sin(re);
} else if (im <= 1.9e+71) {
tmp = (Math.exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)))) * (0.5 * re);
} else if (im <= 1.02e+103) {
tmp = (Math.exp(im) + 3.0) * (re / -28.0);
} else {
tmp = (0.5 * Math.sin(re)) * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.00305: tmp = math.sin(re) elif im <= 1.9e+71: tmp = (math.exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)))) * (0.5 * re) elif im <= 1.02e+103: tmp = (math.exp(im) + 3.0) * (re / -28.0) else: tmp = (0.5 * math.sin(re)) * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.00305) tmp = sin(re); elseif (im <= 1.9e+71) tmp = Float64(Float64(exp(im) + Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0)))) * Float64(0.5 * re)); elseif (im <= 1.02e+103) tmp = Float64(Float64(exp(im) + 3.0) * Float64(re / -28.0)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(4.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.00305) tmp = sin(re); elseif (im <= 1.9e+71) tmp = (exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)))) * (0.5 * re); elseif (im <= 1.02e+103) tmp = (exp(im) + 3.0) * (re / -28.0); else tmp = (0.5 * sin(re)) * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.00305], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.9e+71], N[(N[(N[Exp[im], $MachinePrecision] + N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.02e+103], N[(N[(N[Exp[im], $MachinePrecision] + 3.0), $MachinePrecision] * N[(re / -28.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(4.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.00305:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+71}:\\
\;\;\;\;\left(e^{im} + \left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right)\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{elif}\;im \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;\left(e^{im} + 3\right) \cdot \frac{re}{-28}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(4 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if im < 0.00305000000000000019Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 67.8%
if 0.00305000000000000019 < im < 1.9e71Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in im around 0 98.2%
Taylor expanded in re around 0 80.6%
if 1.9e71 < im < 1.01999999999999991e103Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 33.3%
associate-*r*33.3%
*-commutative33.3%
Simplified33.3%
Applied egg-rr66.7%
if 1.01999999999999991e103 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification74.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ (exp im) 3.0)))
(if (<= im 6.0)
(sin re)
(if (<= im 1.9e+71)
(* t_0 (* 0.5 re))
(if (<= im 8.5e+102)
(* t_0 (/ re -28.0))
(*
(* 0.5 (sin re))
(+
4.0
(* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))))))))
double code(double re, double im) {
double t_0 = exp(im) + 3.0;
double tmp;
if (im <= 6.0) {
tmp = sin(re);
} else if (im <= 1.9e+71) {
tmp = t_0 * (0.5 * re);
} else if (im <= 8.5e+102) {
tmp = t_0 * (re / -28.0);
} else {
tmp = (0.5 * sin(re)) * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
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 = exp(im) + 3.0d0
if (im <= 6.0d0) then
tmp = sin(re)
else if (im <= 1.9d+71) then
tmp = t_0 * (0.5d0 * re)
else if (im <= 8.5d+102) then
tmp = t_0 * (re / (-28.0d0))
else
tmp = (0.5d0 * sin(re)) * (4.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(im) + 3.0;
double tmp;
if (im <= 6.0) {
tmp = Math.sin(re);
} else if (im <= 1.9e+71) {
tmp = t_0 * (0.5 * re);
} else if (im <= 8.5e+102) {
tmp = t_0 * (re / -28.0);
} else {
tmp = (0.5 * Math.sin(re)) * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(im) + 3.0 tmp = 0 if im <= 6.0: tmp = math.sin(re) elif im <= 1.9e+71: tmp = t_0 * (0.5 * re) elif im <= 8.5e+102: tmp = t_0 * (re / -28.0) else: tmp = (0.5 * math.sin(re)) * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) return tmp
function code(re, im) t_0 = Float64(exp(im) + 3.0) tmp = 0.0 if (im <= 6.0) tmp = sin(re); elseif (im <= 1.9e+71) tmp = Float64(t_0 * Float64(0.5 * re)); elseif (im <= 8.5e+102) tmp = Float64(t_0 * Float64(re / -28.0)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(4.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(im) + 3.0; tmp = 0.0; if (im <= 6.0) tmp = sin(re); elseif (im <= 1.9e+71) tmp = t_0 * (0.5 * re); elseif (im <= 8.5e+102) tmp = t_0 * (re / -28.0); else tmp = (0.5 * sin(re)) * (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[im], $MachinePrecision] + 3.0), $MachinePrecision]}, If[LessEqual[im, 6.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.9e+71], N[(t$95$0 * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.5e+102], N[(t$95$0 * N[(re / -28.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(4.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{im} + 3\\
\mathbf{if}\;im \leq 6:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+71}:\\
\;\;\;\;t\_0 \cdot \left(0.5 \cdot re\right)\\
\mathbf{elif}\;im \leq 8.5 \cdot 10^{+102}:\\
\;\;\;\;t\_0 \cdot \frac{re}{-28}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(4 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if im < 6Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 67.6%
if 6 < im < 1.9e71Initial program 99.9%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-sub099.9%
Simplified99.9%
Applied egg-rr99.9%
Taylor expanded in re around 0 81.2%
associate-*r*81.2%
*-commutative81.2%
Simplified81.2%
if 1.9e71 < im < 8.4999999999999996e102Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 33.3%
associate-*r*33.3%
*-commutative33.3%
Simplified33.3%
Applied egg-rr66.7%
if 8.4999999999999996e102 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification74.4%
(FPCore (re im)
:precision binary64
(if (<= im 4.2)
(sin re)
(if (<= im 1.02e+154)
(* (+ (exp im) 3.0) (* 0.5 re))
(* (* 0.5 (sin re)) (+ 4.0 (* im (+ 1.0 (* 0.5 im))))))))
double code(double re, double im) {
double tmp;
if (im <= 4.2) {
tmp = sin(re);
} else if (im <= 1.02e+154) {
tmp = (exp(im) + 3.0) * (0.5 * re);
} else {
tmp = (0.5 * sin(re)) * (4.0 + (im * (1.0 + (0.5 * im))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 4.2d0) then
tmp = sin(re)
else if (im <= 1.02d+154) then
tmp = (exp(im) + 3.0d0) * (0.5d0 * re)
else
tmp = (0.5d0 * sin(re)) * (4.0d0 + (im * (1.0d0 + (0.5d0 * im))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4.2) {
tmp = Math.sin(re);
} else if (im <= 1.02e+154) {
tmp = (Math.exp(im) + 3.0) * (0.5 * re);
} else {
tmp = (0.5 * Math.sin(re)) * (4.0 + (im * (1.0 + (0.5 * im))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.2: tmp = math.sin(re) elif im <= 1.02e+154: tmp = (math.exp(im) + 3.0) * (0.5 * re) else: tmp = (0.5 * math.sin(re)) * (4.0 + (im * (1.0 + (0.5 * im)))) return tmp
function code(re, im) tmp = 0.0 if (im <= 4.2) tmp = sin(re); elseif (im <= 1.02e+154) tmp = Float64(Float64(exp(im) + 3.0) * Float64(0.5 * re)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(4.0 + Float64(im * Float64(1.0 + Float64(0.5 * im))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4.2) tmp = sin(re); elseif (im <= 1.02e+154) tmp = (exp(im) + 3.0) * (0.5 * re); else tmp = (0.5 * sin(re)) * (4.0 + (im * (1.0 + (0.5 * im)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.2], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.02e+154], N[(N[(N[Exp[im], $MachinePrecision] + 3.0), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(4.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.2:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.02 \cdot 10^{+154}:\\
\;\;\;\;\left(e^{im} + 3\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(4 + im \cdot \left(1 + 0.5 \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 4.20000000000000018Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 67.6%
if 4.20000000000000018 < im < 1.02000000000000007e154Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 58.8%
associate-*r*58.8%
*-commutative58.8%
Simplified58.8%
if 1.02000000000000007e154 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
Final simplification71.3%
(FPCore (re im) :precision binary64 (if (<= im 3.3) (sin re) (* (+ (exp im) 3.0) (* 0.5 re))))
double code(double re, double im) {
double tmp;
if (im <= 3.3) {
tmp = sin(re);
} else {
tmp = (exp(im) + 3.0) * (0.5 * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 3.3d0) then
tmp = sin(re)
else
tmp = (exp(im) + 3.0d0) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 3.3) {
tmp = Math.sin(re);
} else {
tmp = (Math.exp(im) + 3.0) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 3.3: tmp = math.sin(re) else: tmp = (math.exp(im) + 3.0) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 3.3) tmp = sin(re); else tmp = Float64(Float64(exp(im) + 3.0) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 3.3) tmp = sin(re); else tmp = (exp(im) + 3.0) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 3.3], N[Sin[re], $MachinePrecision], N[(N[(N[Exp[im], $MachinePrecision] + 3.0), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.3:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;\left(e^{im} + 3\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < 3.2999999999999998Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 67.6%
if 3.2999999999999998 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 70.8%
associate-*r*70.8%
*-commutative70.8%
Simplified70.8%
Final simplification68.5%
(FPCore (re im)
:precision binary64
(if (<= im 15500000.0)
(sin re)
(*
(+ 4.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))
(+ re 29.0))))
double code(double re, double im) {
double tmp;
if (im <= 15500000.0) {
tmp = sin(re);
} else {
tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (re + 29.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 15500000.0d0) then
tmp = sin(re)
else
tmp = (4.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0)))))) * (re + 29.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 15500000.0) {
tmp = Math.sin(re);
} else {
tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (re + 29.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 15500000.0: tmp = math.sin(re) else: tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (re + 29.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 15500000.0) tmp = sin(re); else tmp = Float64(Float64(4.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666)))))) * Float64(re + 29.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 15500000.0) tmp = sin(re); else tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (re + 29.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 15500000.0], N[Sin[re], $MachinePrecision], N[(N[(4.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re + 29.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 15500000:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;\left(4 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right) \cdot \left(re + 29\right)\\
\end{array}
\end{array}
if im < 1.55e7Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 67.0%
if 1.55e7 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 71.4%
associate-*r*71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in im around 0 54.9%
*-commutative68.7%
Simplified54.9%
Applied egg-rr24.9%
log1p-undefine24.9%
rem-exp-log37.8%
+-commutative37.8%
associate--l+37.8%
metadata-eval37.8%
Simplified37.8%
(FPCore (re im)
:precision binary64
(if (or (<= re 3.05e+27) (not (<= re 3.65e+261)))
(+ re (* 0.5 (* re (* im im))))
(*
(+ 4.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))
(* re -27.0))))
double code(double re, double im) {
double tmp;
if ((re <= 3.05e+27) || !(re <= 3.65e+261)) {
tmp = re + (0.5 * (re * (im * im)));
} else {
tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (re * -27.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= 3.05d+27) .or. (.not. (re <= 3.65d+261))) then
tmp = re + (0.5d0 * (re * (im * im)))
else
tmp = (4.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0)))))) * (re * (-27.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= 3.05e+27) || !(re <= 3.65e+261)) {
tmp = re + (0.5 * (re * (im * im)));
} else {
tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (re * -27.0);
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= 3.05e+27) or not (re <= 3.65e+261): tmp = re + (0.5 * (re * (im * im))) else: tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (re * -27.0) return tmp
function code(re, im) tmp = 0.0 if ((re <= 3.05e+27) || !(re <= 3.65e+261)) tmp = Float64(re + Float64(0.5 * Float64(re * Float64(im * im)))); else tmp = Float64(Float64(4.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666)))))) * Float64(re * -27.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= 3.05e+27) || ~((re <= 3.65e+261))) tmp = re + (0.5 * (re * (im * im))); else tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (re * -27.0); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, 3.05e+27], N[Not[LessEqual[re, 3.65e+261]], $MachinePrecision]], N[(re + N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(4.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re * -27.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 3.05 \cdot 10^{+27} \lor \neg \left(re \leq 3.65 \cdot 10^{+261}\right):\\
\;\;\;\;re + 0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(4 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right) \cdot \left(re \cdot -27\right)\\
\end{array}
\end{array}
if re < 3.0499999999999999e27 or 3.6499999999999998e261 < re Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 72.8%
Taylor expanded in im around 0 57.9%
unpow257.9%
Applied egg-rr57.9%
if 3.0499999999999999e27 < re < 3.6499999999999998e261Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr33.4%
Taylor expanded in re around 0 7.0%
associate-*r*7.0%
*-commutative7.0%
Simplified7.0%
Taylor expanded in im around 0 13.1%
*-commutative28.7%
Simplified13.1%
Applied egg-rr23.8%
fma-undefine23.8%
*-commutative23.8%
distribute-lft1-in23.8%
*-commutative23.8%
metadata-eval23.8%
Simplified23.8%
Final simplification51.8%
(FPCore (re im)
:precision binary64
(if (<= im 2.0)
(+ re (* 0.5 (* re (* im im))))
(*
(+ 4.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))
(* 0.5 re))))
double code(double re, double im) {
double tmp;
if (im <= 2.0) {
tmp = re + (0.5 * (re * (im * im)));
} else {
tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (0.5 * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2.0d0) then
tmp = re + (0.5d0 * (re * (im * im)))
else
tmp = (4.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0)))))) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.0) {
tmp = re + (0.5 * (re * (im * im)));
} else {
tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.0: tmp = re + (0.5 * (re * (im * im))) else: tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.0) tmp = Float64(re + Float64(0.5 * Float64(re * Float64(im * im)))); else tmp = Float64(Float64(4.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666)))))) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.0) tmp = re + (0.5 * (re * (im * im))); else tmp = (4.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.0], N[(re + N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(4.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2:\\
\;\;\;\;re + 0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(4 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < 2Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 59.7%
Taylor expanded in im around 0 49.1%
unpow249.1%
Applied egg-rr49.1%
if 2 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 70.8%
associate-*r*70.8%
*-commutative70.8%
Simplified70.8%
Taylor expanded in im around 0 53.5%
*-commutative67.0%
Simplified53.5%
Final simplification50.4%
(FPCore (re im) :precision binary64 (if (<= im 1.05) re (* (* 0.5 re) (+ im 4.0))))
double code(double re, double im) {
double tmp;
if (im <= 1.05) {
tmp = re;
} else {
tmp = (0.5 * re) * (im + 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 <= 1.05d0) then
tmp = re
else
tmp = (0.5d0 * re) * (im + 4.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.05) {
tmp = re;
} else {
tmp = (0.5 * re) * (im + 4.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.05: tmp = re else: tmp = (0.5 * re) * (im + 4.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.05) tmp = re; else tmp = Float64(Float64(0.5 * re) * Float64(im + 4.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.05) tmp = re; else tmp = (0.5 * re) * (im + 4.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.05], re, N[(N[(0.5 * re), $MachinePrecision] * N[(im + 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.05:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im + 4\right)\\
\end{array}
\end{array}
if im < 1.05000000000000004Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 59.7%
Taylor expanded in im around 0 35.6%
if 1.05000000000000004 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 70.8%
associate-*r*70.8%
*-commutative70.8%
Simplified70.8%
Taylor expanded in im around 0 11.0%
+-commutative11.0%
Simplified11.0%
Final simplification28.7%
(FPCore (re im) :precision binary64 (+ re (* 0.5 (* re (* im im)))))
double code(double re, double im) {
return re + (0.5 * (re * (im * im)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re + (0.5d0 * (re * (im * im)))
end function
public static double code(double re, double im) {
return re + (0.5 * (re * (im * im)));
}
def code(re, im): return re + (0.5 * (re * (im * im)))
function code(re, im) return Float64(re + Float64(0.5 * Float64(re * Float64(im * im)))) end
function tmp = code(re, im) tmp = re + (0.5 * (re * (im * im))); end
code[re_, im_] := N[(re + N[(0.5 * N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
re + 0.5 \cdot \left(re \cdot \left(im \cdot im\right)\right)
\end{array}
Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 62.8%
Taylor expanded in im around 0 49.2%
unpow249.2%
Applied egg-rr49.2%
Final simplification49.2%
(FPCore (re im) :precision binary64 (if (<= re 1.0) re 1.0))
double code(double re, double im) {
double tmp;
if (re <= 1.0) {
tmp = re;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 1.0d0) then
tmp = re
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.0) {
tmp = re;
} else {
tmp = 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.0: tmp = re else: tmp = 1.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 1.0) tmp = re; else tmp = 1.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.0) tmp = re; else tmp = 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.0], re, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if re < 1Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 74.6%
Taylor expanded in im around 0 33.1%
if 1 < re Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 72.8%
+-commutative72.8%
unpow272.8%
fma-define72.8%
Simplified72.8%
Applied egg-rr6.7%
+-inverses6.7%
+-rgt-identity6.7%
*-inverses6.7%
Simplified6.7%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 76.1%
+-commutative76.1%
unpow276.1%
fma-define76.1%
Simplified76.1%
Applied egg-rr4.4%
+-inverses4.4%
+-rgt-identity4.4%
*-inverses4.4%
Simplified4.4%
herbie shell --seed 2024188
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))