
(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 15 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.01) (not (<= t_0 1e-6)))
(* t_0 (* (sin re) 0.5))
(* (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.01) || !(t_0 <= 1e-6)) {
tmp = t_0 * (sin(re) * 0.5);
} 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.01d0)) .or. (.not. (t_0 <= 1d-6))) then
tmp = t_0 * (sin(re) * 0.5d0)
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.01) || !(t_0 <= 1e-6)) {
tmp = t_0 * (Math.sin(re) * 0.5);
} 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.01) or not (t_0 <= 1e-6): tmp = t_0 * (math.sin(re) * 0.5) 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.01) || !(t_0 <= 1e-6)) tmp = Float64(t_0 * Float64(sin(re) * 0.5)); 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.01) || ~((t_0 <= 1e-6))) tmp = t_0 * (sin(re) * 0.5); 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.01], N[Not[LessEqual[t$95$0, 1e-6]], $MachinePrecision]], N[(t$95$0 * N[(N[Sin[re], $MachinePrecision] * 0.5), $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.01 \lor \neg \left(t_0 \leq 10^{-6}\right):\\
\;\;\;\;t_0 \cdot \left(\sin re \cdot 0.5\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.0100000000000000002 or 9.99999999999999955e-7 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 99.9%
if -0.0100000000000000002 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 9.99999999999999955e-7Initial program 34.9%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (<= t_0 0.005)
(*
(sin re)
(+
(- (* (pow im 3.0) -0.16666666666666666) im)
(* (pow im 5.0) -0.008333333333333333)))
(* t_0 (* (sin re) 0.5)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if (t_0 <= 0.005) {
tmp = sin(re) * (((pow(im, 3.0) * -0.16666666666666666) - im) + (pow(im, 5.0) * -0.008333333333333333));
} else {
tmp = t_0 * (sin(re) * 0.5);
}
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.005d0) then
tmp = sin(re) * ((((im ** 3.0d0) * (-0.16666666666666666d0)) - im) + ((im ** 5.0d0) * (-0.008333333333333333d0)))
else
tmp = t_0 * (sin(re) * 0.5d0)
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.005) {
tmp = Math.sin(re) * (((Math.pow(im, 3.0) * -0.16666666666666666) - im) + (Math.pow(im, 5.0) * -0.008333333333333333));
} else {
tmp = t_0 * (Math.sin(re) * 0.5);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if t_0 <= 0.005: tmp = math.sin(re) * (((math.pow(im, 3.0) * -0.16666666666666666) - im) + (math.pow(im, 5.0) * -0.008333333333333333)) else: tmp = t_0 * (math.sin(re) * 0.5) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if (t_0 <= 0.005) tmp = Float64(sin(re) * Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) + Float64((im ^ 5.0) * -0.008333333333333333))); else tmp = Float64(t_0 * Float64(sin(re) * 0.5)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if (t_0 <= 0.005) tmp = sin(re) * ((((im ^ 3.0) * -0.16666666666666666) - im) + ((im ^ 5.0) * -0.008333333333333333)); else tmp = t_0 * (sin(re) * 0.5); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.005], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq 0.005:\\
\;\;\;\;\sin re \cdot \left(\left({im}^{3} \cdot -0.16666666666666666 - im\right) + {im}^{5} \cdot -0.008333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\sin re \cdot 0.5\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 0.0050000000000000001Initial program 54.4%
Taylor expanded in im around 0 98.0%
+-commutative98.0%
associate-+r+98.0%
+-commutative98.0%
mul-1-neg98.0%
*-commutative98.0%
distribute-lft-neg-in98.0%
*-commutative98.0%
associate-*r*98.0%
distribute-rgt-out98.0%
associate-*r*98.0%
*-commutative98.0%
associate-*l*98.0%
distribute-lft-out98.0%
Simplified98.0%
if 0.0050000000000000001 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
Final simplification98.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (- (exp (- im)) (exp im)) re)))
(t_1 (* (sin re) (* (pow im 5.0) -0.008333333333333333))))
(if (<= im -1.2e+103)
t_1
(if (<= im -0.00062)
t_0
(if (<= im 0.0058) (* (- im) (sin re)) (if (<= im 4.5e+61) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * ((exp(-im) - exp(im)) * re);
double t_1 = sin(re) * (pow(im, 5.0) * -0.008333333333333333);
double tmp;
if (im <= -1.2e+103) {
tmp = t_1;
} else if (im <= -0.00062) {
tmp = t_0;
} else if (im <= 0.0058) {
tmp = -im * sin(re);
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * ((exp(-im) - exp(im)) * re)
t_1 = sin(re) * ((im ** 5.0d0) * (-0.008333333333333333d0))
if (im <= (-1.2d+103)) then
tmp = t_1
else if (im <= (-0.00062d0)) then
tmp = t_0
else if (im <= 0.0058d0) then
tmp = -im * sin(re)
else if (im <= 4.5d+61) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * ((Math.exp(-im) - Math.exp(im)) * re);
double t_1 = Math.sin(re) * (Math.pow(im, 5.0) * -0.008333333333333333);
double tmp;
if (im <= -1.2e+103) {
tmp = t_1;
} else if (im <= -0.00062) {
tmp = t_0;
} else if (im <= 0.0058) {
tmp = -im * Math.sin(re);
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * ((math.exp(-im) - math.exp(im)) * re) t_1 = math.sin(re) * (math.pow(im, 5.0) * -0.008333333333333333) tmp = 0 if im <= -1.2e+103: tmp = t_1 elif im <= -0.00062: tmp = t_0 elif im <= 0.0058: tmp = -im * math.sin(re) elif im <= 4.5e+61: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(Float64(exp(Float64(-im)) - exp(im)) * re)) t_1 = Float64(sin(re) * Float64((im ^ 5.0) * -0.008333333333333333)) tmp = 0.0 if (im <= -1.2e+103) tmp = t_1; elseif (im <= -0.00062) tmp = t_0; elseif (im <= 0.0058) tmp = Float64(Float64(-im) * sin(re)); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * ((exp(-im) - exp(im)) * re); t_1 = sin(re) * ((im ^ 5.0) * -0.008333333333333333); tmp = 0.0; if (im <= -1.2e+103) tmp = t_1; elseif (im <= -0.00062) tmp = t_0; elseif (im <= 0.0058) tmp = -im * sin(re); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[re], $MachinePrecision] * N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.2e+103], t$95$1, If[LessEqual[im, -0.00062], t$95$0, If[LessEqual[im, 0.0058], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.5e+61], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\
t_1 := \sin re \cdot \left({im}^{5} \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -1.2 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00062:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0058:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.1999999999999999e103 or 4.5e61 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -1.1999999999999999e103 < im < -6.2e-4 or 0.0058 < im < 4.5e61Initial program 99.4%
Taylor expanded in re around 0 88.9%
if -6.2e-4 < im < 0.0058Initial program 34.9%
Taylor expanded in im around 0 99.5%
mul-1-neg99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Simplified99.5%
Final simplification98.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (- (exp (- im)) (exp im)) re)))
(t_1 (* (sin re) (* (pow im 5.0) -0.008333333333333333))))
(if (<= im -1.2e+103)
t_1
(if (<= im -0.00135)
t_0
(if (<= im 0.008)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 4.5e+61) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * ((exp(-im) - exp(im)) * re);
double t_1 = sin(re) * (pow(im, 5.0) * -0.008333333333333333);
double tmp;
if (im <= -1.2e+103) {
tmp = t_1;
} else if (im <= -0.00135) {
tmp = t_0;
} else if (im <= 0.008) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * ((exp(-im) - exp(im)) * re)
t_1 = sin(re) * ((im ** 5.0d0) * (-0.008333333333333333d0))
if (im <= (-1.2d+103)) then
tmp = t_1
else if (im <= (-0.00135d0)) then
tmp = t_0
else if (im <= 0.008d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 4.5d+61) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * ((Math.exp(-im) - Math.exp(im)) * re);
double t_1 = Math.sin(re) * (Math.pow(im, 5.0) * -0.008333333333333333);
double tmp;
if (im <= -1.2e+103) {
tmp = t_1;
} else if (im <= -0.00135) {
tmp = t_0;
} else if (im <= 0.008) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * ((math.exp(-im) - math.exp(im)) * re) t_1 = math.sin(re) * (math.pow(im, 5.0) * -0.008333333333333333) tmp = 0 if im <= -1.2e+103: tmp = t_1 elif im <= -0.00135: tmp = t_0 elif im <= 0.008: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 4.5e+61: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(Float64(exp(Float64(-im)) - exp(im)) * re)) t_1 = Float64(sin(re) * Float64((im ^ 5.0) * -0.008333333333333333)) tmp = 0.0 if (im <= -1.2e+103) tmp = t_1; elseif (im <= -0.00135) tmp = t_0; elseif (im <= 0.008) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * ((exp(-im) - exp(im)) * re); t_1 = sin(re) * ((im ^ 5.0) * -0.008333333333333333); tmp = 0.0; if (im <= -1.2e+103) tmp = t_1; elseif (im <= -0.00135) tmp = t_0; elseif (im <= 0.008) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[re], $MachinePrecision] * N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.2e+103], t$95$1, If[LessEqual[im, -0.00135], t$95$0, If[LessEqual[im, 0.008], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.5e+61], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\
t_1 := \sin re \cdot \left({im}^{5} \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -1.2 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00135:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.008:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.1999999999999999e103 or 4.5e61 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -1.1999999999999999e103 < im < -0.0013500000000000001 or 0.0080000000000000002 < im < 4.5e61Initial program 99.4%
Taylor expanded in re around 0 88.9%
if -0.0013500000000000001 < im < 0.0080000000000000002Initial program 34.9%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.1%
(FPCore (re im) :precision binary64 (if (or (<= im -3.3) (not (<= im 3.3))) (* (sin re) (* (pow im 5.0) -0.008333333333333333)) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -3.3) || !(im <= 3.3)) {
tmp = sin(re) * (pow(im, 5.0) * -0.008333333333333333);
} 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 = sin(re) * ((im ** 5.0d0) * (-0.008333333333333333d0))
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 = Math.sin(re) * (Math.pow(im, 5.0) * -0.008333333333333333);
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.3) or not (im <= 3.3): tmp = math.sin(re) * (math.pow(im, 5.0) * -0.008333333333333333) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.3) || !(im <= 3.3)) tmp = Float64(sin(re) * Float64((im ^ 5.0) * -0.008333333333333333)); 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 = sin(re) * ((im ^ 5.0) * -0.008333333333333333); 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[(N[Sin[re], $MachinePrecision] * N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $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):\\
\;\;\;\;\sin re \cdot \left({im}^{5} \cdot -0.008333333333333333\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%
Taylor expanded in im around 0 88.2%
+-commutative88.2%
associate-+r+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%
associate-*r*88.2%
*-commutative88.2%
associate-*l*88.2%
distribute-lft-out88.2%
Simplified88.2%
Taylor expanded in im around inf 88.2%
*-commutative88.2%
associate-*l*88.2%
Simplified88.2%
if -3.2999999999999998 < im < 3.2999999999999998Initial program 35.7%
Taylor expanded in im around 0 98.8%
mul-1-neg98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
Final simplification94.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.008333333333333333 (* re (pow im 5.0)))))
(if (<= im -3.1e+27)
t_0
(if (<= im 5200.0)
(* (- im) (sin re))
(if (or (<= im 1e+226) (not (<= im 1.6e+258)))
t_0
(* im (- (* 0.16666666666666666 (pow re 3.0)) re)))))))
double code(double re, double im) {
double t_0 = -0.008333333333333333 * (re * pow(im, 5.0));
double tmp;
if (im <= -3.1e+27) {
tmp = t_0;
} else if (im <= 5200.0) {
tmp = -im * sin(re);
} else if ((im <= 1e+226) || !(im <= 1.6e+258)) {
tmp = t_0;
} else {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.008333333333333333d0) * (re * (im ** 5.0d0))
if (im <= (-3.1d+27)) then
tmp = t_0
else if (im <= 5200.0d0) then
tmp = -im * sin(re)
else if ((im <= 1d+226) .or. (.not. (im <= 1.6d+258))) then
tmp = t_0
else
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.008333333333333333 * (re * Math.pow(im, 5.0));
double tmp;
if (im <= -3.1e+27) {
tmp = t_0;
} else if (im <= 5200.0) {
tmp = -im * Math.sin(re);
} else if ((im <= 1e+226) || !(im <= 1.6e+258)) {
tmp = t_0;
} else {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
}
return tmp;
}
def code(re, im): t_0 = -0.008333333333333333 * (re * math.pow(im, 5.0)) tmp = 0 if im <= -3.1e+27: tmp = t_0 elif im <= 5200.0: tmp = -im * math.sin(re) elif (im <= 1e+226) or not (im <= 1.6e+258): tmp = t_0 else: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) return tmp
function code(re, im) t_0 = Float64(-0.008333333333333333 * Float64(re * (im ^ 5.0))) tmp = 0.0 if (im <= -3.1e+27) tmp = t_0; elseif (im <= 5200.0) tmp = Float64(Float64(-im) * sin(re)); elseif ((im <= 1e+226) || !(im <= 1.6e+258)) tmp = t_0; else tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.008333333333333333 * (re * (im ^ 5.0)); tmp = 0.0; if (im <= -3.1e+27) tmp = t_0; elseif (im <= 5200.0) tmp = -im * sin(re); elseif ((im <= 1e+226) || ~((im <= 1.6e+258))) tmp = t_0; else tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.1e+27], t$95$0, If[LessEqual[im, 5200.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 1e+226], N[Not[LessEqual[im, 1.6e+258]], $MachinePrecision]], t$95$0, N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -3.1 \cdot 10^{+27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 5200:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{elif}\;im \leq 10^{+226} \lor \neg \left(im \leq 1.6 \cdot 10^{+258}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\end{array}
\end{array}
if im < -3.09999999999999996e27 or 5200 < im < 9.99999999999999961e225 or 1.60000000000000005e258 < im Initial program 100.0%
Taylor expanded in im around 0 89.7%
+-commutative89.7%
associate-+r+89.7%
+-commutative89.7%
mul-1-neg89.7%
*-commutative89.7%
distribute-lft-neg-in89.7%
*-commutative89.7%
associate-*r*89.7%
distribute-rgt-out89.7%
associate-*r*89.7%
*-commutative89.7%
associate-*l*89.7%
distribute-lft-out89.7%
Simplified89.7%
Taylor expanded in im around inf 89.7%
*-commutative89.7%
associate-*l*89.7%
Simplified89.7%
Taylor expanded in re around 0 69.0%
if -3.09999999999999996e27 < im < 5200Initial program 37.1%
Taylor expanded in im around 0 96.8%
mul-1-neg96.8%
*-commutative96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
if 9.99999999999999961e225 < im < 1.60000000000000005e258Initial program 100.0%
Taylor expanded in im around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
distribute-rgt-neg-in6.4%
Simplified6.4%
Taylor expanded in re around 0 0.5%
+-commutative0.5%
mul-1-neg0.5%
unsub-neg0.5%
associate-*r*0.5%
distribute-rgt-out--89.4%
Simplified89.4%
Final simplification85.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.008333333333333333 (* re (pow im 5.0)))))
(if (<= im -1.22e+28)
t_0
(if (<= im 5600.0)
(* (- im) (sin re))
(if (<= im 1e+226)
t_0
(if (<= im 1.85e+258)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(* re (- (* (pow im 3.0) -0.16666666666666666) im))))))))
double code(double re, double im) {
double t_0 = -0.008333333333333333 * (re * pow(im, 5.0));
double tmp;
if (im <= -1.22e+28) {
tmp = t_0;
} else if (im <= 5600.0) {
tmp = -im * sin(re);
} else if (im <= 1e+226) {
tmp = t_0;
} else if (im <= 1.85e+258) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - 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) :: t_0
real(8) :: tmp
t_0 = (-0.008333333333333333d0) * (re * (im ** 5.0d0))
if (im <= (-1.22d+28)) then
tmp = t_0
else if (im <= 5600.0d0) then
tmp = -im * sin(re)
else if (im <= 1d+226) then
tmp = t_0
else if (im <= 1.85d+258) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - 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 t_0 = -0.008333333333333333 * (re * Math.pow(im, 5.0));
double tmp;
if (im <= -1.22e+28) {
tmp = t_0;
} else if (im <= 5600.0) {
tmp = -im * Math.sin(re);
} else if (im <= 1e+226) {
tmp = t_0;
} else if (im <= 1.85e+258) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else {
tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): t_0 = -0.008333333333333333 * (re * math.pow(im, 5.0)) tmp = 0 if im <= -1.22e+28: tmp = t_0 elif im <= 5600.0: tmp = -im * math.sin(re) elif im <= 1e+226: tmp = t_0 elif im <= 1.85e+258: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) else: tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) t_0 = Float64(-0.008333333333333333 * Float64(re * (im ^ 5.0))) tmp = 0.0 if (im <= -1.22e+28) tmp = t_0; elseif (im <= 5600.0) tmp = Float64(Float64(-im) * sin(re)); elseif (im <= 1e+226) tmp = t_0; elseif (im <= 1.85e+258) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); else tmp = Float64(re * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.008333333333333333 * (re * (im ^ 5.0)); tmp = 0.0; if (im <= -1.22e+28) tmp = t_0; elseif (im <= 5600.0) tmp = -im * sin(re); elseif (im <= 1e+226) tmp = t_0; elseif (im <= 1.85e+258) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); else tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.22e+28], t$95$0, If[LessEqual[im, 5600.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e+226], t$95$0, If[LessEqual[im, 1.85e+258], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - 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}
t_0 := -0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -1.22 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 5600:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{elif}\;im \leq 10^{+226}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1.85 \cdot 10^{+258}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if im < -1.2199999999999999e28 or 5600 < im < 9.99999999999999961e225Initial program 100.0%
Taylor expanded in im around 0 87.9%
+-commutative87.9%
associate-+r+87.9%
+-commutative87.9%
mul-1-neg87.9%
*-commutative87.9%
distribute-lft-neg-in87.9%
*-commutative87.9%
associate-*r*87.9%
distribute-rgt-out87.9%
associate-*r*87.9%
*-commutative87.9%
associate-*l*87.9%
distribute-lft-out87.9%
Simplified87.9%
Taylor expanded in im around inf 87.9%
*-commutative87.9%
associate-*l*87.9%
Simplified87.9%
Taylor expanded in re around 0 69.4%
if -1.2199999999999999e28 < im < 5600Initial program 37.1%
Taylor expanded in im around 0 96.8%
mul-1-neg96.8%
*-commutative96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
if 9.99999999999999961e225 < im < 1.8499999999999999e258Initial program 100.0%
Taylor expanded in im around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
distribute-rgt-neg-in6.4%
Simplified6.4%
Taylor expanded in re around 0 0.5%
+-commutative0.5%
mul-1-neg0.5%
unsub-neg0.5%
associate-*r*0.5%
distribute-rgt-out--89.4%
Simplified89.4%
if 1.8499999999999999e258 < im Initial program 100.0%
Taylor expanded in re around 0 66.7%
Taylor expanded in im around 0 66.7%
+-commutative66.7%
mul-1-neg66.7%
unsub-neg66.7%
*-commutative66.7%
associate-*l*66.7%
*-commutative66.7%
distribute-lft-out--66.7%
*-commutative66.7%
Simplified66.7%
Final simplification85.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.008333333333333333 (* re (pow im 5.0)))))
(if (<= im -2.8e+27)
t_0
(if (<= im 3850.0)
(* (- im) (sin re))
(if (or (<= im 1e+226) (not (<= im 1.6e+258)))
t_0
(* 0.16666666666666666 (* im (pow re 3.0))))))))
double code(double re, double im) {
double t_0 = -0.008333333333333333 * (re * pow(im, 5.0));
double tmp;
if (im <= -2.8e+27) {
tmp = t_0;
} else if (im <= 3850.0) {
tmp = -im * sin(re);
} else if ((im <= 1e+226) || !(im <= 1.6e+258)) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (im * pow(re, 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.008333333333333333d0) * (re * (im ** 5.0d0))
if (im <= (-2.8d+27)) then
tmp = t_0
else if (im <= 3850.0d0) then
tmp = -im * sin(re)
else if ((im <= 1d+226) .or. (.not. (im <= 1.6d+258))) then
tmp = t_0
else
tmp = 0.16666666666666666d0 * (im * (re ** 3.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.008333333333333333 * (re * Math.pow(im, 5.0));
double tmp;
if (im <= -2.8e+27) {
tmp = t_0;
} else if (im <= 3850.0) {
tmp = -im * Math.sin(re);
} else if ((im <= 1e+226) || !(im <= 1.6e+258)) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (im * Math.pow(re, 3.0));
}
return tmp;
}
def code(re, im): t_0 = -0.008333333333333333 * (re * math.pow(im, 5.0)) tmp = 0 if im <= -2.8e+27: tmp = t_0 elif im <= 3850.0: tmp = -im * math.sin(re) elif (im <= 1e+226) or not (im <= 1.6e+258): tmp = t_0 else: tmp = 0.16666666666666666 * (im * math.pow(re, 3.0)) return tmp
function code(re, im) t_0 = Float64(-0.008333333333333333 * Float64(re * (im ^ 5.0))) tmp = 0.0 if (im <= -2.8e+27) tmp = t_0; elseif (im <= 3850.0) tmp = Float64(Float64(-im) * sin(re)); elseif ((im <= 1e+226) || !(im <= 1.6e+258)) tmp = t_0; else tmp = Float64(0.16666666666666666 * Float64(im * (re ^ 3.0))); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.008333333333333333 * (re * (im ^ 5.0)); tmp = 0.0; if (im <= -2.8e+27) tmp = t_0; elseif (im <= 3850.0) tmp = -im * sin(re); elseif ((im <= 1e+226) || ~((im <= 1.6e+258))) tmp = t_0; else tmp = 0.16666666666666666 * (im * (re ^ 3.0)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[(re * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.8e+27], t$95$0, If[LessEqual[im, 3850.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 1e+226], N[Not[LessEqual[im, 1.6e+258]], $MachinePrecision]], t$95$0, N[(0.16666666666666666 * N[(im * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -2.8 \cdot 10^{+27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 3850:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{elif}\;im \leq 10^{+226} \lor \neg \left(im \leq 1.6 \cdot 10^{+258}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\
\end{array}
\end{array}
if im < -2.7999999999999999e27 or 3850 < im < 9.99999999999999961e225 or 1.60000000000000005e258 < im Initial program 100.0%
Taylor expanded in im around 0 89.7%
+-commutative89.7%
associate-+r+89.7%
+-commutative89.7%
mul-1-neg89.7%
*-commutative89.7%
distribute-lft-neg-in89.7%
*-commutative89.7%
associate-*r*89.7%
distribute-rgt-out89.7%
associate-*r*89.7%
*-commutative89.7%
associate-*l*89.7%
distribute-lft-out89.7%
Simplified89.7%
Taylor expanded in im around inf 89.7%
*-commutative89.7%
associate-*l*89.7%
Simplified89.7%
Taylor expanded in re around 0 69.0%
if -2.7999999999999999e27 < im < 3850Initial program 37.1%
Taylor expanded in im around 0 96.8%
mul-1-neg96.8%
*-commutative96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
if 9.99999999999999961e225 < im < 1.60000000000000005e258Initial program 100.0%
Taylor expanded in im around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
distribute-rgt-neg-in6.4%
Simplified6.4%
Taylor expanded in re around 0 0.5%
+-commutative0.5%
mul-1-neg0.5%
unsub-neg0.5%
associate-*r*0.5%
distribute-rgt-out--89.4%
Simplified89.4%
Taylor expanded in re around inf 89.0%
Final simplification85.5%
(FPCore (re im) :precision binary64 (if (or (<= im -2.8e+27) (not (<= im 980.0))) (* -0.008333333333333333 (* re (pow im 5.0))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -2.8e+27) || !(im <= 980.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 <= (-2.8d+27)) .or. (.not. (im <= 980.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 <= -2.8e+27) || !(im <= 980.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 <= -2.8e+27) or not (im <= 980.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 <= -2.8e+27) || !(im <= 980.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 <= -2.8e+27) || ~((im <= 980.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, -2.8e+27], N[Not[LessEqual[im, 980.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 -2.8 \cdot 10^{+27} \lor \neg \left(im \leq 980\right):\\
\;\;\;\;-0.008333333333333333 \cdot \left(re \cdot {im}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -2.7999999999999999e27 or 980 < im Initial program 100.0%
Taylor expanded in im around 0 90.5%
+-commutative90.5%
associate-+r+90.5%
+-commutative90.5%
mul-1-neg90.5%
*-commutative90.5%
distribute-lft-neg-in90.5%
*-commutative90.5%
associate-*r*90.5%
distribute-rgt-out90.5%
associate-*r*90.5%
*-commutative90.5%
associate-*l*90.5%
distribute-lft-out90.5%
Simplified90.5%
Taylor expanded in im around inf 90.5%
*-commutative90.5%
associate-*l*90.5%
Simplified90.5%
Taylor expanded in re around 0 64.3%
if -2.7999999999999999e27 < im < 980Initial program 37.1%
Taylor expanded in im around 0 96.8%
mul-1-neg96.8%
*-commutative96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
Final simplification82.7%
(FPCore (re im) :precision binary64 (if (or (<= im -9.2e+42) (not (<= im 9.8e+176))) (* im (- re)) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -9.2e+42) || !(im <= 9.8e+176)) {
tmp = im * -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 <= (-9.2d+42)) .or. (.not. (im <= 9.8d+176))) then
tmp = im * -re
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -9.2e+42) || !(im <= 9.8e+176)) {
tmp = im * -re;
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -9.2e+42) or not (im <= 9.8e+176): tmp = im * -re else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -9.2e+42) || !(im <= 9.8e+176)) tmp = Float64(im * Float64(-re)); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -9.2e+42) || ~((im <= 9.8e+176))) tmp = im * -re; else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -9.2e+42], N[Not[LessEqual[im, 9.8e+176]], $MachinePrecision]], N[(im * (-re)), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -9.2 \cdot 10^{+42} \lor \neg \left(im \leq 9.8 \cdot 10^{+176}\right):\\
\;\;\;\;im \cdot \left(-re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -9.2e42 or 9.8e176 < im Initial program 100.0%
Taylor expanded in re around 0 70.5%
Taylor expanded in im around 0 30.2%
mul-1-neg30.2%
distribute-rgt-neg-in30.2%
Simplified30.2%
if -9.2e42 < im < 9.8e176Initial program 45.7%
Taylor expanded in im around 0 84.0%
mul-1-neg84.0%
*-commutative84.0%
distribute-rgt-neg-in84.0%
Simplified84.0%
Final simplification65.5%
(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 64.4%
Taylor expanded in re around 0 51.1%
Taylor expanded in im around 0 39.4%
mul-1-neg39.4%
distribute-rgt-neg-in39.4%
Simplified39.4%
Final simplification39.4%
(FPCore (re im) :precision binary64 -1.5)
double code(double re, double im) {
return -1.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -1.5d0
end function
public static double code(double re, double im) {
return -1.5;
}
def code(re, im): return -1.5
function code(re, im) return -1.5 end
function tmp = code(re, im) tmp = -1.5; end
code[re_, im_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 64.4%
Taylor expanded in re around 0 51.1%
Applied egg-rr2.7%
Final simplification2.7%
(FPCore (re im) :precision binary64 -2.8935185185185185e-7)
double code(double re, double im) {
return -2.8935185185185185e-7;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -2.8935185185185185d-7
end function
public static double code(double re, double im) {
return -2.8935185185185185e-7;
}
def code(re, im): return -2.8935185185185185e-7
function code(re, im) return -2.8935185185185185e-7 end
function tmp = code(re, im) tmp = -2.8935185185185185e-7; end
code[re_, im_] := -2.8935185185185185e-7
\begin{array}{l}
\\
-2.8935185185185185 \cdot 10^{-7}
\end{array}
Initial program 64.4%
Taylor expanded in re around 0 51.1%
Applied egg-rr2.8%
Final simplification2.8%
(FPCore (re im) :precision binary64 -9.690334973390744e-20)
double code(double re, double im) {
return -9.690334973390744e-20;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -9.690334973390744d-20
end function
public static double code(double re, double im) {
return -9.690334973390744e-20;
}
def code(re, im): return -9.690334973390744e-20
function code(re, im) return -9.690334973390744e-20 end
function tmp = code(re, im) tmp = -9.690334973390744e-20; end
code[re_, im_] := -9.690334973390744e-20
\begin{array}{l}
\\
-9.690334973390744 \cdot 10^{-20}
\end{array}
Initial program 64.4%
Taylor expanded in re around 0 51.1%
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 64.4%
Taylor expanded in re around 0 51.1%
Applied egg-rr18.8%
Final simplification18.8%
(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 2023238
(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))))