
(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}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.001)))
(* 0.5 (* t_0 (sin re)))
(*
(sin re)
(+
(* (pow im 3.0) -0.16666666666666666)
(- (* (pow im 5.0) -0.008333333333333333) im))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.001)) {
tmp = 0.5 * (t_0 * sin(re));
} else {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) + ((pow(im, 5.0) * -0.008333333333333333) - im));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.001)) {
tmp = 0.5 * (t_0 * Math.sin(re));
} else {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) + ((Math.pow(im, 5.0) * -0.008333333333333333) - im));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.001): tmp = 0.5 * (t_0 * math.sin(re)) else: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) + ((math.pow(im, 5.0) * -0.008333333333333333) - im)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.001)) tmp = Float64(0.5 * Float64(t_0 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) + Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.001))) tmp = 0.5 * (t_0 * sin(re)); else tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) + (((im ^ 5.0) * -0.008333333333333333) - im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.001]], $MachinePrecision]], N[(0.5 * N[(t$95$0 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;0.5 \cdot \left(t_0 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left({im}^{5} \cdot -0.008333333333333333 - im\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -inf.0 or 1e-3 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 1e-3Initial program 27.8%
associate-*l*27.8%
Simplified27.8%
Taylor expanded in im around 0 99.7%
*-commutative99.7%
associate-*l*99.7%
+-commutative99.7%
mul-1-neg99.7%
*-commutative99.7%
distribute-lft-neg-in99.7%
*-commutative99.7%
associate-*r*99.7%
distribute-rgt-out99.7%
distribute-lft-out99.7%
+-commutative99.7%
sub-neg99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.001)))
(* 0.5 (* t_0 (sin re)))
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.001)) {
tmp = 0.5 * (t_0 * sin(re));
} else {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.001)) {
tmp = 0.5 * (t_0 * Math.sin(re));
} else {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.001): tmp = 0.5 * (t_0 * math.sin(re)) else: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.001)) tmp = Float64(0.5 * Float64(t_0 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.001))) tmp = 0.5 * (t_0 * sin(re)); else tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.001]], $MachinePrecision]], N[(0.5 * N[(t$95$0 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;0.5 \cdot \left(t_0 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -inf.0 or 1e-3 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 1e-3Initial program 27.8%
associate-*l*27.8%
Simplified27.8%
Taylor expanded in im around 0 99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
associate-*l*99.7%
distribute-lft-out--99.7%
Simplified99.7%
Final simplification99.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (- (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (* -0.008333333333333333 (* (sin re) (pow im 5.0)))))
(if (<= im -4.5e+61)
t_1
(if (<= im -0.24)
t_0
(if (<= im 0.09)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 4.6e+58) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 * re);
double t_1 = -0.008333333333333333 * (sin(re) * pow(im, 5.0));
double tmp;
if (im <= -4.5e+61) {
tmp = t_1;
} else if (im <= -0.24) {
tmp = t_0;
} else if (im <= 0.09) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 4.6e+58) {
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 = (exp(-im) - exp(im)) * (0.5d0 * re)
t_1 = (-0.008333333333333333d0) * (sin(re) * (im ** 5.0d0))
if (im <= (-4.5d+61)) then
tmp = t_1
else if (im <= (-0.24d0)) then
tmp = t_0
else if (im <= 0.09d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 4.6d+58) 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 = (Math.exp(-im) - Math.exp(im)) * (0.5 * re);
double t_1 = -0.008333333333333333 * (Math.sin(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -4.5e+61) {
tmp = t_1;
} else if (im <= -0.24) {
tmp = t_0;
} else if (im <= 0.09) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 4.6e+58) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) - math.exp(im)) * (0.5 * re) t_1 = -0.008333333333333333 * (math.sin(re) * math.pow(im, 5.0)) tmp = 0 if im <= -4.5e+61: tmp = t_1 elif im <= -0.24: tmp = t_0 elif im <= 0.09: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 4.6e+58: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 * re)) t_1 = Float64(-0.008333333333333333 * Float64(sin(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -4.5e+61) tmp = t_1; elseif (im <= -0.24) tmp = t_0; elseif (im <= 0.09) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 4.6e+58) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (exp(-im) - exp(im)) * (0.5 * re); t_1 = -0.008333333333333333 * (sin(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -4.5e+61) tmp = t_1; elseif (im <= -0.24) tmp = t_0; elseif (im <= 0.09) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 4.6e+58) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+61], t$95$1, If[LessEqual[im, -0.24], t$95$0, If[LessEqual[im, 0.09], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.6e+58], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.24:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.09:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 4.6 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.5e61 or 4.60000000000000005e58 < im Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around 0 98.9%
*-commutative98.9%
associate-*l*98.9%
+-commutative98.9%
mul-1-neg98.9%
*-commutative98.9%
distribute-lft-neg-in98.9%
*-commutative98.9%
associate-*r*98.9%
distribute-rgt-out98.9%
distribute-lft-out98.9%
+-commutative98.9%
sub-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in im around inf 98.9%
*-commutative98.9%
Simplified98.9%
if -4.5e61 < im < -0.23999999999999999 or 0.089999999999999997 < im < 4.60000000000000005e58Initial program 99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in re around 0 88.8%
*-commutative88.8%
associate-*l*88.8%
Simplified88.8%
if -0.23999999999999999 < im < 0.089999999999999997Initial program 27.8%
associate-*l*27.8%
Simplified27.8%
Taylor expanded in im around 0 99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
associate-*l*99.7%
distribute-lft-out--99.7%
Simplified99.7%
Final simplification98.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.008333333333333333 (* (sin re) (pow im 5.0)))))
(if (<= im -4.5e+61)
t_0
(if (<= im -600.0)
(* re (sqrt (* 6.944444444444444e-5 (pow im 10.0))))
(if (<= im 5.0)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
t_0)))))
double code(double re, double im) {
double t_0 = -0.008333333333333333 * (sin(re) * pow(im, 5.0));
double tmp;
if (im <= -4.5e+61) {
tmp = t_0;
} else if (im <= -600.0) {
tmp = re * sqrt((6.944444444444444e-5 * pow(im, 10.0)));
} else if (im <= 5.0) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.008333333333333333d0) * (sin(re) * (im ** 5.0d0))
if (im <= (-4.5d+61)) then
tmp = t_0
else if (im <= (-600.0d0)) then
tmp = re * sqrt((6.944444444444444d-5 * (im ** 10.0d0)))
else if (im <= 5.0d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.008333333333333333 * (Math.sin(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -4.5e+61) {
tmp = t_0;
} else if (im <= -600.0) {
tmp = re * Math.sqrt((6.944444444444444e-5 * Math.pow(im, 10.0)));
} else if (im <= 5.0) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.008333333333333333 * (math.sin(re) * math.pow(im, 5.0)) tmp = 0 if im <= -4.5e+61: tmp = t_0 elif im <= -600.0: tmp = re * math.sqrt((6.944444444444444e-5 * math.pow(im, 10.0))) elif im <= 5.0: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.008333333333333333 * Float64(sin(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -4.5e+61) tmp = t_0; elseif (im <= -600.0) tmp = Float64(re * sqrt(Float64(6.944444444444444e-5 * (im ^ 10.0)))); elseif (im <= 5.0) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.008333333333333333 * (sin(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -4.5e+61) tmp = t_0; elseif (im <= -600.0) tmp = re * sqrt((6.944444444444444e-5 * (im ^ 10.0))); elseif (im <= 5.0) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+61], t$95$0, If[LessEqual[im, -600.0], N[(re * N[Sqrt[N[(6.944444444444444e-5 * N[Power[im, 10.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -600:\\
\;\;\;\;re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}\\
\mathbf{elif}\;im \leq 5:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.5e61 or 5 < im Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around 0 88.2%
*-commutative88.2%
associate-*l*88.2%
+-commutative88.2%
mul-1-neg88.2%
*-commutative88.2%
distribute-lft-neg-in88.2%
*-commutative88.2%
associate-*r*88.2%
distribute-rgt-out88.2%
distribute-lft-out88.2%
+-commutative88.2%
sub-neg88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in im around inf 88.2%
*-commutative88.2%
Simplified88.2%
if -4.5e61 < im < -600Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around 0 4.2%
*-commutative4.2%
associate-*l*4.2%
+-commutative4.2%
mul-1-neg4.2%
*-commutative4.2%
distribute-lft-neg-in4.2%
*-commutative4.2%
associate-*r*4.2%
distribute-rgt-out4.2%
distribute-lft-out4.2%
+-commutative4.2%
sub-neg4.2%
*-commutative4.2%
Simplified4.2%
Taylor expanded in re around 0 3.2%
Taylor expanded in im around inf 3.2%
*-commutative3.2%
associate-*l*3.2%
*-commutative3.2%
Simplified3.2%
add-sqr-sqrt3.2%
sqrt-unprod41.4%
swap-sqr41.4%
metadata-eval41.4%
pow-prod-up41.4%
metadata-eval41.4%
Applied egg-rr41.4%
if -600 < im < 5Initial program 28.3%
associate-*l*28.3%
Simplified28.3%
Taylor expanded in im around 0 99.2%
mul-1-neg99.2%
unsub-neg99.2%
*-commutative99.2%
associate-*l*99.2%
distribute-lft-out--99.2%
Simplified99.2%
Final simplification91.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.008333333333333333 (* (sin re) (pow im 5.0)))))
(if (<= im -4.5e+61)
t_0
(if (<= im -480.0)
(* re (sqrt (* 6.944444444444444e-5 (pow im 10.0))))
(if (<= im 3.3) (* (- im) (sin re)) t_0)))))
double code(double re, double im) {
double t_0 = -0.008333333333333333 * (sin(re) * pow(im, 5.0));
double tmp;
if (im <= -4.5e+61) {
tmp = t_0;
} else if (im <= -480.0) {
tmp = re * sqrt((6.944444444444444e-5 * pow(im, 10.0)));
} else if (im <= 3.3) {
tmp = -im * sin(re);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.008333333333333333d0) * (sin(re) * (im ** 5.0d0))
if (im <= (-4.5d+61)) then
tmp = t_0
else if (im <= (-480.0d0)) then
tmp = re * sqrt((6.944444444444444d-5 * (im ** 10.0d0)))
else if (im <= 3.3d0) then
tmp = -im * sin(re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.008333333333333333 * (Math.sin(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -4.5e+61) {
tmp = t_0;
} else if (im <= -480.0) {
tmp = re * Math.sqrt((6.944444444444444e-5 * Math.pow(im, 10.0)));
} else if (im <= 3.3) {
tmp = -im * Math.sin(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.008333333333333333 * (math.sin(re) * math.pow(im, 5.0)) tmp = 0 if im <= -4.5e+61: tmp = t_0 elif im <= -480.0: tmp = re * math.sqrt((6.944444444444444e-5 * math.pow(im, 10.0))) elif im <= 3.3: tmp = -im * math.sin(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.008333333333333333 * Float64(sin(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -4.5e+61) tmp = t_0; elseif (im <= -480.0) tmp = Float64(re * sqrt(Float64(6.944444444444444e-5 * (im ^ 10.0)))); elseif (im <= 3.3) tmp = Float64(Float64(-im) * sin(re)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.008333333333333333 * (sin(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -4.5e+61) tmp = t_0; elseif (im <= -480.0) tmp = re * sqrt((6.944444444444444e-5 * (im ^ 10.0))); elseif (im <= 3.3) tmp = -im * sin(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+61], t$95$0, If[LessEqual[im, -480.0], N[(re * N[Sqrt[N[(6.944444444444444e-5 * N[Power[im, 10.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.3], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -480:\\
\;\;\;\;re \cdot \sqrt{6.944444444444444 \cdot 10^{-5} \cdot {im}^{10}}\\
\mathbf{elif}\;im \leq 3.3:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.5e61 or 3.2999999999999998 < im Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around 0 88.2%
*-commutative88.2%
associate-*l*88.2%
+-commutative88.2%
mul-1-neg88.2%
*-commutative88.2%
distribute-lft-neg-in88.2%
*-commutative88.2%
associate-*r*88.2%
distribute-rgt-out88.2%
distribute-lft-out88.2%
+-commutative88.2%
sub-neg88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in im around inf 88.2%
*-commutative88.2%
Simplified88.2%
if -4.5e61 < im < -480Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around 0 4.2%
*-commutative4.2%
associate-*l*4.2%
+-commutative4.2%
mul-1-neg4.2%
*-commutative4.2%
distribute-lft-neg-in4.2%
*-commutative4.2%
associate-*r*4.2%
distribute-rgt-out4.2%
distribute-lft-out4.2%
+-commutative4.2%
sub-neg4.2%
*-commutative4.2%
Simplified4.2%
Taylor expanded in re around 0 3.2%
Taylor expanded in im around inf 3.2%
*-commutative3.2%
associate-*l*3.2%
*-commutative3.2%
Simplified3.2%
add-sqr-sqrt3.2%
sqrt-unprod41.4%
swap-sqr41.4%
metadata-eval41.4%
pow-prod-up41.4%
metadata-eval41.4%
Applied egg-rr41.4%
if -480 < im < 3.2999999999999998Initial program 28.3%
associate-*l*28.3%
Simplified28.3%
Taylor expanded in im around 0 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-rgt-neg-in98.2%
Simplified98.2%
Final simplification91.1%
(FPCore (re im) :precision binary64 (if (or (<= im -3.3) (not (<= im 3.3))) (* -0.008333333333333333 (* (sin re) (pow im 5.0))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -3.3) || !(im <= 3.3)) {
tmp = -0.008333333333333333 * (sin(re) * pow(im, 5.0));
} else {
tmp = -im * sin(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)) .or. (.not. (im <= 3.3d0))) then
tmp = (-0.008333333333333333d0) * (sin(re) * (im ** 5.0d0))
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.3) || !(im <= 3.3)) {
tmp = -0.008333333333333333 * (Math.sin(re) * Math.pow(im, 5.0));
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.3) or not (im <= 3.3): tmp = -0.008333333333333333 * (math.sin(re) * math.pow(im, 5.0)) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.3) || !(im <= 3.3)) tmp = Float64(-0.008333333333333333 * Float64(sin(re) * (im ^ 5.0))); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.3) || ~((im <= 3.3))) tmp = -0.008333333333333333 * (sin(re) * (im ^ 5.0)); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.3], N[Not[LessEqual[im, 3.3]], $MachinePrecision]], N[(-0.008333333333333333 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.3 \lor \neg \left(im \leq 3.3\right):\\
\;\;\;\;-0.008333333333333333 \cdot \left(\sin re \cdot {im}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -3.2999999999999998 or 3.2999999999999998 < im Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around 0 76.9%
*-commutative76.9%
associate-*l*76.9%
+-commutative76.9%
mul-1-neg76.9%
*-commutative76.9%
distribute-lft-neg-in76.9%
*-commutative76.9%
associate-*r*76.9%
distribute-rgt-out76.9%
distribute-lft-out76.9%
+-commutative76.9%
sub-neg76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in im around inf 76.9%
*-commutative76.9%
Simplified76.9%
if -3.2999999999999998 < im < 3.2999999999999998Initial program 28.3%
associate-*l*28.3%
Simplified28.3%
Taylor expanded in im around 0 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-rgt-neg-in98.2%
Simplified98.2%
Final simplification88.9%
(FPCore (re im)
:precision binary64
(if (<= im -0.00046)
(*
(+ (* im -2.0) (* (pow im 3.0) -0.3333333333333333))
(* re (+ 0.5 (* -0.08333333333333333 (* re re)))))
(if (<= im 4200.0)
(* (- im) (sin re))
(* -0.008333333333333333 (* re (pow im 5.0))))))
double code(double re, double im) {
double tmp;
if (im <= -0.00046) {
tmp = ((im * -2.0) + (pow(im, 3.0) * -0.3333333333333333)) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
} else if (im <= 4200.0) {
tmp = -im * sin(re);
} else {
tmp = -0.008333333333333333 * (re * pow(im, 5.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-0.00046d0)) then
tmp = ((im * (-2.0d0)) + ((im ** 3.0d0) * (-0.3333333333333333d0))) * (re * (0.5d0 + ((-0.08333333333333333d0) * (re * re))))
else if (im <= 4200.0d0) then
tmp = -im * sin(re)
else
tmp = (-0.008333333333333333d0) * (re * (im ** 5.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -0.00046) {
tmp = ((im * -2.0) + (Math.pow(im, 3.0) * -0.3333333333333333)) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
} else if (im <= 4200.0) {
tmp = -im * Math.sin(re);
} else {
tmp = -0.008333333333333333 * (re * Math.pow(im, 5.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -0.00046: tmp = ((im * -2.0) + (math.pow(im, 3.0) * -0.3333333333333333)) * (re * (0.5 + (-0.08333333333333333 * (re * re)))) elif im <= 4200.0: tmp = -im * math.sin(re) else: tmp = -0.008333333333333333 * (re * math.pow(im, 5.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= -0.00046) tmp = Float64(Float64(Float64(im * -2.0) + Float64((im ^ 3.0) * -0.3333333333333333)) * Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re))))); elseif (im <= 4200.0) tmp = Float64(Float64(-im) * sin(re)); else tmp = Float64(-0.008333333333333333 * Float64(re * (im ^ 5.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -0.00046) tmp = ((im * -2.0) + ((im ^ 3.0) * -0.3333333333333333)) * (re * (0.5 + (-0.08333333333333333 * (re * re)))); elseif (im <= 4200.0) tmp = -im * sin(re); else tmp = -0.008333333333333333 * (re * (im ^ 5.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -0.00046], N[(N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] * N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4200.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(-0.008333333333333333 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.00046:\\
\;\;\;\;\left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{elif}\;im \leq 4200:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\
\end{array}
\end{array}
if im < -4.6000000000000001e-4Initial program 99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in re around 0 3.0%
+-commutative3.0%
*-commutative3.0%
associate-*l*3.0%
*-commutative3.0%
associate-*l*3.0%
distribute-lft-out79.2%
*-commutative79.2%
*-commutative79.2%
unpow379.2%
associate-*r*79.2%
distribute-rgt-out79.2%
Simplified79.2%
Taylor expanded in im around 0 58.3%
if -4.6000000000000001e-4 < im < 4200Initial program 27.4%
associate-*l*27.4%
Simplified27.4%
Taylor expanded in im around 0 99.0%
mul-1-neg99.0%
*-commutative99.0%
distribute-rgt-neg-in99.0%
Simplified99.0%
if 4200 < im Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around 0 77.5%
*-commutative77.5%
associate-*l*77.5%
+-commutative77.5%
mul-1-neg77.5%
*-commutative77.5%
distribute-lft-neg-in77.5%
*-commutative77.5%
associate-*r*77.5%
distribute-rgt-out77.5%
distribute-lft-out77.5%
+-commutative77.5%
sub-neg77.5%
*-commutative77.5%
Simplified77.5%
Taylor expanded in re around 0 55.8%
Taylor expanded in im around inf 55.8%
Final simplification80.4%
(FPCore (re im) :precision binary64 (if (or (<= im -760.0) (not (<= im 6600.0))) (* -0.008333333333333333 (* re (pow im 5.0))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -760.0) || !(im <= 6600.0)) {
tmp = -0.008333333333333333 * (re * pow(im, 5.0));
} else {
tmp = -im * sin(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-760.0d0)) .or. (.not. (im <= 6600.0d0))) then
tmp = (-0.008333333333333333d0) * (re * (im ** 5.0d0))
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -760.0) || !(im <= 6600.0)) {
tmp = -0.008333333333333333 * (re * Math.pow(im, 5.0));
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -760.0) or not (im <= 6600.0): tmp = -0.008333333333333333 * (re * math.pow(im, 5.0)) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -760.0) || !(im <= 6600.0)) tmp = Float64(-0.008333333333333333 * Float64(re * (im ^ 5.0))); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -760.0) || ~((im <= 6600.0))) tmp = -0.008333333333333333 * (re * (im ^ 5.0)); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -760.0], N[Not[LessEqual[im, 6600.0]], $MachinePrecision]], N[(-0.008333333333333333 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -760 \lor \neg \left(im \leq 6600\right):\\
\;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -760 or 6600 < im Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around 0 76.9%
*-commutative76.9%
associate-*l*76.9%
+-commutative76.9%
mul-1-neg76.9%
*-commutative76.9%
distribute-lft-neg-in76.9%
*-commutative76.9%
associate-*r*76.9%
distribute-rgt-out76.9%
distribute-lft-out76.9%
+-commutative76.9%
sub-neg76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in re around 0 55.3%
Taylor expanded in im around inf 55.3%
if -760 < im < 6600Initial program 28.3%
associate-*l*28.3%
Simplified28.3%
Taylor expanded in im around 0 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-rgt-neg-in98.2%
Simplified98.2%
Final simplification79.4%
(FPCore (re im) :precision binary64 (if (or (<= im -1e+23) (not (<= im 3.55e+22))) (* (* im -2.0) (* re (+ 0.5 (* -0.08333333333333333 (* re re))))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -1e+23) || !(im <= 3.55e+22)) {
tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
} else {
tmp = -im * sin(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-1d+23)) .or. (.not. (im <= 3.55d+22))) then
tmp = (im * (-2.0d0)) * (re * (0.5d0 + ((-0.08333333333333333d0) * (re * re))))
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1e+23) || !(im <= 3.55e+22)) {
tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1e+23) or not (im <= 3.55e+22): tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re)))) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1e+23) || !(im <= 3.55e+22)) tmp = Float64(Float64(im * -2.0) * Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re))))); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1e+23) || ~((im <= 3.55e+22))) tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re)))); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1e+23], N[Not[LessEqual[im, 3.55e+22]], $MachinePrecision]], N[(N[(im * -2.0), $MachinePrecision] * N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1 \cdot 10^{+23} \lor \neg \left(im \leq 3.55 \cdot 10^{+22}\right):\\
\;\;\;\;\left(im \cdot -2\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -9.9999999999999992e22 or 3.5500000000000001e22 < im Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*l*0.0%
*-commutative0.0%
associate-*l*0.0%
distribute-lft-out76.8%
*-commutative76.8%
*-commutative76.8%
unpow376.8%
associate-*r*76.8%
distribute-rgt-out76.8%
Simplified76.8%
Taylor expanded in im around 0 26.2%
if -9.9999999999999992e22 < im < 3.5500000000000001e22Initial program 34.2%
associate-*l*34.2%
Simplified34.2%
Taylor expanded in im around 0 90.3%
mul-1-neg90.3%
*-commutative90.3%
distribute-rgt-neg-in90.3%
Simplified90.3%
Final simplification65.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (+ 0.5 (* -0.08333333333333333 (* re re)))))
(t_1 (* t_0 -3.0)))
(if (<= re -3.2e+123)
t_1
(if (<= re 1.35e+100)
(* im (- re))
(if (<= re 4.6e+189) (* t_0 27.0) t_1)))))
double code(double re, double im) {
double t_0 = re * (0.5 + (-0.08333333333333333 * (re * re)));
double t_1 = t_0 * -3.0;
double tmp;
if (re <= -3.2e+123) {
tmp = t_1;
} else if (re <= 1.35e+100) {
tmp = im * -re;
} else if (re <= 4.6e+189) {
tmp = t_0 * 27.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 = re * (0.5d0 + ((-0.08333333333333333d0) * (re * re)))
t_1 = t_0 * (-3.0d0)
if (re <= (-3.2d+123)) then
tmp = t_1
else if (re <= 1.35d+100) then
tmp = im * -re
else if (re <= 4.6d+189) then
tmp = t_0 * 27.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (0.5 + (-0.08333333333333333 * (re * re)));
double t_1 = t_0 * -3.0;
double tmp;
if (re <= -3.2e+123) {
tmp = t_1;
} else if (re <= 1.35e+100) {
tmp = im * -re;
} else if (re <= 4.6e+189) {
tmp = t_0 * 27.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = re * (0.5 + (-0.08333333333333333 * (re * re))) t_1 = t_0 * -3.0 tmp = 0 if re <= -3.2e+123: tmp = t_1 elif re <= 1.35e+100: tmp = im * -re elif re <= 4.6e+189: tmp = t_0 * 27.0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re)))) t_1 = Float64(t_0 * -3.0) tmp = 0.0 if (re <= -3.2e+123) tmp = t_1; elseif (re <= 1.35e+100) tmp = Float64(im * Float64(-re)); elseif (re <= 4.6e+189) tmp = Float64(t_0 * 27.0); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (0.5 + (-0.08333333333333333 * (re * re))); t_1 = t_0 * -3.0; tmp = 0.0; if (re <= -3.2e+123) tmp = t_1; elseif (re <= 1.35e+100) tmp = im * -re; elseif (re <= 4.6e+189) tmp = t_0 * 27.0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * -3.0), $MachinePrecision]}, If[LessEqual[re, -3.2e+123], t$95$1, If[LessEqual[re, 1.35e+100], N[(im * (-re)), $MachinePrecision], If[LessEqual[re, 4.6e+189], N[(t$95$0 * 27.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\\
t_1 := t_0 \cdot -3\\
\mathbf{if}\;re \leq -3.2 \cdot 10^{+123}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;re \leq 1.35 \cdot 10^{+100}:\\
\;\;\;\;im \cdot \left(-re\right)\\
\mathbf{elif}\;re \leq 4.6 \cdot 10^{+189}:\\
\;\;\;\;t_0 \cdot 27\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if re < -3.20000000000000005e123 or 4.6e189 < re Initial program 44.4%
associate-*l*44.4%
Simplified44.4%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*l*0.0%
*-commutative0.0%
associate-*l*0.0%
distribute-lft-out22.9%
*-commutative22.9%
*-commutative22.9%
unpow322.9%
associate-*r*22.9%
distribute-rgt-out22.9%
Simplified22.9%
Applied egg-rr25.3%
if -3.20000000000000005e123 < re < 1.34999999999999999e100Initial program 65.0%
associate-*l*65.0%
Simplified65.0%
Taylor expanded in im around 0 57.1%
mul-1-neg57.1%
*-commutative57.1%
distribute-rgt-neg-in57.1%
Simplified57.1%
Taylor expanded in re around 0 41.2%
mul-1-neg41.2%
*-commutative41.2%
distribute-rgt-neg-in41.2%
Simplified41.2%
if 1.34999999999999999e100 < re < 4.6e189Initial program 71.4%
associate-*l*71.4%
Simplified71.4%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*l*0.0%
*-commutative0.0%
associate-*l*0.0%
distribute-lft-out46.2%
*-commutative46.2%
*-commutative46.2%
unpow346.2%
associate-*r*46.2%
distribute-rgt-out46.2%
Simplified46.2%
Applied egg-rr47.6%
Final simplification37.1%
(FPCore (re im) :precision binary64 (if (or (<= re -4e+125) (not (<= re 9e+102))) (* (* re (+ 0.5 (* -0.08333333333333333 (* re re)))) -3.0) (* im (- re))))
double code(double re, double im) {
double tmp;
if ((re <= -4e+125) || !(re <= 9e+102)) {
tmp = (re * (0.5 + (-0.08333333333333333 * (re * re)))) * -3.0;
} else {
tmp = im * -re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= (-4d+125)) .or. (.not. (re <= 9d+102))) then
tmp = (re * (0.5d0 + ((-0.08333333333333333d0) * (re * re)))) * (-3.0d0)
else
tmp = im * -re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -4e+125) || !(re <= 9e+102)) {
tmp = (re * (0.5 + (-0.08333333333333333 * (re * re)))) * -3.0;
} else {
tmp = im * -re;
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -4e+125) or not (re <= 9e+102): tmp = (re * (0.5 + (-0.08333333333333333 * (re * re)))) * -3.0 else: tmp = im * -re return tmp
function code(re, im) tmp = 0.0 if ((re <= -4e+125) || !(re <= 9e+102)) tmp = Float64(Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re)))) * -3.0); else tmp = Float64(im * Float64(-re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -4e+125) || ~((re <= 9e+102))) tmp = (re * (0.5 + (-0.08333333333333333 * (re * re)))) * -3.0; else tmp = im * -re; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -4e+125], N[Not[LessEqual[re, 9e+102]], $MachinePrecision]], N[(N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -3.0), $MachinePrecision], N[(im * (-re)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4 \cdot 10^{+125} \lor \neg \left(re \leq 9 \cdot 10^{+102}\right):\\
\;\;\;\;\left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right) \cdot -3\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-re\right)\\
\end{array}
\end{array}
if re < -3.9999999999999997e125 or 9.00000000000000042e102 < re Initial program 48.0%
associate-*l*48.0%
Simplified48.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*l*0.0%
*-commutative0.0%
associate-*l*0.0%
distribute-lft-out25.6%
*-commutative25.6%
*-commutative25.6%
unpow325.6%
associate-*r*25.6%
distribute-rgt-out25.6%
Simplified25.6%
Applied egg-rr24.1%
if -3.9999999999999997e125 < re < 9.00000000000000042e102Initial program 65.2%
associate-*l*65.2%
Simplified65.2%
Taylor expanded in im around 0 56.8%
mul-1-neg56.8%
*-commutative56.8%
distribute-rgt-neg-in56.8%
Simplified56.8%
Taylor expanded in re around 0 40.9%
mul-1-neg40.9%
*-commutative40.9%
distribute-rgt-neg-in40.9%
Simplified40.9%
Final simplification35.5%
(FPCore (re im) :precision binary64 (* (* im -2.0) (* re (+ 0.5 (* -0.08333333333333333 (* re re))))))
double code(double re, double im) {
return (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (im * (-2.0d0)) * (re * (0.5d0 + ((-0.08333333333333333d0) * (re * re))))
end function
public static double code(double re, double im) {
return (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))));
}
def code(re, im): return (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re))))
function code(re, im) return Float64(Float64(im * -2.0) * Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re))))) end
function tmp = code(re, im) tmp = (im * -2.0) * (re * (0.5 + (-0.08333333333333333 * (re * re)))); end
code[re_, im_] := N[(N[(im * -2.0), $MachinePrecision] * N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(im \cdot -2\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)
\end{array}
Initial program 59.7%
associate-*l*59.7%
Simplified59.7%
Taylor expanded in re around 0 13.9%
+-commutative13.9%
*-commutative13.9%
associate-*l*13.9%
*-commutative13.9%
associate-*l*13.9%
distribute-lft-out46.7%
*-commutative46.7%
*-commutative46.7%
unpow346.7%
associate-*r*46.7%
distribute-rgt-out46.7%
Simplified46.7%
Taylor expanded in im around 0 35.3%
Final simplification35.3%
(FPCore (re im) :precision binary64 (* im (- re)))
double code(double re, double im) {
return im * -re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im * -re
end function
public static double code(double re, double im) {
return im * -re;
}
def code(re, im): return im * -re
function code(re, im) return Float64(im * Float64(-re)) end
function tmp = code(re, im) tmp = im * -re; end
code[re_, im_] := N[(im * (-re)), $MachinePrecision]
\begin{array}{l}
\\
im \cdot \left(-re\right)
\end{array}
Initial program 59.7%
associate-*l*59.7%
Simplified59.7%
Taylor expanded in im around 0 57.2%
mul-1-neg57.2%
*-commutative57.2%
distribute-rgt-neg-in57.2%
Simplified57.2%
Taylor expanded in re around 0 31.7%
mul-1-neg31.7%
*-commutative31.7%
distribute-rgt-neg-in31.7%
Simplified31.7%
Final simplification31.7%
(FPCore (re im)
:precision binary64
(if (< (fabs im) 1.0)
(-
(*
(sin re)
(+
(+ im (* (* (* 0.16666666666666666 im) im) im))
(* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if (fabs(im) < 1.0) {
tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (abs(im) < 1.0d0) then
tmp = -(sin(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
else
tmp = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.abs(im) < 1.0) {
tmp = -(Math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if math.fabs(im) < 1.0: tmp = -(math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))) else: tmp = (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (abs(im) < 1.0) tmp = Float64(-Float64(sin(re) * Float64(Float64(im + Float64(Float64(Float64(0.16666666666666666 * im) * im) * im)) + Float64(Float64(Float64(Float64(Float64(0.008333333333333333 * im) * im) * im) * im) * im)))); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (abs(im) < 1.0) tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))); else tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Sin[re], $MachinePrecision] * N[(N[(im + N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(0.008333333333333333 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\end{array}
herbie shell --seed 2023172
(FPCore (re im)
:name "math.cos on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1.0) (- (* (sin re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))