
(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 11 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 -10000000.0) (not (<= t_0 0.001)))
(* t_0 (* 0.5 (sin re)))
(* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -10000000.0) || !(t_0 <= 0.001)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - 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 <= (-10000000.0d0)) .or. (.not. (t_0 <= 0.001d0))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - 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 <= -10000000.0) || !(t_0 <= 0.001)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -10000000.0) or not (t_0 <= 0.001): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -10000000.0) || !(t_0 <= 0.001)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -10000000.0) || ~((t_0 <= 0.001))) tmp = t_0 * (0.5 * sin(re)); else tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - 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, -10000000.0], N[Not[LessEqual[t$95$0, 0.001]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -10000000 \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -1e7 or 1e-3 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -1e7 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 1e-3Initial program 35.6%
Taylor expanded in im around 0 99.8%
associate-*r*99.8%
neg-mul-199.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in re around inf 99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -1.7e+106)
t_0
(if (<= im -510.0)
(log1p (expm1 (- 27.0 (* im (sin re)))))
(if (<= im 1950.0)
(* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(if (<= im 5.6e+102)
(* (- (exp (- im)) (exp im)) (* 0.5 re))
t_0))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -1.7e+106) {
tmp = t_0;
} else if (im <= -510.0) {
tmp = log1p(expm1((27.0 - (im * sin(re)))));
} else if (im <= 1950.0) {
tmp = sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else if (im <= 5.6e+102) {
tmp = (exp(-im) - exp(im)) * (0.5 * re);
} else {
tmp = t_0;
}
return tmp;
}
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 <= -1.7e+106) {
tmp = t_0;
} else if (im <= -510.0) {
tmp = Math.log1p(Math.expm1((27.0 - (im * Math.sin(re)))));
} else if (im <= 1950.0) {
tmp = Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else if (im <= 5.6e+102) {
tmp = (Math.exp(-im) - Math.exp(im)) * (0.5 * 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 <= -1.7e+106: tmp = t_0 elif im <= -510.0: tmp = math.log1p(math.expm1((27.0 - (im * math.sin(re))))) elif im <= 1950.0: tmp = math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) elif im <= 5.6e+102: tmp = (math.exp(-im) - math.exp(im)) * (0.5 * 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 <= -1.7e+106) tmp = t_0; elseif (im <= -510.0) tmp = log1p(expm1(Float64(27.0 - Float64(im * sin(re))))); elseif (im <= 1950.0) tmp = Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); elseif (im <= 5.6e+102) tmp = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 * re)); else tmp = t_0; end return 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, -1.7e+106], t$95$0, If[LessEqual[im, -510.0], N[Log[1 + N[(Exp[N[(27.0 - N[(im * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1950.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6e+102], N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * 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 -1.7 \cdot 10^{+106}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -510:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(27 - im \cdot \sin re\right)\right)\\
\mathbf{elif}\;im \leq 1950:\\
\;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.69999999999999997e106 or 5.60000000000000037e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
associate-*r*100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -1.69999999999999997e106 < im < -510Initial program 100.0%
Taylor expanded in im around 0 30.8%
+-commutative30.8%
mul-1-neg30.8%
unsub-neg30.8%
associate-*r*30.8%
associate-*r*30.8%
distribute-rgt-out30.8%
*-commutative30.8%
*-commutative30.8%
Simplified30.8%
Applied egg-rr3.0%
log1p-expm1-u66.2%
*-commutative66.2%
Applied egg-rr66.2%
if -510 < im < 1950Initial program 37.2%
Taylor expanded in im around 0 97.6%
associate-*r*97.6%
neg-mul-197.6%
associate-*r*97.6%
distribute-rgt-out97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in re around inf 97.6%
if 1950 < im < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in re around 0 66.7%
associate-*r*66.7%
*-commutative66.7%
Simplified66.7%
Final simplification91.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 -1.85e+117)
t_1
(if (<= im -8.5)
t_0
(if (<= im 1950.0)
(* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(if (<= im 5.6e+102) 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 <= -1.85e+117) {
tmp = t_1;
} else if (im <= -8.5) {
tmp = t_0;
} else if (im <= 1950.0) {
tmp = sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else if (im <= 5.6e+102) {
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 <= (-1.85d+117)) then
tmp = t_1
else if (im <= (-8.5d0)) then
tmp = t_0
else if (im <= 1950.0d0) then
tmp = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
else if (im <= 5.6d+102) 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 <= -1.85e+117) {
tmp = t_1;
} else if (im <= -8.5) {
tmp = t_0;
} else if (im <= 1950.0) {
tmp = Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else if (im <= 5.6e+102) {
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 <= -1.85e+117: tmp = t_1 elif im <= -8.5: tmp = t_0 elif im <= 1950.0: tmp = math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) elif im <= 5.6e+102: 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 <= -1.85e+117) tmp = t_1; elseif (im <= -8.5) tmp = t_0; elseif (im <= 1950.0) tmp = Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); elseif (im <= 5.6e+102) 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 <= -1.85e+117) tmp = t_1; elseif (im <= -8.5) tmp = t_0; elseif (im <= 1950.0) tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); elseif (im <= 5.6e+102) 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, -1.85e+117], t$95$1, If[LessEqual[im, -8.5], t$95$0, If[LessEqual[im, 1950.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6e+102], 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 -1.85 \cdot 10^{+117}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -8.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1950:\\
\;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.8499999999999999e117 or 5.60000000000000037e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
associate-*r*100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -1.8499999999999999e117 < im < -8.5 or 1950 < im < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in re around 0 67.8%
associate-*r*67.8%
*-commutative67.8%
Simplified67.8%
if -8.5 < im < 1950Initial program 37.2%
Taylor expanded in im around 0 97.6%
associate-*r*97.6%
neg-mul-197.6%
associate-*r*97.6%
distribute-rgt-out97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in re around inf 97.6%
Final simplification91.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (- (* (pow re 3.0) 0.16666666666666666) re)))
(t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -5.2e+101)
t_1
(if (<= im -220000000000.0)
t_0
(if (<= im 620.0) (* im (- (sin re))) (if (<= im 7.4e+96) t_0 t_1))))))
double code(double re, double im) {
double t_0 = im * ((pow(re, 3.0) * 0.16666666666666666) - re);
double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.2e+101) {
tmp = t_1;
} else if (im <= -220000000000.0) {
tmp = t_0;
} else if (im <= 620.0) {
tmp = im * -sin(re);
} else if (im <= 7.4e+96) {
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 = im * (((re ** 3.0d0) * 0.16666666666666666d0) - re)
t_1 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-5.2d+101)) then
tmp = t_1
else if (im <= (-220000000000.0d0)) then
tmp = t_0
else if (im <= 620.0d0) then
tmp = im * -sin(re)
else if (im <= 7.4d+96) 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 = im * ((Math.pow(re, 3.0) * 0.16666666666666666) - re);
double t_1 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.2e+101) {
tmp = t_1;
} else if (im <= -220000000000.0) {
tmp = t_0;
} else if (im <= 620.0) {
tmp = im * -Math.sin(re);
} else if (im <= 7.4e+96) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = im * ((math.pow(re, 3.0) * 0.16666666666666666) - re) t_1 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -5.2e+101: tmp = t_1 elif im <= -220000000000.0: tmp = t_0 elif im <= 620.0: tmp = im * -math.sin(re) elif im <= 7.4e+96: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(im * Float64(Float64((re ^ 3.0) * 0.16666666666666666) - re)) t_1 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -5.2e+101) tmp = t_1; elseif (im <= -220000000000.0) tmp = t_0; elseif (im <= 620.0) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 7.4e+96) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = im * (((re ^ 3.0) * 0.16666666666666666) - re); t_1 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -5.2e+101) tmp = t_1; elseif (im <= -220000000000.0) tmp = t_0; elseif (im <= 620.0) tmp = im * -sin(re); elseif (im <= 7.4e+96) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(N[(N[Power[re, 3.0], $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 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.2e+101], t$95$1, If[LessEqual[im, -220000000000.0], t$95$0, If[LessEqual[im, 620.0], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 7.4e+96], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left({re}^{3} \cdot 0.16666666666666666 - re\right)\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -5.2 \cdot 10^{+101}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -220000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 620:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 7.4 \cdot 10^{+96}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -5.2e101 or 7.39999999999999982e96 < im Initial program 100.0%
Taylor expanded in im around 0 94.8%
associate-*r*94.8%
neg-mul-194.8%
associate-*r*94.8%
distribute-rgt-out94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in re around inf 94.8%
Taylor expanded in im around inf 94.8%
associate-*r*94.8%
*-commutative94.8%
associate-*l*94.8%
Simplified94.8%
if -5.2e101 < im < -2.2e11 or 620 < im < 7.39999999999999982e96Initial program 100.0%
Taylor expanded in im around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in re around 0 32.0%
+-commutative32.0%
mul-1-neg32.0%
unsub-neg32.0%
*-commutative32.0%
associate-*l*32.0%
distribute-lft-out--36.4%
Simplified36.4%
if -2.2e11 < im < 620Initial program 37.7%
Taylor expanded in im around 0 96.2%
associate-*r*96.2%
neg-mul-196.2%
Simplified96.2%
Final simplification84.9%
(FPCore (re im) :precision binary64 (* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im)))
double code(double re, double im) {
return sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
end function
public static double code(double re, double im) {
return Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
def code(re, im): return math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im)
function code(re, im) return Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)) end
function tmp = code(re, im) tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)
\end{array}
Initial program 70.8%
Taylor expanded in im around 0 79.4%
associate-*r*79.4%
neg-mul-179.4%
associate-*r*79.4%
distribute-rgt-out79.4%
*-commutative79.4%
Simplified79.4%
Taylor expanded in re around inf 79.4%
Final simplification79.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* -0.16666666666666666 (pow im 3.0))))
(t_1 (* im (- (* (pow re 3.0) 0.16666666666666666) re))))
(if (<= im -2.5e+81)
t_0
(if (<= im -220000000000.0)
t_1
(if (<= im 650.0) (* im (- (sin re))) (if (<= im 1.76e+93) t_1 t_0))))))
double code(double re, double im) {
double t_0 = re * (-0.16666666666666666 * pow(im, 3.0));
double t_1 = im * ((pow(re, 3.0) * 0.16666666666666666) - re);
double tmp;
if (im <= -2.5e+81) {
tmp = t_0;
} else if (im <= -220000000000.0) {
tmp = t_1;
} else if (im <= 650.0) {
tmp = im * -sin(re);
} else if (im <= 1.76e+93) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = re * ((-0.16666666666666666d0) * (im ** 3.0d0))
t_1 = im * (((re ** 3.0d0) * 0.16666666666666666d0) - re)
if (im <= (-2.5d+81)) then
tmp = t_0
else if (im <= (-220000000000.0d0)) then
tmp = t_1
else if (im <= 650.0d0) then
tmp = im * -sin(re)
else if (im <= 1.76d+93) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (-0.16666666666666666 * Math.pow(im, 3.0));
double t_1 = im * ((Math.pow(re, 3.0) * 0.16666666666666666) - re);
double tmp;
if (im <= -2.5e+81) {
tmp = t_0;
} else if (im <= -220000000000.0) {
tmp = t_1;
} else if (im <= 650.0) {
tmp = im * -Math.sin(re);
} else if (im <= 1.76e+93) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (-0.16666666666666666 * math.pow(im, 3.0)) t_1 = im * ((math.pow(re, 3.0) * 0.16666666666666666) - re) tmp = 0 if im <= -2.5e+81: tmp = t_0 elif im <= -220000000000.0: tmp = t_1 elif im <= 650.0: tmp = im * -math.sin(re) elif im <= 1.76e+93: tmp = t_1 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(-0.16666666666666666 * (im ^ 3.0))) t_1 = Float64(im * Float64(Float64((re ^ 3.0) * 0.16666666666666666) - re)) tmp = 0.0 if (im <= -2.5e+81) tmp = t_0; elseif (im <= -220000000000.0) tmp = t_1; elseif (im <= 650.0) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 1.76e+93) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re * (-0.16666666666666666 * (im ^ 3.0)); t_1 = im * (((re ^ 3.0) * 0.16666666666666666) - re); tmp = 0.0; if (im <= -2.5e+81) tmp = t_0; elseif (im <= -220000000000.0) tmp = t_1; elseif (im <= 650.0) tmp = im * -sin(re); elseif (im <= 1.76e+93) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(N[(N[Power[re, 3.0], $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.5e+81], t$95$0, If[LessEqual[im, -220000000000.0], t$95$1, If[LessEqual[im, 650.0], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.76e+93], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(-0.16666666666666666 \cdot {im}^{3}\right)\\
t_1 := im \cdot \left({re}^{3} \cdot 0.16666666666666666 - re\right)\\
\mathbf{if}\;im \leq -2.5 \cdot 10^{+81}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -220000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 650:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 1.76 \cdot 10^{+93}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.4999999999999999e81 or 1.75999999999999994e93 < im Initial program 100.0%
Taylor expanded in re around 0 74.2%
associate-*r*74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in im around 0 68.1%
Taylor expanded in im around inf 68.1%
associate-*r*68.1%
*-commutative68.1%
Simplified68.1%
if -2.4999999999999999e81 < im < -2.2e11 or 650 < im < 1.75999999999999994e93Initial program 100.0%
Taylor expanded in im around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in re around 0 34.2%
+-commutative34.2%
mul-1-neg34.2%
unsub-neg34.2%
*-commutative34.2%
associate-*l*34.2%
distribute-lft-out--36.5%
Simplified36.5%
if -2.2e11 < im < 650Initial program 37.7%
Taylor expanded in im around 0 96.2%
associate-*r*96.2%
neg-mul-196.2%
Simplified96.2%
Final simplification76.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (pow im 3.0)))
(t_1 (* im (- (* (pow re 3.0) 0.16666666666666666) re))))
(if (<= im -2.3e+81)
(* re t_0)
(if (<= im -220000000000.0)
t_1
(if (<= im 660.0)
(* im (- (sin re)))
(if (<= im 2.25e+92) t_1 (* re (- t_0 im))))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * pow(im, 3.0);
double t_1 = im * ((pow(re, 3.0) * 0.16666666666666666) - re);
double tmp;
if (im <= -2.3e+81) {
tmp = re * t_0;
} else if (im <= -220000000000.0) {
tmp = t_1;
} else if (im <= 660.0) {
tmp = im * -sin(re);
} else if (im <= 2.25e+92) {
tmp = t_1;
} else {
tmp = re * (t_0 - 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) :: t_1
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (im ** 3.0d0)
t_1 = im * (((re ** 3.0d0) * 0.16666666666666666d0) - re)
if (im <= (-2.3d+81)) then
tmp = re * t_0
else if (im <= (-220000000000.0d0)) then
tmp = t_1
else if (im <= 660.0d0) then
tmp = im * -sin(re)
else if (im <= 2.25d+92) then
tmp = t_1
else
tmp = re * (t_0 - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * Math.pow(im, 3.0);
double t_1 = im * ((Math.pow(re, 3.0) * 0.16666666666666666) - re);
double tmp;
if (im <= -2.3e+81) {
tmp = re * t_0;
} else if (im <= -220000000000.0) {
tmp = t_1;
} else if (im <= 660.0) {
tmp = im * -Math.sin(re);
} else if (im <= 2.25e+92) {
tmp = t_1;
} else {
tmp = re * (t_0 - im);
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * math.pow(im, 3.0) t_1 = im * ((math.pow(re, 3.0) * 0.16666666666666666) - re) tmp = 0 if im <= -2.3e+81: tmp = re * t_0 elif im <= -220000000000.0: tmp = t_1 elif im <= 660.0: tmp = im * -math.sin(re) elif im <= 2.25e+92: tmp = t_1 else: tmp = re * (t_0 - im) return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * (im ^ 3.0)) t_1 = Float64(im * Float64(Float64((re ^ 3.0) * 0.16666666666666666) - re)) tmp = 0.0 if (im <= -2.3e+81) tmp = Float64(re * t_0); elseif (im <= -220000000000.0) tmp = t_1; elseif (im <= 660.0) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 2.25e+92) tmp = t_1; else tmp = Float64(re * Float64(t_0 - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (im ^ 3.0); t_1 = im * (((re ^ 3.0) * 0.16666666666666666) - re); tmp = 0.0; if (im <= -2.3e+81) tmp = re * t_0; elseif (im <= -220000000000.0) tmp = t_1; elseif (im <= 660.0) tmp = im * -sin(re); elseif (im <= 2.25e+92) tmp = t_1; else tmp = re * (t_0 - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(N[(N[Power[re, 3.0], $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.3e+81], N[(re * t$95$0), $MachinePrecision], If[LessEqual[im, -220000000000.0], t$95$1, If[LessEqual[im, 660.0], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 2.25e+92], t$95$1, N[(re * N[(t$95$0 - im), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot {im}^{3}\\
t_1 := im \cdot \left({re}^{3} \cdot 0.16666666666666666 - re\right)\\
\mathbf{if}\;im \leq -2.3 \cdot 10^{+81}:\\
\;\;\;\;re \cdot t_0\\
\mathbf{elif}\;im \leq -220000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 660:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 2.25 \cdot 10^{+92}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(t_0 - im\right)\\
\end{array}
\end{array}
if im < -2.2999999999999999e81Initial program 100.0%
Taylor expanded in re around 0 75.0%
associate-*r*75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in im around 0 70.7%
Taylor expanded in im around inf 70.7%
associate-*r*70.7%
*-commutative70.7%
Simplified70.7%
if -2.2999999999999999e81 < im < -2.2e11 or 660 < im < 2.25e92Initial program 100.0%
Taylor expanded in im around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in re around 0 34.2%
+-commutative34.2%
mul-1-neg34.2%
unsub-neg34.2%
*-commutative34.2%
associate-*l*34.2%
distribute-lft-out--36.5%
Simplified36.5%
if -2.2e11 < im < 660Initial program 37.7%
Taylor expanded in im around 0 96.2%
associate-*r*96.2%
neg-mul-196.2%
Simplified96.2%
if 2.25e92 < im Initial program 100.0%
Taylor expanded in re around 0 73.5%
associate-*r*73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in im around 0 65.7%
+-commutative65.7%
mul-1-neg65.7%
unsub-neg65.7%
associate-*r*65.7%
distribute-rgt-out--65.7%
Simplified65.7%
Final simplification76.0%
(FPCore (re im) :precision binary64 (if (or (<= im -1.35e+16) (not (<= im 9.2e+91))) (* re (* -0.16666666666666666 (pow im 3.0))) (* im (- (sin re)))))
double code(double re, double im) {
double tmp;
if ((im <= -1.35e+16) || !(im <= 9.2e+91)) {
tmp = re * (-0.16666666666666666 * 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 <= (-1.35d+16)) .or. (.not. (im <= 9.2d+91))) then
tmp = re * ((-0.16666666666666666d0) * (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 <= -1.35e+16) || !(im <= 9.2e+91)) {
tmp = re * (-0.16666666666666666 * Math.pow(im, 3.0));
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.35e+16) or not (im <= 9.2e+91): tmp = re * (-0.16666666666666666 * math.pow(im, 3.0)) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.35e+16) || !(im <= 9.2e+91)) tmp = Float64(re * Float64(-0.16666666666666666 * (im ^ 3.0))); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.35e+16) || ~((im <= 9.2e+91))) tmp = re * (-0.16666666666666666 * (im ^ 3.0)); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.35e+16], N[Not[LessEqual[im, 9.2e+91]], $MachinePrecision]], N[(re * N[(-0.16666666666666666 * 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 -1.35 \cdot 10^{+16} \lor \neg \left(im \leq 9.2 \cdot 10^{+91}\right):\\
\;\;\;\;re \cdot \left(-0.16666666666666666 \cdot {im}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -1.35e16 or 9.19999999999999965e91 < im Initial program 100.0%
Taylor expanded in re around 0 71.1%
associate-*r*71.1%
*-commutative71.1%
Simplified71.1%
Taylor expanded in im around 0 57.6%
Taylor expanded in im around inf 57.6%
associate-*r*57.6%
*-commutative57.6%
Simplified57.6%
if -1.35e16 < im < 9.19999999999999965e91Initial program 47.4%
Taylor expanded in im around 0 81.8%
associate-*r*81.8%
neg-mul-181.8%
Simplified81.8%
Final simplification71.0%
(FPCore (re im) :precision binary64 (if (<= im -1.15e+16) (* im (- re)) (if (<= im 1.85e+184) (* im (- (sin re))) (- 27.0 (* im re)))))
double code(double re, double im) {
double tmp;
if (im <= -1.15e+16) {
tmp = im * -re;
} else if (im <= 1.85e+184) {
tmp = im * -sin(re);
} else {
tmp = 27.0 - (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 <= (-1.15d+16)) then
tmp = im * -re
else if (im <= 1.85d+184) then
tmp = im * -sin(re)
else
tmp = 27.0d0 - (im * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -1.15e+16) {
tmp = im * -re;
} else if (im <= 1.85e+184) {
tmp = im * -Math.sin(re);
} else {
tmp = 27.0 - (im * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -1.15e+16: tmp = im * -re elif im <= 1.85e+184: tmp = im * -math.sin(re) else: tmp = 27.0 - (im * re) return tmp
function code(re, im) tmp = 0.0 if (im <= -1.15e+16) tmp = Float64(im * Float64(-re)); elseif (im <= 1.85e+184) tmp = Float64(im * Float64(-sin(re))); else tmp = Float64(27.0 - Float64(im * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -1.15e+16) tmp = im * -re; elseif (im <= 1.85e+184) tmp = im * -sin(re); else tmp = 27.0 - (im * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -1.15e+16], N[(im * (-re)), $MachinePrecision], If[LessEqual[im, 1.85e+184], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], N[(27.0 - N[(im * re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.15 \cdot 10^{+16}:\\
\;\;\;\;im \cdot \left(-re\right)\\
\mathbf{elif}\;im \leq 1.85 \cdot 10^{+184}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{else}:\\
\;\;\;\;27 - im \cdot re\\
\end{array}
\end{array}
if im < -1.15e16Initial program 100.0%
Taylor expanded in im around 0 4.3%
associate-*r*4.3%
neg-mul-14.3%
Simplified4.3%
Taylor expanded in re around 0 15.9%
associate-*r*15.9%
neg-mul-115.9%
Simplified15.9%
if -1.15e16 < im < 1.8499999999999999e184Initial program 53.3%
Taylor expanded in im around 0 73.0%
associate-*r*73.0%
neg-mul-173.0%
Simplified73.0%
if 1.8499999999999999e184 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr5.5%
Taylor expanded in re around 0 30.6%
mul-1-neg30.6%
*-commutative30.6%
unsub-neg30.6%
Simplified30.6%
Final simplification53.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(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 70.8%
Taylor expanded in im around 0 47.4%
associate-*r*47.4%
neg-mul-147.4%
Simplified47.4%
Taylor expanded in re around 0 33.9%
associate-*r*33.9%
neg-mul-133.9%
Simplified33.9%
Final simplification33.9%
(FPCore (re im) :precision binary64 27.0)
double code(double re, double im) {
return 27.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 27.0d0
end function
public static double code(double re, double im) {
return 27.0;
}
def code(re, im): return 27.0
function code(re, im) return 27.0 end
function tmp = code(re, im) tmp = 27.0; end
code[re_, im_] := 27.0
\begin{array}{l}
\\
27
\end{array}
Initial program 70.8%
Taylor expanded in im around 0 85.0%
+-commutative85.0%
mul-1-neg85.0%
unsub-neg85.0%
associate-*r*85.0%
associate-*r*85.0%
distribute-rgt-out85.0%
*-commutative85.0%
*-commutative85.0%
Simplified85.0%
Applied egg-rr3.8%
Taylor expanded in im around 0 2.6%
Final simplification2.6%
(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 2023320
(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))))