
(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 12 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 -1.0) (not (<= t_0 0.05)))
(* t_0 (* 0.5 (sin re)))
(*
(sin re)
(+
(- (* (pow im 5.0) -0.008333333333333333) im)
(+
(* (pow im 3.0) -0.16666666666666666)
(* (pow im 7.0) -0.0001984126984126984)))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -1.0) || !(t_0 <= 0.05)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * (((pow(im, 5.0) * -0.008333333333333333) - im) + ((pow(im, 3.0) * -0.16666666666666666) + (pow(im, 7.0) * -0.0001984126984126984)));
}
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 <= (-1.0d0)) .or. (.not. (t_0 <= 0.05d0))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = sin(re) * ((((im ** 5.0d0) * (-0.008333333333333333d0)) - im) + (((im ** 3.0d0) * (-0.16666666666666666d0)) + ((im ** 7.0d0) * (-0.0001984126984126984d0))))
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 <= -1.0) || !(t_0 <= 0.05)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) - im) + ((Math.pow(im, 3.0) * -0.16666666666666666) + (Math.pow(im, 7.0) * -0.0001984126984126984)));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -1.0) or not (t_0 <= 0.05): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(re) * (((math.pow(im, 5.0) * -0.008333333333333333) - im) + ((math.pow(im, 3.0) * -0.16666666666666666) + (math.pow(im, 7.0) * -0.0001984126984126984))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -1.0) || !(t_0 <= 0.05)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im) + Float64(Float64((im ^ 3.0) * -0.16666666666666666) + Float64((im ^ 7.0) * -0.0001984126984126984)))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -1.0) || ~((t_0 <= 0.05))) tmp = t_0 * (0.5 * sin(re)); else tmp = sin(re) * ((((im ^ 5.0) * -0.008333333333333333) - im) + (((im ^ 3.0) * -0.16666666666666666) + ((im ^ 7.0) * -0.0001984126984126984))); 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, -1.0], N[Not[LessEqual[t$95$0, 0.05]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision] + N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -1 \lor \neg \left(t_0 \leq 0.05\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{3} \cdot -0.16666666666666666 + {im}^{7} \cdot -0.0001984126984126984\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -1 or 0.050000000000000003 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -1 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 0.050000000000000003Initial program 31.6%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
+-commutative99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -1.0) (not (<= t_0 0.05)))
(* t_0 (* 0.5 (sin re)))
(*
(sin re)
(+
(- (* (pow im 5.0) -0.008333333333333333) im)
(* (pow im 3.0) -0.16666666666666666))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -1.0) || !(t_0 <= 0.05)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * (((pow(im, 5.0) * -0.008333333333333333) - im) + (pow(im, 3.0) * -0.16666666666666666));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-im) - exp(im)
if ((t_0 <= (-1.0d0)) .or. (.not. (t_0 <= 0.05d0))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = sin(re) * ((((im ** 5.0d0) * (-0.008333333333333333d0)) - im) + ((im ** 3.0d0) * (-0.16666666666666666d0)))
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 <= -1.0) || !(t_0 <= 0.05)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) - im) + (Math.pow(im, 3.0) * -0.16666666666666666));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -1.0) or not (t_0 <= 0.05): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(re) * (((math.pow(im, 5.0) * -0.008333333333333333) - im) + (math.pow(im, 3.0) * -0.16666666666666666)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -1.0) || !(t_0 <= 0.05)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im) + Float64((im ^ 3.0) * -0.16666666666666666))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -1.0) || ~((t_0 <= 0.05))) tmp = t_0 * (0.5 * sin(re)); else tmp = sin(re) * ((((im ^ 5.0) * -0.008333333333333333) - im) + ((im ^ 3.0) * -0.16666666666666666)); 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, -1.0], N[Not[LessEqual[t$95$0, 0.05]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -1 \lor \neg \left(t_0 \leq 0.05\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + {im}^{3} \cdot -0.16666666666666666\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -1 or 0.050000000000000003 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -1 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 0.050000000000000003Initial program 31.6%
Taylor expanded in im around 0 99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
+-commutative99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
*-commutative99.7%
associate-*l*99.7%
distribute-lft-out99.7%
distribute-lft-out99.8%
*-commutative99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -1.0) (not (<= t_0 0.0005)))
(* 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 <= -1.0) || !(t_0 <= 0.0005)) {
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 <= (-1.0d0)) .or. (.not. (t_0 <= 0.0005d0))) 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 <= -1.0) || !(t_0 <= 0.0005)) {
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 <= -1.0) or not (t_0 <= 0.0005): 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 <= -1.0) || !(t_0 <= 0.0005)) 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 <= -1.0) || ~((t_0 <= 0.0005))) 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, -1.0], N[Not[LessEqual[t$95$0, 0.0005]], $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 -1 \lor \neg \left(t_0 \leq 0.0005\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)) < -1 or 5.0000000000000001e-4 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 99.9%
if -1 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 5.0000000000000001e-4Initial program 31.1%
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)) (* 0.5 re)))
(t_1 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
(if (<= im -4.4e+123)
t_1
(if (<= im -0.6)
t_0
(if (<= im 0.66)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 * re);
double t_1 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
double tmp;
if (im <= -4.4e+123) {
tmp = t_1;
} else if (im <= -0.6) {
tmp = t_0;
} else if (im <= 0.66) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
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.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
if (im <= (-4.4d+123)) then
tmp = t_1
else if (im <= (-0.6d0)) then
tmp = t_0
else if (im <= 0.66d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) 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.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -4.4e+123) {
tmp = t_1;
} else if (im <= -0.6) {
tmp = t_0;
} else if (im <= 0.66) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
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.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) tmp = 0 if im <= -4.4e+123: tmp = t_1 elif im <= -0.6: tmp = t_0 elif im <= 0.66: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: 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.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -4.4e+123) tmp = t_1; elseif (im <= -0.6) tmp = t_0; elseif (im <= 0.66) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) 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.0001984126984126984 * (sin(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -4.4e+123) tmp = t_1; elseif (im <= -0.6) tmp = t_0; elseif (im <= 0.66) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) 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.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.4e+123], t$95$1, If[LessEqual[im, -0.6], t$95$0, If[LessEqual[im, 0.66], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], 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.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -4.4 \cdot 10^{+123}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.6:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.66:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.39999999999999984e123 or 1.09999999999999998e44 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
+-commutative100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
+-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -4.39999999999999984e123 < im < -0.599999999999999978 or 0.660000000000000031 < im < 1.09999999999999998e44Initial program 99.9%
Taylor expanded in re around 0 85.1%
if -0.599999999999999978 < im < 0.660000000000000031Initial program 32.1%
Taylor expanded in im around 0 99.0%
mul-1-neg99.0%
unsub-neg99.0%
*-commutative99.0%
associate-*l*99.0%
distribute-lft-out--99.0%
Simplified99.0%
Final simplification97.9%
(FPCore (re im) :precision binary64 (if (or (<= im -5.5) (not (<= im 5.5))) (* -0.0001984126984126984 (* (sin re) (pow im 7.0))) (* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))))
double code(double re, double im) {
double tmp;
if ((im <= -5.5) || !(im <= 5.5)) {
tmp = -0.0001984126984126984 * (sin(re) * pow(im, 7.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.5d0)) .or. (.not. (im <= 5.5d0))) then
tmp = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.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.5) || !(im <= 5.5)) {
tmp = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.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.5) or not (im <= 5.5): tmp = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.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.5) || !(im <= 5.5)) tmp = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.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.5) || ~((im <= 5.5))) tmp = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); else tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -5.5], N[Not[LessEqual[im, 5.5]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $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 \lor \neg \left(im \leq 5.5\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if im < -5.5 or 5.5 < im Initial program 100.0%
Taylor expanded in im around 0 87.5%
associate-+r+87.5%
+-commutative87.5%
+-commutative87.5%
mul-1-neg87.5%
distribute-rgt-neg-in87.5%
*-commutative87.5%
associate-*l*87.5%
distribute-lft-out87.5%
+-commutative87.5%
*-commutative87.5%
associate-*r*87.5%
*-commutative87.5%
associate-*r*87.5%
distribute-rgt-out87.5%
Simplified87.5%
Taylor expanded in im around inf 87.5%
*-commutative87.5%
Simplified87.5%
if -5.5 < im < 5.5Initial program 32.1%
Taylor expanded in im around 0 99.0%
mul-1-neg99.0%
unsub-neg99.0%
*-commutative99.0%
associate-*l*99.0%
distribute-lft-out--99.0%
Simplified99.0%
Final simplification93.2%
(FPCore (re im) :precision binary64 (if (or (<= im -4.0) (not (<= im 4.2))) (* -0.0001984126984126984 (* (sin re) (pow im 7.0))) (* im (- (sin re)))))
double code(double re, double im) {
double tmp;
if ((im <= -4.0) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (sin(re) * pow(im, 7.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 <= (-4.0d0)) .or. (.not. (im <= 4.2d0))) then
tmp = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
else
tmp = im * -sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -4.0) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -4.0) or not (im <= 4.2): tmp = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -4.0) || !(im <= 4.2)) tmp = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -4.0) || ~((im <= 4.2))) tmp = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -4.0], N[Not[LessEqual[im, 4.2]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -4 \lor \neg \left(im \leq 4.2\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -4 or 4.20000000000000018 < im Initial program 100.0%
Taylor expanded in im around 0 87.5%
associate-+r+87.5%
+-commutative87.5%
+-commutative87.5%
mul-1-neg87.5%
distribute-rgt-neg-in87.5%
*-commutative87.5%
associate-*l*87.5%
distribute-lft-out87.5%
+-commutative87.5%
*-commutative87.5%
associate-*r*87.5%
*-commutative87.5%
associate-*r*87.5%
distribute-rgt-out87.5%
Simplified87.5%
Taylor expanded in im around inf 87.5%
*-commutative87.5%
Simplified87.5%
if -4 < im < 4.20000000000000018Initial program 32.1%
Taylor expanded in im around 0 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-lft-neg-in98.2%
Simplified98.2%
Final simplification92.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* (pow im 7.0) -0.0001984126984126984))))
(if (<= im -60000.0)
t_0
(if (<= im 7.6e+32)
(* im (- (sin re)))
(if (or (<= im 1e+208) (not (<= im 4.2e+275)))
t_0
(* im (- (* (pow re 3.0) 0.16666666666666666) re)))))))
double code(double re, double im) {
double t_0 = re * (pow(im, 7.0) * -0.0001984126984126984);
double tmp;
if (im <= -60000.0) {
tmp = t_0;
} else if (im <= 7.6e+32) {
tmp = im * -sin(re);
} else if ((im <= 1e+208) || !(im <= 4.2e+275)) {
tmp = t_0;
} else {
tmp = im * ((pow(re, 3.0) * 0.16666666666666666) - 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 = re * ((im ** 7.0d0) * (-0.0001984126984126984d0))
if (im <= (-60000.0d0)) then
tmp = t_0
else if (im <= 7.6d+32) then
tmp = im * -sin(re)
else if ((im <= 1d+208) .or. (.not. (im <= 4.2d+275))) then
tmp = t_0
else
tmp = im * (((re ** 3.0d0) * 0.16666666666666666d0) - re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (Math.pow(im, 7.0) * -0.0001984126984126984);
double tmp;
if (im <= -60000.0) {
tmp = t_0;
} else if (im <= 7.6e+32) {
tmp = im * -Math.sin(re);
} else if ((im <= 1e+208) || !(im <= 4.2e+275)) {
tmp = t_0;
} else {
tmp = im * ((Math.pow(re, 3.0) * 0.16666666666666666) - re);
}
return tmp;
}
def code(re, im): t_0 = re * (math.pow(im, 7.0) * -0.0001984126984126984) tmp = 0 if im <= -60000.0: tmp = t_0 elif im <= 7.6e+32: tmp = im * -math.sin(re) elif (im <= 1e+208) or not (im <= 4.2e+275): tmp = t_0 else: tmp = im * ((math.pow(re, 3.0) * 0.16666666666666666) - re) return tmp
function code(re, im) t_0 = Float64(re * Float64((im ^ 7.0) * -0.0001984126984126984)) tmp = 0.0 if (im <= -60000.0) tmp = t_0; elseif (im <= 7.6e+32) tmp = Float64(im * Float64(-sin(re))); elseif ((im <= 1e+208) || !(im <= 4.2e+275)) tmp = t_0; else tmp = Float64(im * Float64(Float64((re ^ 3.0) * 0.16666666666666666) - re)); end return tmp end
function tmp_2 = code(re, im) t_0 = re * ((im ^ 7.0) * -0.0001984126984126984); tmp = 0.0; if (im <= -60000.0) tmp = t_0; elseif (im <= 7.6e+32) tmp = im * -sin(re); elseif ((im <= 1e+208) || ~((im <= 4.2e+275))) tmp = t_0; else tmp = im * (((re ^ 3.0) * 0.16666666666666666) - re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -60000.0], t$95$0, If[LessEqual[im, 7.6e+32], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[Or[LessEqual[im, 1e+208], N[Not[LessEqual[im, 4.2e+275]], $MachinePrecision]], t$95$0, N[(im * N[(N[(N[Power[re, 3.0], $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left({im}^{7} \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -60000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 7.6 \cdot 10^{+32}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 10^{+208} \lor \neg \left(im \leq 4.2 \cdot 10^{+275}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left({re}^{3} \cdot 0.16666666666666666 - re\right)\\
\end{array}
\end{array}
if im < -6e4 or 7.6000000000000006e32 < im < 9.9999999999999998e207 or 4.2000000000000002e275 < im Initial program 100.0%
Taylor expanded in im around 0 90.9%
associate-+r+90.9%
+-commutative90.9%
+-commutative90.9%
mul-1-neg90.9%
distribute-rgt-neg-in90.9%
*-commutative90.9%
associate-*l*90.9%
distribute-lft-out90.9%
+-commutative90.9%
*-commutative90.9%
associate-*r*90.9%
*-commutative90.9%
associate-*r*90.9%
distribute-rgt-out90.9%
Simplified90.9%
Taylor expanded in im around inf 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in re around 0 76.5%
*-commutative76.5%
associate-*l*76.5%
*-commutative76.5%
Simplified76.5%
if -6e4 < im < 7.6000000000000006e32Initial program 35.7%
Taylor expanded in im around 0 93.3%
mul-1-neg93.3%
*-commutative93.3%
distribute-lft-neg-in93.3%
Simplified93.3%
if 9.9999999999999998e207 < im < 4.2000000000000002e275Initial program 100.0%
Taylor expanded in im around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
distribute-lft-neg-in6.4%
Simplified6.4%
Taylor expanded in re around 0 1.0%
+-commutative1.0%
mul-1-neg1.0%
unsub-neg1.0%
associate-*r*1.0%
distribute-rgt-out--59.8%
*-commutative59.8%
Simplified59.8%
Final simplification84.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* (pow im 7.0) -0.0001984126984126984))))
(if (<= im -130000.0)
t_0
(if (<= im 7.6e+32)
(* im (- (sin re)))
(if (or (<= im 1e+208) (not (<= im 4.2e+275)))
t_0
(* 0.16666666666666666 (* im (pow re 3.0))))))))
double code(double re, double im) {
double t_0 = re * (pow(im, 7.0) * -0.0001984126984126984);
double tmp;
if (im <= -130000.0) {
tmp = t_0;
} else if (im <= 7.6e+32) {
tmp = im * -sin(re);
} else if ((im <= 1e+208) || !(im <= 4.2e+275)) {
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 = re * ((im ** 7.0d0) * (-0.0001984126984126984d0))
if (im <= (-130000.0d0)) then
tmp = t_0
else if (im <= 7.6d+32) then
tmp = im * -sin(re)
else if ((im <= 1d+208) .or. (.not. (im <= 4.2d+275))) 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 = re * (Math.pow(im, 7.0) * -0.0001984126984126984);
double tmp;
if (im <= -130000.0) {
tmp = t_0;
} else if (im <= 7.6e+32) {
tmp = im * -Math.sin(re);
} else if ((im <= 1e+208) || !(im <= 4.2e+275)) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (im * Math.pow(re, 3.0));
}
return tmp;
}
def code(re, im): t_0 = re * (math.pow(im, 7.0) * -0.0001984126984126984) tmp = 0 if im <= -130000.0: tmp = t_0 elif im <= 7.6e+32: tmp = im * -math.sin(re) elif (im <= 1e+208) or not (im <= 4.2e+275): tmp = t_0 else: tmp = 0.16666666666666666 * (im * math.pow(re, 3.0)) return tmp
function code(re, im) t_0 = Float64(re * Float64((im ^ 7.0) * -0.0001984126984126984)) tmp = 0.0 if (im <= -130000.0) tmp = t_0; elseif (im <= 7.6e+32) tmp = Float64(im * Float64(-sin(re))); elseif ((im <= 1e+208) || !(im <= 4.2e+275)) 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 = re * ((im ^ 7.0) * -0.0001984126984126984); tmp = 0.0; if (im <= -130000.0) tmp = t_0; elseif (im <= 7.6e+32) tmp = im * -sin(re); elseif ((im <= 1e+208) || ~((im <= 4.2e+275))) tmp = t_0; else tmp = 0.16666666666666666 * (im * (re ^ 3.0)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -130000.0], t$95$0, If[LessEqual[im, 7.6e+32], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[Or[LessEqual[im, 1e+208], N[Not[LessEqual[im, 4.2e+275]], $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 := re \cdot \left({im}^{7} \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -130000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 7.6 \cdot 10^{+32}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 10^{+208} \lor \neg \left(im \leq 4.2 \cdot 10^{+275}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\
\end{array}
\end{array}
if im < -1.3e5 or 7.6000000000000006e32 < im < 9.9999999999999998e207 or 4.2000000000000002e275 < im Initial program 100.0%
Taylor expanded in im around 0 90.9%
associate-+r+90.9%
+-commutative90.9%
+-commutative90.9%
mul-1-neg90.9%
distribute-rgt-neg-in90.9%
*-commutative90.9%
associate-*l*90.9%
distribute-lft-out90.9%
+-commutative90.9%
*-commutative90.9%
associate-*r*90.9%
*-commutative90.9%
associate-*r*90.9%
distribute-rgt-out90.9%
Simplified90.9%
Taylor expanded in im around inf 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in re around 0 76.5%
*-commutative76.5%
associate-*l*76.5%
*-commutative76.5%
Simplified76.5%
if -1.3e5 < im < 7.6000000000000006e32Initial program 35.7%
Taylor expanded in im around 0 93.3%
mul-1-neg93.3%
*-commutative93.3%
distribute-lft-neg-in93.3%
Simplified93.3%
if 9.9999999999999998e207 < im < 4.2000000000000002e275Initial program 100.0%
Taylor expanded in im around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
distribute-lft-neg-in6.4%
Simplified6.4%
Taylor expanded in re around 0 1.0%
Taylor expanded in re around inf 59.4%
Final simplification84.2%
(FPCore (re im) :precision binary64 (if (or (<= im -9.8e+123) (not (<= im 120000000000.0))) (* 0.16666666666666666 (* im (pow re 3.0))) (* im (- (sin re)))))
double code(double re, double im) {
double tmp;
if ((im <= -9.8e+123) || !(im <= 120000000000.0)) {
tmp = 0.16666666666666666 * (im * pow(re, 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 <= (-9.8d+123)) .or. (.not. (im <= 120000000000.0d0))) then
tmp = 0.16666666666666666d0 * (im * (re ** 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 <= -9.8e+123) || !(im <= 120000000000.0)) {
tmp = 0.16666666666666666 * (im * Math.pow(re, 3.0));
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -9.8e+123) or not (im <= 120000000000.0): tmp = 0.16666666666666666 * (im * math.pow(re, 3.0)) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -9.8e+123) || !(im <= 120000000000.0)) tmp = Float64(0.16666666666666666 * Float64(im * (re ^ 3.0))); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -9.8e+123) || ~((im <= 120000000000.0))) tmp = 0.16666666666666666 * (im * (re ^ 3.0)); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -9.8e+123], N[Not[LessEqual[im, 120000000000.0]], $MachinePrecision]], N[(0.16666666666666666 * N[(im * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -9.8 \cdot 10^{+123} \lor \neg \left(im \leq 120000000000\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -9.79999999999999952e123 or 1.2e11 < im Initial program 100.0%
Taylor expanded in im around 0 4.6%
mul-1-neg4.6%
*-commutative4.6%
distribute-lft-neg-in4.6%
Simplified4.6%
Taylor expanded in re around 0 7.4%
Taylor expanded in re around inf 25.8%
if -9.79999999999999952e123 < im < 1.2e11Initial program 41.7%
Taylor expanded in im around 0 84.7%
mul-1-neg84.7%
*-commutative84.7%
distribute-lft-neg-in84.7%
Simplified84.7%
Final simplification59.9%
(FPCore (re im) :precision binary64 (if (or (<= im -740000000000.0) (not (<= im 1.5e+83))) (* (- im) re) (* im (- (sin re)))))
double code(double re, double im) {
double tmp;
if ((im <= -740000000000.0) || !(im <= 1.5e+83)) {
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 <= (-740000000000.0d0)) .or. (.not. (im <= 1.5d+83))) 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 <= -740000000000.0) || !(im <= 1.5e+83)) {
tmp = -im * re;
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -740000000000.0) or not (im <= 1.5e+83): tmp = -im * re else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -740000000000.0) || !(im <= 1.5e+83)) tmp = Float64(Float64(-im) * re); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -740000000000.0) || ~((im <= 1.5e+83))) tmp = -im * re; else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -740000000000.0], N[Not[LessEqual[im, 1.5e+83]], $MachinePrecision]], N[((-im) * re), $MachinePrecision], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -740000000000 \lor \neg \left(im \leq 1.5 \cdot 10^{+83}\right):\\
\;\;\;\;\left(-im\right) \cdot re\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -7.4e11 or 1.5e83 < im Initial program 100.0%
Taylor expanded in im around 0 4.7%
mul-1-neg4.7%
*-commutative4.7%
distribute-lft-neg-in4.7%
Simplified4.7%
Taylor expanded in re around 0 17.9%
if -7.4e11 < im < 1.5e83Initial program 42.5%
Taylor expanded in im around 0 83.7%
mul-1-neg83.7%
*-commutative83.7%
distribute-lft-neg-in83.7%
Simplified83.7%
Final simplification56.4%
(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 66.3%
Taylor expanded in im around 0 51.0%
mul-1-neg51.0%
*-commutative51.0%
distribute-lft-neg-in51.0%
Simplified51.0%
Taylor expanded in re around 0 31.4%
Final simplification31.4%
(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 66.3%
Taylor expanded in re around 0 52.1%
expm1-log1p-u34.5%
expm1-udef33.2%
*-commutative33.2%
add-sqr-sqrt16.4%
sqrt-unprod23.9%
sqr-neg23.9%
sqrt-unprod7.4%
add-sqr-sqrt13.7%
Applied egg-rr13.7%
expm1-def13.7%
expm1-log1p13.7%
+-inverses14.1%
mul0-rgt14.1%
Simplified14.1%
Final simplification14.1%
(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 2023274
(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))))