
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - 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 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - 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)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(+
(+
(* (pow im 7.0) -0.0001984126984126984)
(* (pow im 5.0) -0.008333333333333333))
(- (* (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.05)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * (((pow(im, 7.0) * -0.0001984126984126984) + (pow(im, 5.0) * -0.008333333333333333)) + ((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.05d0))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * ((((im ** 7.0d0) * (-0.0001984126984126984d0)) + ((im ** 5.0d0) * (-0.008333333333333333d0))) + (((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.05)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * (((Math.pow(im, 7.0) * -0.0001984126984126984) + (Math.pow(im, 5.0) * -0.008333333333333333)) + ((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.05): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * (((math.pow(im, 7.0) * -0.0001984126984126984) + (math.pow(im, 5.0) * -0.008333333333333333)) + ((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.05)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64((im ^ 7.0) * -0.0001984126984126984) + Float64((im ^ 5.0) * -0.008333333333333333)) + 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.05))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((((im ^ 7.0) * -0.0001984126984126984) + ((im ^ 5.0) * -0.008333333333333333)) + (((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.05]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $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):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left({im}^{7} \cdot -0.0001984126984126984 + {im}^{5} \cdot -0.008333333333333333\right) + \left({im}^{3} \cdot -0.16666666666666666 - im\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -1 or 0.050000000000000003 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -1 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.050000000000000003Initial program 9.7%
neg-sub09.7%
Simplified9.7%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))) (t_1 (* 0.5 (cos re))))
(if (or (<= t_0 -1.0) (not (<= t_0 0.05)))
(* t_1 t_0)
(*
t_1
(+
(* im -2.0)
(+
(* (pow im 5.0) -0.016666666666666666)
(* (pow im 3.0) -0.3333333333333333)))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = 0.5 * cos(re);
double tmp;
if ((t_0 <= -1.0) || !(t_0 <= 0.05)) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((pow(im, 5.0) * -0.016666666666666666) + (pow(im, 3.0) * -0.3333333333333333)));
}
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)
t_1 = 0.5d0 * cos(re)
if ((t_0 <= (-1.0d0)) .or. (.not. (t_0 <= 0.05d0))) then
tmp = t_1 * t_0
else
tmp = t_1 * ((im * (-2.0d0)) + (((im ** 5.0d0) * (-0.016666666666666666d0)) + ((im ** 3.0d0) * (-0.3333333333333333d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double t_1 = 0.5 * Math.cos(re);
double tmp;
if ((t_0 <= -1.0) || !(t_0 <= 0.05)) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((Math.pow(im, 5.0) * -0.016666666666666666) + (Math.pow(im, 3.0) * -0.3333333333333333)));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = 0.5 * math.cos(re) tmp = 0 if (t_0 <= -1.0) or not (t_0 <= 0.05): tmp = t_1 * t_0 else: tmp = t_1 * ((im * -2.0) + ((math.pow(im, 5.0) * -0.016666666666666666) + (math.pow(im, 3.0) * -0.3333333333333333))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64(0.5 * cos(re)) tmp = 0.0 if ((t_0 <= -1.0) || !(t_0 <= 0.05)) tmp = Float64(t_1 * t_0); else tmp = Float64(t_1 * Float64(Float64(im * -2.0) + Float64(Float64((im ^ 5.0) * -0.016666666666666666) + Float64((im ^ 3.0) * -0.3333333333333333)))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = 0.5 * cos(re); tmp = 0.0; if ((t_0 <= -1.0) || ~((t_0 <= 0.05))) tmp = t_1 * t_0; else tmp = t_1 * ((im * -2.0) + (((im ^ 5.0) * -0.016666666666666666) + ((im ^ 3.0) * -0.3333333333333333))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -1.0], N[Not[LessEqual[t$95$0, 0.05]], $MachinePrecision]], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$1 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := 0.5 \cdot \cos re\\
\mathbf{if}\;t_0 \leq -1 \lor \neg \left(t_0 \leq 0.05\right):\\
\;\;\;\;t_1 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(im \cdot -2 + \left({im}^{5} \cdot -0.016666666666666666 + {im}^{3} \cdot -0.3333333333333333\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -1 or 0.050000000000000003 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -1 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.050000000000000003Initial program 9.7%
neg-sub09.7%
Simplified9.7%
Taylor expanded in im around 0 99.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)))
(* (* 0.5 (cos re)) t_0)
(* (cos 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 = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(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 = (0.5d0 * cos(re)) * t_0
else
tmp = cos(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 = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(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 = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(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(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(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 = (0.5 * cos(re)) * t_0; else tmp = cos(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[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[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):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -1 or 5.0000000000000001e-4 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
neg-sub099.9%
Simplified99.9%
if -1 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 5.0000000000000001e-4Initial program 9.0%
neg-sub09.0%
Simplified9.0%
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
(if (or (<= im -3.5e+155)
(and (not (<= im -0.19)) (or (<= im 0.66) (not (<= im 1.65e+100)))))
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(* 0.5 (- (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if ((im <= -3.5e+155) || (!(im <= -0.19) && ((im <= 0.66) || !(im <= 1.65e+100)))) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = 0.5 * (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 ((im <= (-3.5d+155)) .or. (.not. (im <= (-0.19d0))) .and. (im <= 0.66d0) .or. (.not. (im <= 1.65d+100))) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else
tmp = 0.5d0 * (exp(-im) - exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.5e+155) || (!(im <= -0.19) && ((im <= 0.66) || !(im <= 1.65e+100)))) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.5e+155) or (not (im <= -0.19) and ((im <= 0.66) or not (im <= 1.65e+100))): tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) else: tmp = 0.5 * (math.exp(-im) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.5e+155) || (!(im <= -0.19) && ((im <= 0.66) || !(im <= 1.65e+100)))) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); else tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.5e+155) || (~((im <= -0.19)) && ((im <= 0.66) || ~((im <= 1.65e+100))))) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); else tmp = 0.5 * (exp(-im) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.5e+155], And[N[Not[LessEqual[im, -0.19]], $MachinePrecision], Or[LessEqual[im, 0.66], N[Not[LessEqual[im, 1.65e+100]], $MachinePrecision]]]], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.5 \cdot 10^{+155} \lor \neg \left(im \leq -0.19\right) \land \left(im \leq 0.66 \lor \neg \left(im \leq 1.65 \cdot 10^{+100}\right)\right):\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\end{array}
if im < -3.49999999999999985e155 or -0.19 < im < 0.660000000000000031 or 1.6500000000000001e100 < im Initial program 45.6%
neg-sub045.6%
Simplified45.6%
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%
if -3.49999999999999985e155 < im < -0.19 or 0.660000000000000031 < im < 1.6500000000000001e100Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 85.1%
Final simplification96.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im)))
(t_1 (* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))))
(if (<= im -6.5e+80)
t_1
(if (<= im -0.6)
(* t_0 (+ 0.5 (* re (* re -0.25))))
(if (or (<= im 0.66) (not (<= im 1.65e+100))) t_1 (* 0.5 t_0))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -6.5e+80) {
tmp = t_1;
} else if (im <= -0.6) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if ((im <= 0.66) || !(im <= 1.65e+100)) {
tmp = t_1;
} else {
tmp = 0.5 * 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 = exp(-im) - exp(im)
t_1 = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
if (im <= (-6.5d+80)) then
tmp = t_1
else if (im <= (-0.6d0)) then
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
else if ((im <= 0.66d0) .or. (.not. (im <= 1.65d+100))) then
tmp = t_1
else
tmp = 0.5d0 * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double t_1 = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -6.5e+80) {
tmp = t_1;
} else if (im <= -0.6) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if ((im <= 0.66) || !(im <= 1.65e+100)) {
tmp = t_1;
} else {
tmp = 0.5 * t_0;
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) tmp = 0 if im <= -6.5e+80: tmp = t_1 elif im <= -0.6: tmp = t_0 * (0.5 + (re * (re * -0.25))) elif (im <= 0.66) or not (im <= 1.65e+100): tmp = t_1 else: tmp = 0.5 * t_0 return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)) tmp = 0.0 if (im <= -6.5e+80) tmp = t_1; elseif (im <= -0.6) tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif ((im <= 0.66) || !(im <= 1.65e+100)) tmp = t_1; else tmp = Float64(0.5 * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); tmp = 0.0; if (im <= -6.5e+80) tmp = t_1; elseif (im <= -0.6) tmp = t_0 * (0.5 + (re * (re * -0.25))); elseif ((im <= 0.66) || ~((im <= 1.65e+100))) tmp = t_1; else tmp = 0.5 * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.5e+80], t$95$1, If[LessEqual[im, -0.6], N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 0.66], N[Not[LessEqual[im, 1.65e+100]], $MachinePrecision]], t$95$1, N[(0.5 * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := \cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{if}\;im \leq -6.5 \cdot 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.6:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq 0.66 \lor \neg \left(im \leq 1.65 \cdot 10^{+100}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot t_0\\
\end{array}
\end{array}
if im < -6.4999999999999998e80 or -0.599999999999999978 < im < 0.660000000000000031 or 1.6500000000000001e100 < im Initial program 48.8%
neg-sub048.8%
Simplified48.8%
Taylor expanded in im around 0 98.6%
mul-1-neg98.6%
unsub-neg98.6%
*-commutative98.6%
associate-*l*98.6%
distribute-lft-out--98.6%
Simplified98.6%
if -6.4999999999999998e80 < im < -0.599999999999999978Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
if 0.660000000000000031 < im < 1.6500000000000001e100Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 81.8%
Final simplification97.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im)))))
(if (<= im -0.027)
t_0
(if (<= im 0.66)
(* (cos re) (- im))
(if (<= im 1.65e+100)
t_0
(*
(- (* (pow im 3.0) -0.16666666666666666) im)
(+ (* -0.5 (* re re)) 1.0)))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double tmp;
if (im <= -0.027) {
tmp = t_0;
} else if (im <= 0.66) {
tmp = cos(re) * -im;
} else if (im <= 1.65e+100) {
tmp = t_0;
} else {
tmp = ((pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.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.5d0 * (exp(-im) - exp(im))
if (im <= (-0.027d0)) then
tmp = t_0
else if (im <= 0.66d0) then
tmp = cos(re) * -im
else if (im <= 1.65d+100) then
tmp = t_0
else
tmp = (((im ** 3.0d0) * (-0.16666666666666666d0)) - im) * (((-0.5d0) * (re * re)) + 1.0d0)
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));
double tmp;
if (im <= -0.027) {
tmp = t_0;
} else if (im <= 0.66) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.65e+100) {
tmp = t_0;
} else {
tmp = ((Math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0);
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) tmp = 0 if im <= -0.027: tmp = t_0 elif im <= 0.66: tmp = math.cos(re) * -im elif im <= 1.65e+100: tmp = t_0 else: tmp = ((math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0) return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) tmp = 0.0 if (im <= -0.027) tmp = t_0; elseif (im <= 0.66) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.65e+100) tmp = t_0; else tmp = Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) * Float64(Float64(-0.5 * Float64(re * re)) + 1.0)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); tmp = 0.0; if (im <= -0.027) tmp = t_0; elseif (im <= 0.66) tmp = cos(re) * -im; elseif (im <= 1.65e+100) tmp = t_0; else tmp = (((im ^ 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -0.027], t$95$0, If[LessEqual[im, 0.66], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.65e+100], t$95$0, N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] * N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{if}\;im \leq -0.027:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.66:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.65 \cdot 10^{+100}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(-0.5 \cdot \left(re \cdot re\right) + 1\right)\\
\end{array}
\end{array}
if im < -0.0269999999999999997 or 0.660000000000000031 < im < 1.6500000000000001e100Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 80.7%
if -0.0269999999999999997 < im < 0.660000000000000031Initial program 10.4%
neg-sub010.4%
Simplified10.4%
Taylor expanded in im around 0 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-lft-neg-in98.2%
Simplified98.2%
if 1.6500000000000001e100 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 98.1%
mul-1-neg98.1%
unsub-neg98.1%
*-commutative98.1%
associate-*l*98.1%
distribute-lft-out--98.1%
Simplified98.1%
Taylor expanded in re around 0 2.2%
*-commutative2.2%
associate-+r-2.2%
associate-*r*2.2%
*-commutative2.2%
*-lft-identity2.2%
distribute-rgt-out82.6%
*-commutative82.6%
unpow282.6%
Simplified82.6%
Final simplification89.7%
(FPCore (re im)
:precision binary64
(if (<= im -7.5e+38)
(* 0.5 (+ (* im -2.0) (* (pow im 5.0) -0.016666666666666666)))
(if (<= im 2.45e+31)
(* (cos re) (- im))
(*
(- (* (pow im 3.0) -0.16666666666666666) im)
(+ (* -0.5 (* re re)) 1.0)))))
double code(double re, double im) {
double tmp;
if (im <= -7.5e+38) {
tmp = 0.5 * ((im * -2.0) + (pow(im, 5.0) * -0.016666666666666666));
} else if (im <= 2.45e+31) {
tmp = cos(re) * -im;
} else {
tmp = ((pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-7.5d+38)) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0)))
else if (im <= 2.45d+31) then
tmp = cos(re) * -im
else
tmp = (((im ** 3.0d0) * (-0.16666666666666666d0)) - im) * (((-0.5d0) * (re * re)) + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -7.5e+38) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(im, 5.0) * -0.016666666666666666));
} else if (im <= 2.45e+31) {
tmp = Math.cos(re) * -im;
} else {
tmp = ((Math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -7.5e+38: tmp = 0.5 * ((im * -2.0) + (math.pow(im, 5.0) * -0.016666666666666666)) elif im <= 2.45e+31: tmp = math.cos(re) * -im else: tmp = ((math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0) return tmp
function code(re, im) tmp = 0.0 if (im <= -7.5e+38) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 5.0) * -0.016666666666666666))); elseif (im <= 2.45e+31) tmp = Float64(cos(re) * Float64(-im)); else tmp = Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) * Float64(Float64(-0.5 * Float64(re * re)) + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -7.5e+38) tmp = 0.5 * ((im * -2.0) + ((im ^ 5.0) * -0.016666666666666666)); elseif (im <= 2.45e+31) tmp = cos(re) * -im; else tmp = (((im ^ 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -7.5e+38], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.45e+31], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] * N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -7.5 \cdot 10^{+38}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\
\mathbf{elif}\;im \leq 2.45 \cdot 10^{+31}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(-0.5 \cdot \left(re \cdot re\right) + 1\right)\\
\end{array}
\end{array}
if im < -7.4999999999999999e38Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 83.3%
Taylor expanded in im around 0 78.4%
Taylor expanded in im around inf 78.4%
if -7.4999999999999999e38 < im < 2.44999999999999998e31Initial program 18.7%
neg-sub018.7%
Simplified18.7%
Taylor expanded in im around 0 89.5%
mul-1-neg89.5%
*-commutative89.5%
distribute-lft-neg-in89.5%
Simplified89.5%
if 2.44999999999999998e31 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 74.1%
mul-1-neg74.1%
unsub-neg74.1%
*-commutative74.1%
associate-*l*74.1%
distribute-lft-out--74.1%
Simplified74.1%
Taylor expanded in re around 0 8.8%
*-commutative8.8%
associate-+r-8.8%
associate-*r*8.8%
*-commutative8.8%
*-lft-identity8.8%
distribute-rgt-out68.4%
*-commutative68.4%
unpow268.4%
Simplified68.4%
Final simplification82.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -1.35e+48)
t_0
(if (<= im 2.45e+31)
(* (cos re) (- im))
(if (or (<= im 1.6e+106) (and (not (<= im 5.4e+188)) (<= im 3.3e+274)))
(- (* 0.5 (* re (* im re))) im)
t_0)))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -1.35e+48) {
tmp = t_0;
} else if (im <= 2.45e+31) {
tmp = cos(re) * -im;
} else if ((im <= 1.6e+106) || (!(im <= 5.4e+188) && (im <= 3.3e+274))) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
if (im <= (-1.35d+48)) then
tmp = t_0
else if (im <= 2.45d+31) then
tmp = cos(re) * -im
else if ((im <= 1.6d+106) .or. (.not. (im <= 5.4d+188)) .and. (im <= 3.3d+274)) then
tmp = (0.5d0 * (re * (im * re))) - im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -1.35e+48) {
tmp = t_0;
} else if (im <= 2.45e+31) {
tmp = Math.cos(re) * -im;
} else if ((im <= 1.6e+106) || (!(im <= 5.4e+188) && (im <= 3.3e+274))) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -1.35e+48: tmp = t_0 elif im <= 2.45e+31: tmp = math.cos(re) * -im elif (im <= 1.6e+106) or (not (im <= 5.4e+188) and (im <= 3.3e+274)): tmp = (0.5 * (re * (im * re))) - im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -1.35e+48) tmp = t_0; elseif (im <= 2.45e+31) tmp = Float64(cos(re) * Float64(-im)); elseif ((im <= 1.6e+106) || (!(im <= 5.4e+188) && (im <= 3.3e+274))) tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -1.35e+48) tmp = t_0; elseif (im <= 2.45e+31) tmp = cos(re) * -im; elseif ((im <= 1.6e+106) || (~((im <= 5.4e+188)) && (im <= 3.3e+274))) tmp = (0.5 * (re * (im * re))) - im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -1.35e+48], t$95$0, If[LessEqual[im, 2.45e+31], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[Or[LessEqual[im, 1.6e+106], And[N[Not[LessEqual[im, 5.4e+188]], $MachinePrecision], LessEqual[im, 3.3e+274]]], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+48}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2.45 \cdot 10^{+31}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.6 \cdot 10^{+106} \lor \neg \left(im \leq 5.4 \cdot 10^{+188}\right) \land im \leq 3.3 \cdot 10^{+274}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.35000000000000002e48 or 1.5999999999999999e106 < im < 5.4e188 or 3.30000000000000014e274 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 92.4%
mul-1-neg92.4%
unsub-neg92.4%
*-commutative92.4%
associate-*l*92.4%
distribute-lft-out--92.4%
Simplified92.4%
Taylor expanded in re around 0 75.1%
if -1.35000000000000002e48 < im < 2.44999999999999998e31Initial program 18.7%
neg-sub018.7%
Simplified18.7%
Taylor expanded in im around 0 89.5%
mul-1-neg89.5%
*-commutative89.5%
distribute-lft-neg-in89.5%
Simplified89.5%
if 2.44999999999999998e31 < im < 1.5999999999999999e106 or 5.4e188 < im < 3.30000000000000014e274Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 5.0%
mul-1-neg5.0%
*-commutative5.0%
distribute-lft-neg-in5.0%
Simplified5.0%
Taylor expanded in re around 0 50.4%
neg-mul-150.4%
+-commutative50.4%
unsub-neg50.4%
*-commutative50.4%
associate-*l*50.4%
unpow250.4%
Simplified50.4%
Taylor expanded in re around 0 50.4%
unpow250.4%
associate-*l*50.4%
*-commutative50.4%
Simplified50.4%
Final simplification79.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (+ (* im -2.0) (* (pow im 5.0) -0.016666666666666666)))))
(if (<= im -1e+39)
t_0
(if (<= im 29.0)
(* (cos re) (- im))
(if (<= im 5.4e+188)
t_0
(if (<= im 3.5e+274)
(- (* 0.5 (* re (* im re))) im)
(- (* (pow im 3.0) -0.16666666666666666) im)))))))
double code(double re, double im) {
double t_0 = 0.5 * ((im * -2.0) + (pow(im, 5.0) * -0.016666666666666666));
double tmp;
if (im <= -1e+39) {
tmp = t_0;
} else if (im <= 29.0) {
tmp = cos(re) * -im;
} else if (im <= 5.4e+188) {
tmp = t_0;
} else if (im <= 3.5e+274) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = (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.5d0 * ((im * (-2.0d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0)))
if (im <= (-1d+39)) then
tmp = t_0
else if (im <= 29.0d0) then
tmp = cos(re) * -im
else if (im <= 5.4d+188) then
tmp = t_0
else if (im <= 3.5d+274) then
tmp = (0.5d0 * (re * (im * re))) - im
else
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * ((im * -2.0) + (Math.pow(im, 5.0) * -0.016666666666666666));
double tmp;
if (im <= -1e+39) {
tmp = t_0;
} else if (im <= 29.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 5.4e+188) {
tmp = t_0;
} else if (im <= 3.5e+274) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * ((im * -2.0) + (math.pow(im, 5.0) * -0.016666666666666666)) tmp = 0 if im <= -1e+39: tmp = t_0 elif im <= 29.0: tmp = math.cos(re) * -im elif im <= 5.4e+188: tmp = t_0 elif im <= 3.5e+274: tmp = (0.5 * (re * (im * re))) - im else: tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 5.0) * -0.016666666666666666))) tmp = 0.0 if (im <= -1e+39) tmp = t_0; elseif (im <= 29.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 5.4e+188) tmp = t_0; elseif (im <= 3.5e+274) tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); else tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * ((im * -2.0) + ((im ^ 5.0) * -0.016666666666666666)); tmp = 0.0; if (im <= -1e+39) tmp = t_0; elseif (im <= 29.0) tmp = cos(re) * -im; elseif (im <= 5.4e+188) tmp = t_0; elseif (im <= 3.5e+274) tmp = (0.5 * (re * (im * re))) - im; else tmp = ((im ^ 3.0) * -0.16666666666666666) - im; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1e+39], t$95$0, If[LessEqual[im, 29.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 5.4e+188], t$95$0, If[LessEqual[im, 3.5e+274], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\
\mathbf{if}\;im \leq -1 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 29:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 5.4 \cdot 10^{+188}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 3.5 \cdot 10^{+274}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\end{array}
\end{array}
if im < -9.9999999999999994e38 or 29 < im < 5.4e188Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 78.6%
Taylor expanded in im around 0 63.4%
Taylor expanded in im around inf 63.4%
if -9.9999999999999994e38 < im < 29Initial program 15.1%
neg-sub015.1%
Simplified15.1%
Taylor expanded in im around 0 93.3%
mul-1-neg93.3%
*-commutative93.3%
distribute-lft-neg-in93.3%
Simplified93.3%
if 5.4e188 < im < 3.4999999999999996e274Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 6.3%
mul-1-neg6.3%
*-commutative6.3%
distribute-lft-neg-in6.3%
Simplified6.3%
Taylor expanded in re around 0 61.5%
neg-mul-161.5%
+-commutative61.5%
unsub-neg61.5%
*-commutative61.5%
associate-*l*61.5%
unpow261.5%
Simplified61.5%
Taylor expanded in re around 0 61.5%
unpow261.5%
associate-*l*61.5%
*-commutative61.5%
Simplified61.5%
if 3.4999999999999996e274 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Final simplification79.4%
(FPCore (re im)
:precision binary64
(if (<= im -1.8e+48)
(* 0.5 (+ (* im -2.0) (* (pow im 5.0) -0.016666666666666666)))
(if (<= im 2.6e+31)
(* (cos re) (- im))
(* (* (pow im 3.0) -0.16666666666666666) (+ (* -0.5 (* re re)) 1.0)))))
double code(double re, double im) {
double tmp;
if (im <= -1.8e+48) {
tmp = 0.5 * ((im * -2.0) + (pow(im, 5.0) * -0.016666666666666666));
} else if (im <= 2.6e+31) {
tmp = cos(re) * -im;
} else {
tmp = (pow(im, 3.0) * -0.16666666666666666) * ((-0.5 * (re * re)) + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-1.8d+48)) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0)))
else if (im <= 2.6d+31) then
tmp = cos(re) * -im
else
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) * (((-0.5d0) * (re * re)) + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -1.8e+48) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(im, 5.0) * -0.016666666666666666));
} else if (im <= 2.6e+31) {
tmp = Math.cos(re) * -im;
} else {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) * ((-0.5 * (re * re)) + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -1.8e+48: tmp = 0.5 * ((im * -2.0) + (math.pow(im, 5.0) * -0.016666666666666666)) elif im <= 2.6e+31: tmp = math.cos(re) * -im else: tmp = (math.pow(im, 3.0) * -0.16666666666666666) * ((-0.5 * (re * re)) + 1.0) return tmp
function code(re, im) tmp = 0.0 if (im <= -1.8e+48) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 5.0) * -0.016666666666666666))); elseif (im <= 2.6e+31) tmp = Float64(cos(re) * Float64(-im)); else tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) * Float64(Float64(-0.5 * Float64(re * re)) + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -1.8e+48) tmp = 0.5 * ((im * -2.0) + ((im ^ 5.0) * -0.016666666666666666)); elseif (im <= 2.6e+31) tmp = cos(re) * -im; else tmp = ((im ^ 3.0) * -0.16666666666666666) * ((-0.5 * (re * re)) + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -1.8e+48], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.6e+31], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.8 \cdot 10^{+48}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\
\mathbf{elif}\;im \leq 2.6 \cdot 10^{+31}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;\left({im}^{3} \cdot -0.16666666666666666\right) \cdot \left(-0.5 \cdot \left(re \cdot re\right) + 1\right)\\
\end{array}
\end{array}
if im < -1.79999999999999992e48Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 83.3%
Taylor expanded in im around 0 78.4%
Taylor expanded in im around inf 78.4%
if -1.79999999999999992e48 < im < 2.6e31Initial program 18.7%
neg-sub018.7%
Simplified18.7%
Taylor expanded in im around 0 89.5%
mul-1-neg89.5%
*-commutative89.5%
distribute-lft-neg-in89.5%
Simplified89.5%
if 2.6e31 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 74.1%
mul-1-neg74.1%
unsub-neg74.1%
*-commutative74.1%
associate-*l*74.1%
distribute-lft-out--74.1%
Simplified74.1%
Taylor expanded in re around 0 8.8%
*-commutative8.8%
associate-+r-8.8%
associate-*r*8.8%
*-commutative8.8%
*-lft-identity8.8%
distribute-rgt-out68.4%
*-commutative68.4%
unpow268.4%
Simplified68.4%
Taylor expanded in im around inf 68.4%
*-commutative68.4%
Simplified68.4%
Final simplification82.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* re re) (* (* im -2.0) -0.25)))
(t_1 (/ (- (* im im) (* t_0 t_0)) (- (- im) t_0))))
(if (<= im -1.3e+154)
t_1
(if (<= im 3.1e+31)
(* (cos re) (- im))
(if (or (<= im 6.8e+135) (not (<= im 5e+188)))
(- (* 0.5 (* re (* im re))) im)
t_1)))))
double code(double re, double im) {
double t_0 = (re * re) * ((im * -2.0) * -0.25);
double t_1 = ((im * im) - (t_0 * t_0)) / (-im - t_0);
double tmp;
if (im <= -1.3e+154) {
tmp = t_1;
} else if (im <= 3.1e+31) {
tmp = cos(re) * -im;
} else if ((im <= 6.8e+135) || !(im <= 5e+188)) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (re * re) * ((im * (-2.0d0)) * (-0.25d0))
t_1 = ((im * im) - (t_0 * t_0)) / (-im - t_0)
if (im <= (-1.3d+154)) then
tmp = t_1
else if (im <= 3.1d+31) then
tmp = cos(re) * -im
else if ((im <= 6.8d+135) .or. (.not. (im <= 5d+188))) then
tmp = (0.5d0 * (re * (im * re))) - im
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (re * re) * ((im * -2.0) * -0.25);
double t_1 = ((im * im) - (t_0 * t_0)) / (-im - t_0);
double tmp;
if (im <= -1.3e+154) {
tmp = t_1;
} else if (im <= 3.1e+31) {
tmp = Math.cos(re) * -im;
} else if ((im <= 6.8e+135) || !(im <= 5e+188)) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (re * re) * ((im * -2.0) * -0.25) t_1 = ((im * im) - (t_0 * t_0)) / (-im - t_0) tmp = 0 if im <= -1.3e+154: tmp = t_1 elif im <= 3.1e+31: tmp = math.cos(re) * -im elif (im <= 6.8e+135) or not (im <= 5e+188): tmp = (0.5 * (re * (im * re))) - im else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(re * re) * Float64(Float64(im * -2.0) * -0.25)) t_1 = Float64(Float64(Float64(im * im) - Float64(t_0 * t_0)) / Float64(Float64(-im) - t_0)) tmp = 0.0 if (im <= -1.3e+154) tmp = t_1; elseif (im <= 3.1e+31) tmp = Float64(cos(re) * Float64(-im)); elseif ((im <= 6.8e+135) || !(im <= 5e+188)) tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (re * re) * ((im * -2.0) * -0.25); t_1 = ((im * im) - (t_0 * t_0)) / (-im - t_0); tmp = 0.0; if (im <= -1.3e+154) tmp = t_1; elseif (im <= 3.1e+31) tmp = cos(re) * -im; elseif ((im <= 6.8e+135) || ~((im <= 5e+188))) tmp = (0.5 * (re * (im * re))) - im; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * N[(N[(im * -2.0), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(im * im), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[((-im) - t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.3e+154], t$95$1, If[LessEqual[im, 3.1e+31], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[Or[LessEqual[im, 6.8e+135], N[Not[LessEqual[im, 5e+188]], $MachinePrecision]], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot \left(\left(im \cdot -2\right) \cdot -0.25\right)\\
t_1 := \frac{im \cdot im - t_0 \cdot t_0}{\left(-im\right) - t_0}\\
\mathbf{if}\;im \leq -1.3 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 3.1 \cdot 10^{+31}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 6.8 \cdot 10^{+135} \lor \neg \left(im \leq 5 \cdot 10^{+188}\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.29999999999999994e154 or 6.80000000000000019e135 < im < 5.0000000000000001e188Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out74.4%
+-commutative74.4%
*-commutative74.4%
unpow274.4%
associate-*l*74.4%
Simplified74.4%
Taylor expanded in im around 0 20.1%
distribute-lft-in20.1%
flip-+48.8%
Applied egg-rr48.8%
if -1.29999999999999994e154 < im < 3.1000000000000002e31Initial program 27.5%
neg-sub027.5%
Simplified27.5%
Taylor expanded in im around 0 80.2%
mul-1-neg80.2%
*-commutative80.2%
distribute-lft-neg-in80.2%
Simplified80.2%
if 3.1000000000000002e31 < im < 6.80000000000000019e135 or 5.0000000000000001e188 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 5.1%
mul-1-neg5.1%
*-commutative5.1%
distribute-lft-neg-in5.1%
Simplified5.1%
Taylor expanded in re around 0 43.1%
neg-mul-143.1%
+-commutative43.1%
unsub-neg43.1%
*-commutative43.1%
associate-*l*43.1%
unpow243.1%
Simplified43.1%
Taylor expanded in re around 0 43.1%
unpow243.1%
associate-*l*43.1%
*-commutative43.1%
Simplified43.1%
Final simplification66.8%
(FPCore (re im)
:precision binary64
(if (<= re 720000.0)
(- im)
(if (<= re 7e+185)
(* im (* re (* 0.5 re)))
(* (+ 0.5 (* re (* re -0.25))) -3.0))))
double code(double re, double im) {
double tmp;
if (re <= 720000.0) {
tmp = -im;
} else if (re <= 7e+185) {
tmp = im * (re * (0.5 * re));
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 720000.0d0) then
tmp = -im
else if (re <= 7d+185) then
tmp = im * (re * (0.5d0 * re))
else
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * (-3.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 720000.0) {
tmp = -im;
} else if (re <= 7e+185) {
tmp = im * (re * (0.5 * re));
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 720000.0: tmp = -im elif re <= 7e+185: tmp = im * (re * (0.5 * re)) else: tmp = (0.5 + (re * (re * -0.25))) * -3.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 720000.0) tmp = Float64(-im); elseif (re <= 7e+185) tmp = Float64(im * Float64(re * Float64(0.5 * re))); else tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * -3.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 720000.0) tmp = -im; elseif (re <= 7e+185) tmp = im * (re * (0.5 * re)); else tmp = (0.5 + (re * (re * -0.25))) * -3.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 720000.0], (-im), If[LessEqual[re, 7e+185], N[(im * N[(re * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 720000:\\
\;\;\;\;-im\\
\mathbf{elif}\;re \leq 7 \cdot 10^{+185}:\\
\;\;\;\;im \cdot \left(re \cdot \left(0.5 \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\\
\end{array}
\end{array}
if re < 7.2e5Initial program 54.2%
neg-sub054.2%
Simplified54.2%
Taylor expanded in im around 0 52.5%
mul-1-neg52.5%
*-commutative52.5%
distribute-lft-neg-in52.5%
Simplified52.5%
Taylor expanded in re around 0 35.1%
neg-mul-135.1%
Simplified35.1%
if 7.2e5 < re < 7.00000000000000046e185Initial program 60.3%
neg-sub060.3%
Simplified60.3%
Taylor expanded in re around 0 2.5%
*-commutative2.5%
associate-*r*2.5%
distribute-rgt-out35.0%
+-commutative35.0%
*-commutative35.0%
unpow235.0%
associate-*l*35.0%
Simplified35.0%
Taylor expanded in im around 0 28.9%
Taylor expanded in re around inf 28.9%
associate-*r*28.9%
*-commutative28.9%
unpow228.9%
associate-*r*28.9%
Simplified28.9%
if 7.00000000000000046e185 < re Initial program 58.7%
neg-sub058.7%
Simplified58.7%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out27.1%
+-commutative27.1%
*-commutative27.1%
unpow227.1%
associate-*l*27.1%
Simplified27.1%
Applied egg-rr35.4%
Final simplification34.3%
(FPCore (re im) :precision binary64 (if (or (<= im -8500000.0) (not (<= im 2.8e+31))) (* im (* re (* 0.5 re))) (- im)))
double code(double re, double im) {
double tmp;
if ((im <= -8500000.0) || !(im <= 2.8e+31)) {
tmp = im * (re * (0.5 * re));
} else {
tmp = -im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-8500000.0d0)) .or. (.not. (im <= 2.8d+31))) then
tmp = im * (re * (0.5d0 * re))
else
tmp = -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -8500000.0) || !(im <= 2.8e+31)) {
tmp = im * (re * (0.5 * re));
} else {
tmp = -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -8500000.0) or not (im <= 2.8e+31): tmp = im * (re * (0.5 * re)) else: tmp = -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -8500000.0) || !(im <= 2.8e+31)) tmp = Float64(im * Float64(re * Float64(0.5 * re))); else tmp = Float64(-im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -8500000.0) || ~((im <= 2.8e+31))) tmp = im * (re * (0.5 * re)); else tmp = -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -8500000.0], N[Not[LessEqual[im, 2.8e+31]], $MachinePrecision]], N[(im * N[(re * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-im)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -8500000 \lor \neg \left(im \leq 2.8 \cdot 10^{+31}\right):\\
\;\;\;\;im \cdot \left(re \cdot \left(0.5 \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\end{array}
if im < -8.5e6 or 2.80000000000000017e31 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out77.7%
+-commutative77.7%
*-commutative77.7%
unpow277.7%
associate-*l*77.7%
Simplified77.7%
Taylor expanded in im around 0 30.0%
Taylor expanded in re around inf 28.0%
associate-*r*28.0%
*-commutative28.0%
unpow228.0%
associate-*r*28.0%
Simplified28.0%
if -8.5e6 < im < 2.80000000000000017e31Initial program 15.7%
neg-sub015.7%
Simplified15.7%
Taylor expanded in im around 0 92.6%
mul-1-neg92.6%
*-commutative92.6%
distribute-lft-neg-in92.6%
Simplified92.6%
Taylor expanded in re around 0 50.1%
neg-mul-150.1%
Simplified50.1%
Final simplification39.7%
(FPCore (re im) :precision binary64 (if (<= re 7e+185) (- (* 0.5 (* re (* im re))) im) (* (+ 0.5 (* re (* re -0.25))) -3.0)))
double code(double re, double im) {
double tmp;
if (re <= 7e+185) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 7d+185) then
tmp = (0.5d0 * (re * (im * re))) - im
else
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * (-3.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 7e+185) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 7e+185: tmp = (0.5 * (re * (im * re))) - im else: tmp = (0.5 + (re * (re * -0.25))) * -3.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 7e+185) tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); else tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * -3.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 7e+185) tmp = (0.5 * (re * (im * re))) - im; else tmp = (0.5 + (re * (re * -0.25))) * -3.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 7e+185], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 7 \cdot 10^{+185}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\\
\end{array}
\end{array}
if re < 7.00000000000000046e185Initial program 55.2%
neg-sub055.2%
Simplified55.2%
Taylor expanded in im around 0 51.6%
mul-1-neg51.6%
*-commutative51.6%
distribute-lft-neg-in51.6%
Simplified51.6%
Taylor expanded in re around 0 39.3%
neg-mul-139.3%
+-commutative39.3%
unsub-neg39.3%
*-commutative39.3%
associate-*l*39.3%
unpow239.3%
Simplified39.3%
Taylor expanded in re around 0 39.3%
unpow239.3%
associate-*l*39.3%
*-commutative39.3%
Simplified39.3%
if 7.00000000000000046e185 < re Initial program 58.7%
neg-sub058.7%
Simplified58.7%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out27.1%
+-commutative27.1%
*-commutative27.1%
unpow227.1%
associate-*l*27.1%
Simplified27.1%
Applied egg-rr35.4%
Final simplification38.9%
(FPCore (re im) :precision binary64 (- im))
double code(double re, double im) {
return -im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -im
end function
public static double code(double re, double im) {
return -im;
}
def code(re, im): return -im
function code(re, im) return Float64(-im) end
function tmp = code(re, im) tmp = -im; end
code[re_, im_] := (-im)
\begin{array}{l}
\\
-im
\end{array}
Initial program 55.6%
neg-sub055.6%
Simplified55.6%
Taylor expanded in im around 0 51.4%
mul-1-neg51.4%
*-commutative51.4%
distribute-lft-neg-in51.4%
Simplified51.4%
Taylor expanded in re around 0 28.2%
neg-mul-128.2%
Simplified28.2%
Final simplification28.2%
(FPCore (re im)
:precision binary64
(if (< (fabs im) 1.0)
(-
(*
(cos re)
(+
(+ im (* (* (* 0.16666666666666666 im) im) im))
(* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im)))))
double code(double re, double im) {
double tmp;
if (fabs(im) < 1.0) {
tmp = -(cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * cos(re)) * (exp((0.0 - 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 = -(cos(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
else
tmp = (0.5d0 * cos(re)) * (exp((0.0d0 - 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.cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if math.fabs(im) < 1.0: tmp = -(math.cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))) else: tmp = (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (abs(im) < 1.0) tmp = Float64(-Float64(cos(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 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (abs(im) < 1.0) tmp = -(cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))); else tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Cos[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[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\cos 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 \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\\
\end{array}
\end{array}
herbie shell --seed 2023274
(FPCore (re im)
:name "math.sin on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1.0) (- (* (cos re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))