
(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 14 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 -0.4) (not (<= t_0 5e-5)))
(* t_0 (* 0.5 (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 <= -0.4) || !(t_0 <= 5e-5)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-im) - exp(im)
if ((t_0 <= (-0.4d0)) .or. (.not. (t_0 <= 5d-5))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -0.4) || !(t_0 <= 5e-5)) {
tmp = t_0 * (0.5 * 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 <= -0.4) or not (t_0 <= 5e-5): tmp = t_0 * (0.5 * 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 <= -0.4) || !(t_0 <= 5e-5)) tmp = Float64(t_0 * Float64(0.5 * 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 <= -0.4) || ~((t_0 <= 5e-5))) tmp = t_0 * (0.5 * 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, -0.4], N[Not[LessEqual[t$95$0, 5e-5]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * 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 -0.4 \lor \neg \left(t_0 \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \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)) < -0.40000000000000002 or 5.00000000000000024e-5 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -0.40000000000000002 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 5.00000000000000024e-5Initial program 27.3%
Taylor expanded in im around 0 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
associate-*r*99.8%
distribute-rgt-out--99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (- (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -5.5e+102)
t_1
(if (<= im -0.022)
t_0
(if (<= im 0.05)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 2.7e+99) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 * re);
double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.5e+102) {
tmp = t_1;
} else if (im <= -0.022) {
tmp = t_0;
} else if (im <= 0.05) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 2.7e+99) {
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 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-5.5d+102)) then
tmp = t_1
else if (im <= (-0.022d0)) then
tmp = t_0
else if (im <= 0.05d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 2.7d+99) 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 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.5e+102) {
tmp = t_1;
} else if (im <= -0.022) {
tmp = t_0;
} else if (im <= 0.05) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 2.7e+99) {
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 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -5.5e+102: tmp = t_1 elif im <= -0.022: tmp = t_0 elif im <= 0.05: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 2.7e+99: 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((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -5.5e+102) tmp = t_1; elseif (im <= -0.022) tmp = t_0; elseif (im <= 0.05) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 2.7e+99) 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 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -5.5e+102) tmp = t_1; elseif (im <= -0.022) tmp = t_0; elseif (im <= 0.05) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 2.7e+99) 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[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.5e+102], t$95$1, If[LessEqual[im, -0.022], t$95$0, If[LessEqual[im, 0.05], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.7e+99], 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 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.022:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.05:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 2.7 \cdot 10^{+99}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -5.49999999999999981e102 or 2.69999999999999989e99 < im Initial program 100.0%
Taylor expanded in im around 0 98.9%
+-commutative98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-*r*98.9%
distribute-rgt-out--98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in im around inf 98.9%
*-commutative98.9%
associate-*l*98.9%
Simplified98.9%
if -5.49999999999999981e102 < im < -0.021999999999999999 or 0.050000000000000003 < im < 2.69999999999999989e99Initial program 99.9%
Taylor expanded in re around 0 81.8%
associate-*r*81.8%
*-commutative81.8%
Simplified81.8%
if -0.021999999999999999 < im < 0.050000000000000003Initial program 27.3%
Taylor expanded in im around 0 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
associate-*r*99.8%
distribute-rgt-out--99.8%
*-commutative99.8%
Simplified99.8%
Final simplification96.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -5.5e+102)
t_0
(if (<= im -8.4e+30)
(* re (sqrt (* 0.027777777777777776 (pow im 6.0))))
(if (<= im 2.4) (* (- im) (sin re)) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.5e+102) {
tmp = t_0;
} else if (im <= -8.4e+30) {
tmp = re * sqrt((0.027777777777777776 * pow(im, 6.0)));
} else if (im <= 2.4) {
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 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-5.5d+102)) then
tmp = t_0
else if (im <= (-8.4d+30)) then
tmp = re * sqrt((0.027777777777777776d0 * (im ** 6.0d0)))
else if (im <= 2.4d0) 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 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.5e+102) {
tmp = t_0;
} else if (im <= -8.4e+30) {
tmp = re * Math.sqrt((0.027777777777777776 * Math.pow(im, 6.0)));
} else if (im <= 2.4) {
tmp = -im * Math.sin(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -5.5e+102: tmp = t_0 elif im <= -8.4e+30: tmp = re * math.sqrt((0.027777777777777776 * math.pow(im, 6.0))) elif im <= 2.4: tmp = -im * math.sin(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -5.5e+102) tmp = t_0; elseif (im <= -8.4e+30) tmp = Float64(re * sqrt(Float64(0.027777777777777776 * (im ^ 6.0)))); elseif (im <= 2.4) tmp = Float64(Float64(-im) * sin(re)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -5.5e+102) tmp = t_0; elseif (im <= -8.4e+30) tmp = re * sqrt((0.027777777777777776 * (im ^ 6.0))); elseif (im <= 2.4) tmp = -im * sin(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.5e+102], t$95$0, If[LessEqual[im, -8.4e+30], N[(re * N[Sqrt[N[(0.027777777777777776 * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.4], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -8.4 \cdot 10^{+30}:\\
\;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\
\mathbf{elif}\;im \leq 2.4:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.49999999999999981e102 or 2.39999999999999991 < im Initial program 100.0%
Taylor expanded in im around 0 82.8%
+-commutative82.8%
mul-1-neg82.8%
unsub-neg82.8%
associate-*r*82.8%
distribute-rgt-out--82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in im around inf 82.8%
*-commutative82.8%
associate-*l*82.8%
Simplified82.8%
if -5.49999999999999981e102 < im < -8.4000000000000001e30Initial program 100.0%
Taylor expanded in im around 0 5.0%
+-commutative5.0%
mul-1-neg5.0%
unsub-neg5.0%
associate-*r*5.0%
distribute-rgt-out--5.0%
*-commutative5.0%
Simplified5.0%
Taylor expanded in re around 0 14.4%
Taylor expanded in im around inf 14.4%
associate-*r*14.4%
*-commutative14.4%
Simplified14.4%
add-sqr-sqrt14.4%
sqrt-unprod69.0%
swap-sqr69.0%
metadata-eval69.0%
pow-prod-up69.0%
metadata-eval69.0%
Applied egg-rr69.0%
if -8.4000000000000001e30 < im < 2.39999999999999991Initial program 31.5%
Taylor expanded in im around 0 94.3%
associate-*r*94.3%
neg-mul-194.3%
Simplified94.3%
Final simplification88.0%
(FPCore (re im)
:precision binary64
(if (<= im -5.5e+102)
(* (pow im 3.0) (* (sin re) -0.16666666666666666))
(if (<= im -4.6e+33)
(* re (sqrt (* 0.027777777777777776 (pow im 6.0))))
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
double tmp;
if (im <= -5.5e+102) {
tmp = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
} else if (im <= -4.6e+33) {
tmp = re * sqrt((0.027777777777777776 * pow(im, 6.0)));
} else {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-5.5d+102)) then
tmp = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
else if (im <= (-4.6d+33)) then
tmp = re * sqrt((0.027777777777777776d0 * (im ** 6.0d0)))
else
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -5.5e+102) {
tmp = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
} else if (im <= -4.6e+33) {
tmp = re * Math.sqrt((0.027777777777777776 * Math.pow(im, 6.0)));
} else {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -5.5e+102: tmp = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) elif im <= -4.6e+33: tmp = re * math.sqrt((0.027777777777777776 * math.pow(im, 6.0))) else: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) tmp = 0.0 if (im <= -5.5e+102) tmp = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)); elseif (im <= -4.6e+33) tmp = Float64(re * sqrt(Float64(0.027777777777777776 * (im ^ 6.0)))); else tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -5.5e+102) tmp = (im ^ 3.0) * (sin(re) * -0.16666666666666666); elseif (im <= -4.6e+33) tmp = re * sqrt((0.027777777777777776 * (im ^ 6.0))); else tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -5.5e+102], N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -4.6e+33], N[(re * N[Sqrt[N[(0.027777777777777776 * N[Power[im, 6.0], $MachinePrecision]), $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}
\mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;im \leq -4.6 \cdot 10^{+33}:\\
\;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if im < -5.49999999999999981e102Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -5.49999999999999981e102 < im < -4.60000000000000021e33Initial program 100.0%
Taylor expanded in im around 0 5.0%
+-commutative5.0%
mul-1-neg5.0%
unsub-neg5.0%
associate-*r*5.0%
distribute-rgt-out--5.0%
*-commutative5.0%
Simplified5.0%
Taylor expanded in re around 0 14.4%
Taylor expanded in im around inf 14.4%
associate-*r*14.4%
*-commutative14.4%
Simplified14.4%
add-sqr-sqrt14.4%
sqrt-unprod69.0%
swap-sqr69.0%
metadata-eval69.0%
pow-prod-up69.0%
metadata-eval69.0%
Applied egg-rr69.0%
if -4.60000000000000021e33 < im Initial program 51.5%
Taylor expanded in im around 0 87.4%
+-commutative87.4%
mul-1-neg87.4%
unsub-neg87.4%
associate-*r*87.4%
distribute-rgt-out--87.5%
*-commutative87.5%
Simplified87.5%
Final simplification88.1%
(FPCore (re im)
:precision binary64
(if (<= im -3.5e+31)
(* re (sqrt (* 0.027777777777777776 (pow im 6.0))))
(if (<= im 4.8e-20)
(* (- im) (sin re))
(* re (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
double tmp;
if (im <= -3.5e+31) {
tmp = re * sqrt((0.027777777777777776 * pow(im, 6.0)));
} else if (im <= 4.8e-20) {
tmp = -im * sin(re);
} else {
tmp = re * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-3.5d+31)) then
tmp = re * sqrt((0.027777777777777776d0 * (im ** 6.0d0)))
else if (im <= 4.8d-20) then
tmp = -im * sin(re)
else
tmp = re * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.5e+31) {
tmp = re * Math.sqrt((0.027777777777777776 * Math.pow(im, 6.0)));
} else if (im <= 4.8e-20) {
tmp = -im * Math.sin(re);
} else {
tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.5e+31: tmp = re * math.sqrt((0.027777777777777776 * math.pow(im, 6.0))) elif im <= 4.8e-20: tmp = -im * math.sin(re) else: tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) tmp = 0.0 if (im <= -3.5e+31) tmp = Float64(re * sqrt(Float64(0.027777777777777776 * (im ^ 6.0)))); elseif (im <= 4.8e-20) tmp = Float64(Float64(-im) * sin(re)); else tmp = Float64(re * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.5e+31) tmp = re * sqrt((0.027777777777777776 * (im ^ 6.0))); elseif (im <= 4.8e-20) tmp = -im * sin(re); else tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.5e+31], N[(re * N[Sqrt[N[(0.027777777777777776 * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.8e-20], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.5 \cdot 10^{+31}:\\
\;\;\;\;re \cdot \sqrt{0.027777777777777776 \cdot {im}^{6}}\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{-20}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if im < -3.5e31Initial program 100.0%
Taylor expanded in im around 0 70.4%
+-commutative70.4%
mul-1-neg70.4%
unsub-neg70.4%
associate-*r*70.4%
distribute-rgt-out--70.4%
*-commutative70.4%
Simplified70.4%
Taylor expanded in re around 0 56.9%
Taylor expanded in im around inf 56.9%
associate-*r*56.9%
*-commutative56.9%
Simplified56.9%
add-sqr-sqrt56.9%
sqrt-unprod74.0%
swap-sqr74.0%
metadata-eval74.0%
pow-prod-up74.0%
metadata-eval74.0%
Applied egg-rr74.0%
if -3.5e31 < im < 4.79999999999999986e-20Initial program 30.7%
Taylor expanded in im around 0 95.3%
associate-*r*95.3%
neg-mul-195.3%
Simplified95.3%
if 4.79999999999999986e-20 < im Initial program 98.3%
Taylor expanded in im around 0 69.3%
+-commutative69.3%
mul-1-neg69.3%
unsub-neg69.3%
associate-*r*69.3%
distribute-rgt-out--69.3%
*-commutative69.3%
Simplified69.3%
Taylor expanded in re around 0 60.5%
Final simplification82.1%
(FPCore (re im)
:precision binary64
(if (<= im -6.1e+106)
(* -0.16666666666666666 (* re (pow im 3.0)))
(if (<= im -510.0)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (<= im 4.8e-20)
(* (- im) (sin re))
(* re (- (* (pow im 3.0) -0.16666666666666666) im))))))
double code(double re, double im) {
double tmp;
if (im <= -6.1e+106) {
tmp = -0.16666666666666666 * (re * pow(im, 3.0));
} else if (im <= -510.0) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if (im <= 4.8e-20) {
tmp = -im * sin(re);
} else {
tmp = re * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-6.1d+106)) then
tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
else if (im <= (-510.0d0)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if (im <= 4.8d-20) then
tmp = -im * sin(re)
else
tmp = re * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -6.1e+106) {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
} else if (im <= -510.0) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if (im <= 4.8e-20) {
tmp = -im * Math.sin(re);
} else {
tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -6.1e+106: tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) elif im <= -510.0: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif im <= 4.8e-20: tmp = -im * math.sin(re) else: tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) tmp = 0.0 if (im <= -6.1e+106) tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))); elseif (im <= -510.0) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif (im <= 4.8e-20) tmp = Float64(Float64(-im) * sin(re)); else tmp = Float64(re * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -6.1e+106) tmp = -0.16666666666666666 * (re * (im ^ 3.0)); elseif (im <= -510.0) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif (im <= 4.8e-20) tmp = -im * sin(re); else tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -6.1e+106], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -510.0], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.8e-20], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.1 \cdot 10^{+106}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{elif}\;im \leq -510:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{-20}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if im < -6.10000000000000001e106Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 80.0%
Taylor expanded in im around inf 80.0%
if -6.10000000000000001e106 < im < -510Initial program 100.0%
Taylor expanded in im around 0 3.2%
associate-*r*3.2%
neg-mul-13.2%
Simplified3.2%
Taylor expanded in re around 0 20.1%
+-commutative20.1%
mul-1-neg20.1%
unsub-neg20.1%
*-commutative20.1%
associate-*r*20.1%
*-commutative20.1%
distribute-rgt-out--27.6%
Simplified27.6%
if -510 < im < 4.79999999999999986e-20Initial program 27.5%
Taylor expanded in im around 0 99.6%
associate-*r*99.6%
neg-mul-199.6%
Simplified99.6%
if 4.79999999999999986e-20 < im Initial program 98.3%
Taylor expanded in im around 0 69.3%
+-commutative69.3%
mul-1-neg69.3%
unsub-neg69.3%
associate-*r*69.3%
distribute-rgt-out--69.3%
*-commutative69.3%
Simplified69.3%
Taylor expanded in re around 0 60.5%
Final simplification79.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0)))))
(if (<= im -6.1e+106)
t_0
(if (<= im -250000000000.0)
(* im (* 0.16666666666666666 (pow re 3.0)))
(if (<= im 5.2e+40) (* (- im) (sin re)) t_0)))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
double tmp;
if (im <= -6.1e+106) {
tmp = t_0;
} else if (im <= -250000000000.0) {
tmp = im * (0.16666666666666666 * pow(re, 3.0));
} else if (im <= 5.2e+40) {
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.16666666666666666d0) * (re * (im ** 3.0d0))
if (im <= (-6.1d+106)) then
tmp = t_0
else if (im <= (-250000000000.0d0)) then
tmp = im * (0.16666666666666666d0 * (re ** 3.0d0))
else if (im <= 5.2d+40) 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.16666666666666666 * (re * Math.pow(im, 3.0));
double tmp;
if (im <= -6.1e+106) {
tmp = t_0;
} else if (im <= -250000000000.0) {
tmp = im * (0.16666666666666666 * Math.pow(re, 3.0));
} else if (im <= 5.2e+40) {
tmp = -im * Math.sin(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0)) tmp = 0 if im <= -6.1e+106: tmp = t_0 elif im <= -250000000000.0: tmp = im * (0.16666666666666666 * math.pow(re, 3.0)) elif im <= 5.2e+40: tmp = -im * math.sin(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))) tmp = 0.0 if (im <= -6.1e+106) tmp = t_0; elseif (im <= -250000000000.0) tmp = Float64(im * Float64(0.16666666666666666 * (re ^ 3.0))); elseif (im <= 5.2e+40) tmp = Float64(Float64(-im) * sin(re)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (re * (im ^ 3.0)); tmp = 0.0; if (im <= -6.1e+106) tmp = t_0; elseif (im <= -250000000000.0) tmp = im * (0.16666666666666666 * (re ^ 3.0)); elseif (im <= 5.2e+40) tmp = -im * sin(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.1e+106], t$95$0, If[LessEqual[im, -250000000000.0], N[(im * N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.2e+40], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{if}\;im \leq -6.1 \cdot 10^{+106}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -250000000000:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3}\right)\\
\mathbf{elif}\;im \leq 5.2 \cdot 10^{+40}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -6.10000000000000001e106 or 5.2000000000000001e40 < im Initial program 100.0%
Taylor expanded in im around 0 92.4%
+-commutative92.4%
mul-1-neg92.4%
unsub-neg92.4%
associate-*r*92.4%
distribute-rgt-out--92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in re around 0 77.1%
Taylor expanded in im around inf 77.1%
if -6.10000000000000001e106 < im < -2.5e11Initial program 100.0%
Taylor expanded in im around 0 3.2%
associate-*r*3.2%
neg-mul-13.2%
Simplified3.2%
Taylor expanded in re around 0 20.8%
+-commutative20.8%
mul-1-neg20.8%
unsub-neg20.8%
*-commutative20.8%
associate-*r*20.8%
*-commutative20.8%
distribute-rgt-out--28.5%
Simplified28.5%
Taylor expanded in re around inf 27.6%
*-commutative27.6%
associate-*l*27.6%
*-commutative27.6%
Simplified27.6%
if -2.5e11 < im < 5.2000000000000001e40Initial program 34.3%
Taylor expanded in im around 0 90.6%
associate-*r*90.6%
neg-mul-190.6%
Simplified90.6%
Final simplification79.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0)))))
(if (<= im -6.1e+106)
t_0
(if (<= im -640.0)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (<= im 5.6e+40) (* (- im) (sin re)) t_0)))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
double tmp;
if (im <= -6.1e+106) {
tmp = t_0;
} else if (im <= -640.0) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if (im <= 5.6e+40) {
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.16666666666666666d0) * (re * (im ** 3.0d0))
if (im <= (-6.1d+106)) then
tmp = t_0
else if (im <= (-640.0d0)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if (im <= 5.6d+40) 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.16666666666666666 * (re * Math.pow(im, 3.0));
double tmp;
if (im <= -6.1e+106) {
tmp = t_0;
} else if (im <= -640.0) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if (im <= 5.6e+40) {
tmp = -im * Math.sin(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0)) tmp = 0 if im <= -6.1e+106: tmp = t_0 elif im <= -640.0: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif im <= 5.6e+40: tmp = -im * math.sin(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))) tmp = 0.0 if (im <= -6.1e+106) tmp = t_0; elseif (im <= -640.0) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif (im <= 5.6e+40) tmp = Float64(Float64(-im) * sin(re)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (re * (im ^ 3.0)); tmp = 0.0; if (im <= -6.1e+106) tmp = t_0; elseif (im <= -640.0) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif (im <= 5.6e+40) tmp = -im * sin(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.1e+106], t$95$0, If[LessEqual[im, -640.0], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6e+40], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{if}\;im \leq -6.1 \cdot 10^{+106}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -640:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+40}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -6.10000000000000001e106 or 5.6000000000000003e40 < im Initial program 100.0%
Taylor expanded in im around 0 92.4%
+-commutative92.4%
mul-1-neg92.4%
unsub-neg92.4%
associate-*r*92.4%
distribute-rgt-out--92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in re around 0 77.1%
Taylor expanded in im around inf 77.1%
if -6.10000000000000001e106 < im < -640Initial program 100.0%
Taylor expanded in im around 0 3.2%
associate-*r*3.2%
neg-mul-13.2%
Simplified3.2%
Taylor expanded in re around 0 20.1%
+-commutative20.1%
mul-1-neg20.1%
unsub-neg20.1%
*-commutative20.1%
associate-*r*20.1%
*-commutative20.1%
distribute-rgt-out--27.6%
Simplified27.6%
if -640 < im < 5.6000000000000003e40Initial program 33.9%
Taylor expanded in im around 0 91.2%
associate-*r*91.2%
neg-mul-191.2%
Simplified91.2%
Final simplification79.7%
(FPCore (re im) :precision binary64 (if (or (<= im -6.8e+30) (not (<= im 3.9e+42))) (* -0.16666666666666666 (* re (pow im 3.0))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -6.8e+30) || !(im <= 3.9e+42)) {
tmp = -0.16666666666666666 * (re * pow(im, 3.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 <= (-6.8d+30)) .or. (.not. (im <= 3.9d+42))) then
tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -6.8e+30) || !(im <= 3.9e+42)) {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -6.8e+30) or not (im <= 3.9e+42): tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -6.8e+30) || !(im <= 3.9e+42)) tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -6.8e+30) || ~((im <= 3.9e+42))) tmp = -0.16666666666666666 * (re * (im ^ 3.0)); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -6.8e+30], N[Not[LessEqual[im, 3.9e+42]], $MachinePrecision]], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.8 \cdot 10^{+30} \lor \neg \left(im \leq 3.9 \cdot 10^{+42}\right):\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -6.8000000000000005e30 or 3.8999999999999997e42 < im Initial program 100.0%
Taylor expanded in im around 0 77.0%
+-commutative77.0%
mul-1-neg77.0%
unsub-neg77.0%
associate-*r*77.0%
distribute-rgt-out--77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in re around 0 64.5%
Taylor expanded in im around inf 64.5%
if -6.8000000000000005e30 < im < 3.8999999999999997e42Initial program 36.5%
Taylor expanded in im around 0 87.6%
associate-*r*87.6%
neg-mul-187.6%
Simplified87.6%
Final simplification78.0%
(FPCore (re im) :precision binary64 (if (<= im 3.4e+129) (* (- im) (sin re)) (* (- im) re)))
double code(double re, double im) {
double tmp;
if (im <= 3.4e+129) {
tmp = -im * sin(re);
} 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 (im <= 3.4d+129) then
tmp = -im * sin(re)
else
tmp = -im * re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 3.4e+129) {
tmp = -im * Math.sin(re);
} else {
tmp = -im * re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 3.4e+129: tmp = -im * math.sin(re) else: tmp = -im * re return tmp
function code(re, im) tmp = 0.0 if (im <= 3.4e+129) tmp = Float64(Float64(-im) * sin(re)); else tmp = Float64(Float64(-im) * re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 3.4e+129) tmp = -im * sin(re); else tmp = -im * re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 3.4e+129], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[((-im) * re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.4 \cdot 10^{+129}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot re\\
\end{array}
\end{array}
if im < 3.40000000000000018e129Initial program 57.8%
Taylor expanded in im around 0 59.6%
associate-*r*59.6%
neg-mul-159.6%
Simplified59.6%
if 3.40000000000000018e129 < im Initial program 100.0%
Taylor expanded in im around 0 4.7%
associate-*r*4.7%
neg-mul-14.7%
Simplified4.7%
Taylor expanded in re around 0 21.9%
associate-*r*21.9%
neg-mul-121.9%
Simplified21.9%
Final simplification54.9%
(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(Float64(-im) * re) end
function tmp = code(re, im) tmp = -im * re; end
code[re_, im_] := N[((-im) * re), $MachinePrecision]
\begin{array}{l}
\\
\left(-im\right) \cdot re
\end{array}
Initial program 63.1%
Taylor expanded in im around 0 52.7%
associate-*r*52.7%
neg-mul-152.7%
Simplified52.7%
Taylor expanded in re around 0 32.1%
associate-*r*32.1%
neg-mul-132.1%
Simplified32.1%
Final simplification32.1%
(FPCore (re im) :precision binary64 -3.0)
double code(double re, double im) {
return -3.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -3.0d0
end function
public static double code(double re, double im) {
return -3.0;
}
def code(re, im): return -3.0
function code(re, im) return -3.0 end
function tmp = code(re, im) tmp = -3.0; end
code[re_, im_] := -3.0
\begin{array}{l}
\\
-3
\end{array}
Initial program 63.1%
Taylor expanded in im around 0 52.7%
associate-*r*52.7%
neg-mul-152.7%
Simplified52.7%
Applied egg-rr2.9%
Final simplification2.9%
(FPCore (re im) :precision binary64 -9.92290301275212e-8)
double code(double re, double im) {
return -9.92290301275212e-8;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -9.92290301275212d-8
end function
public static double code(double re, double im) {
return -9.92290301275212e-8;
}
def code(re, im): return -9.92290301275212e-8
function code(re, im) return -9.92290301275212e-8 end
function tmp = code(re, im) tmp = -9.92290301275212e-8; end
code[re_, im_] := -9.92290301275212e-8
\begin{array}{l}
\\
-9.92290301275212 \cdot 10^{-8}
\end{array}
Initial program 63.1%
Taylor expanded in im around 0 52.7%
associate-*r*52.7%
neg-mul-152.7%
Simplified52.7%
Applied egg-rr2.9%
Final simplification2.9%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 63.1%
Taylor expanded in im around 0 52.7%
associate-*r*52.7%
neg-mul-152.7%
Simplified52.7%
Applied egg-rr13.5%
Final simplification13.5%
(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 2023275
(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))))