
(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 18 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 -5.0) (not (<= t_0 2e-12)))
(* (* 0.5 (cos re)) t_0)
(+
(* -0.008333333333333333 (* (cos re) (pow im 5.0)))
(* (cos 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 <= -5.0) || !(t_0 <= 2e-12)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = (-0.008333333333333333 * (cos(re) * pow(im, 5.0))) + (cos(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 <= (-5.0d0)) .or. (.not. (t_0 <= 2d-12))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = ((-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))) + (cos(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 <= -5.0) || !(t_0 <= 2e-12)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = (-0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0))) + (Math.cos(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 <= -5.0) or not (t_0 <= 2e-12): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = (-0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0))) + (math.cos(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 <= -5.0) || !(t_0 <= 2e-12)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))) + Float64(cos(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 <= -5.0) || ~((t_0 <= 2e-12))) tmp = (0.5 * cos(re)) * t_0; else tmp = (-0.008333333333333333 * (cos(re) * (im ^ 5.0))) + (cos(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, -5.0], N[Not[LessEqual[t$95$0, 2e-12]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -5 \lor \neg \left(t_0 \leq 2 \cdot 10^{-12}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;-0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right) + \cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -5 or 1.99999999999999996e-12 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -5 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 1.99999999999999996e-12Initial program 9.3%
neg-sub09.3%
Simplified9.3%
Taylor expanded in im around 0 99.9%
associate-+r+99.9%
+-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
fma-def99.9%
*-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
associate-*l*99.9%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in re around inf 99.9%
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 -5.0) (not (<= t_0 2e-12)))
(* 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 <= -5.0) || !(t_0 <= 2e-12)) {
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 <= (-5.0d0)) .or. (.not. (t_0 <= 2d-12))) 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 <= -5.0) || !(t_0 <= 2e-12)) {
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 <= -5.0) or not (t_0 <= 2e-12): 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 <= -5.0) || !(t_0 <= 2e-12)) 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 <= -5.0) || ~((t_0 <= 2e-12))) 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, -5.0], N[Not[LessEqual[t$95$0, 2e-12]], $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 -5 \lor \neg \left(t_0 \leq 2 \cdot 10^{-12}\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)) < -5 or 1.99999999999999996e-12 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -5 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 1.99999999999999996e-12Initial program 9.3%
neg-sub09.3%
Simplified9.3%
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 -0.002) (not (<= t_0 2e-12)))
(* (* 0.5 (cos re)) t_0)
(* (cos 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 <= -0.002) || !(t_0 <= 2e-12)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(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 <= (-0.002d0)) .or. (.not. (t_0 <= 2d-12))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(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 <= -0.002) || !(t_0 <= 2e-12)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(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 <= -0.002) or not (t_0 <= 2e-12): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(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 <= -0.002) || !(t_0 <= 2e-12)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(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 <= -0.002) || ~((t_0 <= 2e-12))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(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, -0.002], N[Not[LessEqual[t$95$0, 2e-12]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[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 -0.002 \lor \neg \left(t_0 \leq 2 \cdot 10^{-12}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -2e-3 or 1.99999999999999996e-12 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -2e-3 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 1.99999999999999996e-12Initial program 8.7%
neg-sub08.7%
Simplified8.7%
Taylor expanded in im around 0 99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
associate-*l*99.9%
distribute-lft-out--99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(if (or (<= im -7.5e+94)
(not (or (<= im -130.0) (and (not (<= im 2.0)) (<= im 5.6e+102)))))
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(* (- (exp (- im)) (exp im)) (+ 0.5 (* re (* re -0.25))))))
double code(double re, double im) {
double tmp;
if ((im <= -7.5e+94) || !((im <= -130.0) || (!(im <= 2.0) && (im <= 5.6e+102)))) {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else {
tmp = (exp(-im) - exp(im)) * (0.5 + (re * (re * -0.25)));
}
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+94)) .or. (.not. (im <= (-130.0d0)) .or. (.not. (im <= 2.0d0)) .and. (im <= 5.6d+102))) then
tmp = cos(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
else
tmp = (exp(-im) - exp(im)) * (0.5d0 + (re * (re * (-0.25d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -7.5e+94) || !((im <= -130.0) || (!(im <= 2.0) && (im <= 5.6e+102)))) {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else {
tmp = (Math.exp(-im) - Math.exp(im)) * (0.5 + (re * (re * -0.25)));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -7.5e+94) or not ((im <= -130.0) or (not (im <= 2.0) and (im <= 5.6e+102))): tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) else: tmp = (math.exp(-im) - math.exp(im)) * (0.5 + (re * (re * -0.25))) return tmp
function code(re, im) tmp = 0.0 if ((im <= -7.5e+94) || !((im <= -130.0) || (!(im <= 2.0) && (im <= 5.6e+102)))) tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); else tmp = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 + Float64(re * Float64(re * -0.25)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -7.5e+94) || ~(((im <= -130.0) || (~((im <= 2.0)) && (im <= 5.6e+102))))) tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); else tmp = (exp(-im) - exp(im)) * (0.5 + (re * (re * -0.25))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -7.5e+94], N[Not[Or[LessEqual[im, -130.0], And[N[Not[LessEqual[im, 2.0]], $MachinePrecision], LessEqual[im, 5.6e+102]]]], $MachinePrecision]], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -7.5 \cdot 10^{+94} \lor \neg \left(im \leq -130 \lor \neg \left(im \leq 2\right) \land im \leq 5.6 \cdot 10^{+102}\right):\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\end{array}
\end{array}
if im < -7.49999999999999978e94 or -130 < im < 2 or 5.60000000000000037e102 < im Initial program 46.3%
neg-sub046.3%
Simplified46.3%
Taylor expanded in im around 0 98.3%
mul-1-neg98.3%
unsub-neg98.3%
*-commutative98.3%
associate-*l*98.3%
distribute-lft-out--98.3%
Simplified98.3%
if -7.49999999999999978e94 < im < -130 or 2 < im < 5.60000000000000037e102Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 3.0%
*-commutative3.0%
associate-*r*3.0%
distribute-rgt-out84.8%
+-commutative84.8%
*-commutative84.8%
unpow284.8%
associate-*l*84.8%
Simplified84.8%
Final simplification96.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* -0.3333333333333333 (* im im))))
(t_1 (* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im))))
(if (<= im -5.5e+102)
t_1
(if (<= im -0.072)
(* 0.5 (- (exp (- im)) (exp im)))
(if (or (<= im 6.5) (not (<= im 5.6e+102)))
t_1
(*
(fma (* re re) -0.25 0.5)
(/
(- (* t_0 t_0) (* (* im -2.0) (* im -2.0)))
(- t_0 (* im -2.0)))))))))
double code(double re, double im) {
double t_0 = im * (-0.3333333333333333 * (im * im));
double t_1 = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
double tmp;
if (im <= -5.5e+102) {
tmp = t_1;
} else if (im <= -0.072) {
tmp = 0.5 * (exp(-im) - exp(im));
} else if ((im <= 6.5) || !(im <= 5.6e+102)) {
tmp = t_1;
} else {
tmp = fma((re * re), -0.25, 0.5) * (((t_0 * t_0) - ((im * -2.0) * (im * -2.0))) / (t_0 - (im * -2.0)));
}
return tmp;
}
function code(re, im) t_0 = Float64(im * Float64(-0.3333333333333333 * Float64(im * im))) t_1 = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)) tmp = 0.0 if (im <= -5.5e+102) tmp = t_1; elseif (im <= -0.072) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); elseif ((im <= 6.5) || !(im <= 5.6e+102)) tmp = t_1; else tmp = Float64(fma(Float64(re * re), -0.25, 0.5) * Float64(Float64(Float64(t_0 * t_0) - Float64(Float64(im * -2.0) * Float64(im * -2.0))) / Float64(t_0 - Float64(im * -2.0)))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.5e+102], t$95$1, If[LessEqual[im, -0.072], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 6.5], N[Not[LessEqual[im, 5.6e+102]], $MachinePrecision]], t$95$1, N[(N[(N[(re * re), $MachinePrecision] * -0.25 + 0.5), $MachinePrecision] * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right)\\
t_1 := \cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.072:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{elif}\;im \leq 6.5 \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re \cdot re, -0.25, 0.5\right) \cdot \frac{t_0 \cdot t_0 - \left(im \cdot -2\right) \cdot \left(im \cdot -2\right)}{t_0 - im \cdot -2}\\
\end{array}
\end{array}
if im < -5.49999999999999981e102 or -0.0719999999999999946 < im < 6.5 or 5.60000000000000037e102 < im Initial program 45.6%
neg-sub045.6%
Simplified45.6%
Taylor expanded in im around 0 99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
associate-*l*99.5%
distribute-lft-out--99.5%
Simplified99.5%
if -5.49999999999999981e102 < im < -0.0719999999999999946Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 69.0%
if 6.5 < im < 5.60000000000000037e102Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 7.1%
*-commutative7.1%
associate-*r*7.1%
distribute-rgt-out85.7%
+-commutative85.7%
*-commutative85.7%
unpow285.7%
associate-*l*85.7%
Simplified85.7%
Taylor expanded in im around 0 32.9%
associate-*r*32.9%
associate-*r*32.9%
distribute-rgt-out32.9%
+-commutative32.9%
*-commutative32.9%
fma-def32.9%
unpow232.9%
unpow332.9%
associate-*r*32.9%
distribute-rgt-out32.9%
Simplified32.9%
distribute-rgt-in32.9%
flip-+72.9%
Applied egg-rr72.9%
Final simplification95.4%
(FPCore (re im)
:precision binary64
(if (<= im -3e+234)
(* -0.16666666666666666 (pow im 3.0))
(if (<= im -2.1e+70)
(*
(fma (* re re) -0.25 0.5)
(* im (+ -2.0 (* -0.3333333333333333 (* im im)))))
(if (or (<= im -0.00105) (not (<= im 2.0)))
(* 0.5 (- (exp (- im)) (exp im)))
(* im (- (cos re)))))))
double code(double re, double im) {
double tmp;
if (im <= -3e+234) {
tmp = -0.16666666666666666 * pow(im, 3.0);
} else if (im <= -2.1e+70) {
tmp = fma((re * re), -0.25, 0.5) * (im * (-2.0 + (-0.3333333333333333 * (im * im))));
} else if ((im <= -0.00105) || !(im <= 2.0)) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = im * -cos(re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= -3e+234) tmp = Float64(-0.16666666666666666 * (im ^ 3.0)); elseif (im <= -2.1e+70) tmp = Float64(fma(Float64(re * re), -0.25, 0.5) * Float64(im * Float64(-2.0 + Float64(-0.3333333333333333 * Float64(im * im))))); elseif ((im <= -0.00105) || !(im <= 2.0)) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
code[re_, im_] := If[LessEqual[im, -3e+234], N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -2.1e+70], N[(N[(N[(re * re), $MachinePrecision] * -0.25 + 0.5), $MachinePrecision] * N[(im * N[(-2.0 + N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -0.00105], N[Not[LessEqual[im, 2.0]], $MachinePrecision]], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3 \cdot 10^{+234}:\\
\;\;\;\;-0.16666666666666666 \cdot {im}^{3}\\
\mathbf{elif}\;im \leq -2.1 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(re \cdot re, -0.25, 0.5\right) \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{elif}\;im \leq -0.00105 \lor \neg \left(im \leq 2\right):\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -2.9999999999999999e234Initial 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 90.0%
Taylor expanded in im around inf 90.0%
*-commutative90.0%
Simplified90.0%
if -2.9999999999999999e234 < im < -2.10000000000000008e70Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out79.4%
+-commutative79.4%
*-commutative79.4%
unpow279.4%
associate-*l*79.4%
Simplified79.4%
Taylor expanded in im around 0 76.6%
associate-*r*76.6%
associate-*r*76.6%
distribute-rgt-out76.6%
+-commutative76.6%
*-commutative76.6%
fma-def76.6%
unpow276.6%
unpow376.6%
associate-*r*76.6%
distribute-rgt-out76.6%
Simplified76.6%
if -2.10000000000000008e70 < im < -0.00104999999999999994 or 2 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 72.7%
if -0.00104999999999999994 < im < 2Initial program 10.0%
neg-sub010.0%
Simplified10.0%
Taylor expanded in im around 0 98.5%
mul-1-neg98.5%
*-commutative98.5%
distribute-lft-neg-in98.5%
Simplified98.5%
Final simplification88.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (fma (* re re) -0.25 0.5))
(t_1 (* -0.16666666666666666 (pow im 3.0)))
(t_2 (* -0.3333333333333333 (* im im)))
(t_3 (* im t_2)))
(if (<= im -7.8e+233)
t_1
(if (<= im -49000000.0)
(* t_0 (* im (+ -2.0 t_2)))
(if (<= im 6.5)
(* im (- (cos re)))
(if (<= im 8.2e+102)
(*
t_0
(/
(- (* t_3 t_3) (* (* im -2.0) (* im -2.0)))
(- t_3 (* im -2.0))))
(- t_1 im)))))))
double code(double re, double im) {
double t_0 = fma((re * re), -0.25, 0.5);
double t_1 = -0.16666666666666666 * pow(im, 3.0);
double t_2 = -0.3333333333333333 * (im * im);
double t_3 = im * t_2;
double tmp;
if (im <= -7.8e+233) {
tmp = t_1;
} else if (im <= -49000000.0) {
tmp = t_0 * (im * (-2.0 + t_2));
} else if (im <= 6.5) {
tmp = im * -cos(re);
} else if (im <= 8.2e+102) {
tmp = t_0 * (((t_3 * t_3) - ((im * -2.0) * (im * -2.0))) / (t_3 - (im * -2.0)));
} else {
tmp = t_1 - im;
}
return tmp;
}
function code(re, im) t_0 = fma(Float64(re * re), -0.25, 0.5) t_1 = Float64(-0.16666666666666666 * (im ^ 3.0)) t_2 = Float64(-0.3333333333333333 * Float64(im * im)) t_3 = Float64(im * t_2) tmp = 0.0 if (im <= -7.8e+233) tmp = t_1; elseif (im <= -49000000.0) tmp = Float64(t_0 * Float64(im * Float64(-2.0 + t_2))); elseif (im <= 6.5) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 8.2e+102) tmp = Float64(t_0 * Float64(Float64(Float64(t_3 * t_3) - Float64(Float64(im * -2.0) * Float64(im * -2.0))) / Float64(t_3 - Float64(im * -2.0)))); else tmp = Float64(t_1 - im); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * -0.25 + 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(im * t$95$2), $MachinePrecision]}, If[LessEqual[im, -7.8e+233], t$95$1, If[LessEqual[im, -49000000.0], N[(t$95$0 * N[(im * N[(-2.0 + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 8.2e+102], N[(t$95$0 * N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(im * -2.0), $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 - N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - im), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(re \cdot re, -0.25, 0.5\right)\\
t_1 := -0.16666666666666666 \cdot {im}^{3}\\
t_2 := -0.3333333333333333 \cdot \left(im \cdot im\right)\\
t_3 := im \cdot t_2\\
\mathbf{if}\;im \leq -7.8 \cdot 10^{+233}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -49000000:\\
\;\;\;\;t_0 \cdot \left(im \cdot \left(-2 + t_2\right)\right)\\
\mathbf{elif}\;im \leq 6.5:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;t_0 \cdot \frac{t_3 \cdot t_3 - \left(im \cdot -2\right) \cdot \left(im \cdot -2\right)}{t_3 - im \cdot -2}\\
\mathbf{else}:\\
\;\;\;\;t_1 - im\\
\end{array}
\end{array}
if im < -7.7999999999999998e233Initial 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 90.0%
Taylor expanded in im around inf 90.0%
*-commutative90.0%
Simplified90.0%
if -7.7999999999999998e233 < im < -4.9e7Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out80.0%
+-commutative80.0%
*-commutative80.0%
unpow280.0%
associate-*l*80.0%
Simplified80.0%
Taylor expanded in im around 0 63.0%
associate-*r*63.0%
associate-*r*63.0%
distribute-rgt-out63.0%
+-commutative63.0%
*-commutative63.0%
fma-def63.0%
unpow263.0%
unpow363.0%
associate-*r*63.0%
distribute-rgt-out63.0%
Simplified63.0%
if -4.9e7 < im < 6.5Initial program 13.3%
neg-sub013.3%
Simplified13.3%
Taylor expanded in im around 0 95.1%
mul-1-neg95.1%
*-commutative95.1%
distribute-lft-neg-in95.1%
Simplified95.1%
if 6.5 < im < 8.1999999999999999e102Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 7.1%
*-commutative7.1%
associate-*r*7.1%
distribute-rgt-out85.7%
+-commutative85.7%
*-commutative85.7%
unpow285.7%
associate-*l*85.7%
Simplified85.7%
Taylor expanded in im around 0 32.9%
associate-*r*32.9%
associate-*r*32.9%
distribute-rgt-out32.9%
+-commutative32.9%
*-commutative32.9%
fma-def32.9%
unpow232.9%
unpow332.9%
associate-*r*32.9%
distribute-rgt-out32.9%
Simplified32.9%
distribute-rgt-in32.9%
flip-+72.9%
Applied egg-rr72.9%
if 8.1999999999999999e102 < 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 71.8%
Final simplification84.3%
(FPCore (re im)
:precision binary64
(if (<= im -1.6e+233)
(* -0.16666666666666666 (pow im 3.0))
(if (or (<= im -110000000.0) (not (<= im 6.5)))
(*
(fma (* re re) -0.25 0.5)
(* im (+ -2.0 (* -0.3333333333333333 (* im im)))))
(* im (- (cos re))))))
double code(double re, double im) {
double tmp;
if (im <= -1.6e+233) {
tmp = -0.16666666666666666 * pow(im, 3.0);
} else if ((im <= -110000000.0) || !(im <= 6.5)) {
tmp = fma((re * re), -0.25, 0.5) * (im * (-2.0 + (-0.3333333333333333 * (im * im))));
} else {
tmp = im * -cos(re);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= -1.6e+233) tmp = Float64(-0.16666666666666666 * (im ^ 3.0)); elseif ((im <= -110000000.0) || !(im <= 6.5)) tmp = Float64(fma(Float64(re * re), -0.25, 0.5) * Float64(im * Float64(-2.0 + Float64(-0.3333333333333333 * Float64(im * im))))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
code[re_, im_] := If[LessEqual[im, -1.6e+233], N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -110000000.0], N[Not[LessEqual[im, 6.5]], $MachinePrecision]], N[(N[(N[(re * re), $MachinePrecision] * -0.25 + 0.5), $MachinePrecision] * N[(im * N[(-2.0 + N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.6 \cdot 10^{+233}:\\
\;\;\;\;-0.16666666666666666 \cdot {im}^{3}\\
\mathbf{elif}\;im \leq -110000000 \lor \neg \left(im \leq 6.5\right):\\
\;\;\;\;\mathsf{fma}\left(re \cdot re, -0.25, 0.5\right) \cdot \left(im \cdot \left(-2 + -0.3333333333333333 \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -1.60000000000000009e233Initial 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 90.0%
Taylor expanded in im around inf 90.0%
*-commutative90.0%
Simplified90.0%
if -1.60000000000000009e233 < im < -1.1e8 or 6.5 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 1.0%
*-commutative1.0%
associate-*r*1.0%
distribute-rgt-out75.5%
+-commutative75.5%
*-commutative75.5%
unpow275.5%
associate-*l*75.5%
Simplified75.5%
Taylor expanded in im around 0 60.2%
associate-*r*60.2%
associate-*r*60.2%
distribute-rgt-out60.2%
+-commutative60.2%
*-commutative60.2%
fma-def60.2%
unpow260.2%
unpow360.2%
associate-*r*60.2%
distribute-rgt-out60.2%
Simplified60.2%
if -1.1e8 < im < 6.5Initial program 13.3%
neg-sub013.3%
Simplified13.3%
Taylor expanded in im around 0 95.1%
mul-1-neg95.1%
*-commutative95.1%
distribute-lft-neg-in95.1%
Simplified95.1%
Final simplification81.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (pow im 3.0))))
(if (<= im -2.8e+122)
t_0
(if (<= im -8.5e+16)
(* -0.25 (* (* im (* re re)) (fma -0.3333333333333333 (* im im) -2.0)))
(if (<= im 3.3e+50) (* im (- (cos re))) (- t_0 im))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * pow(im, 3.0);
double tmp;
if (im <= -2.8e+122) {
tmp = t_0;
} else if (im <= -8.5e+16) {
tmp = -0.25 * ((im * (re * re)) * fma(-0.3333333333333333, (im * im), -2.0));
} else if (im <= 3.3e+50) {
tmp = im * -cos(re);
} else {
tmp = t_0 - im;
}
return tmp;
}
function code(re, im) t_0 = Float64(-0.16666666666666666 * (im ^ 3.0)) tmp = 0.0 if (im <= -2.8e+122) tmp = t_0; elseif (im <= -8.5e+16) tmp = Float64(-0.25 * Float64(Float64(im * Float64(re * re)) * fma(-0.3333333333333333, Float64(im * im), -2.0))); elseif (im <= 3.3e+50) tmp = Float64(im * Float64(-cos(re))); else tmp = Float64(t_0 - im); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.8e+122], t$95$0, If[LessEqual[im, -8.5e+16], N[(-0.25 * N[(N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 * N[(im * im), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.3e+50], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], N[(t$95$0 - im), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot {im}^{3}\\
\mathbf{if}\;im \leq -2.8 \cdot 10^{+122}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -8.5 \cdot 10^{+16}:\\
\;\;\;\;-0.25 \cdot \left(\left(im \cdot \left(re \cdot re\right)\right) \cdot \mathsf{fma}\left(-0.3333333333333333, im \cdot im, -2\right)\right)\\
\mathbf{elif}\;im \leq 3.3 \cdot 10^{+50}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - im\\
\end{array}
\end{array}
if im < -2.8e122Initial 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 77.8%
Taylor expanded in im around inf 77.8%
*-commutative77.8%
Simplified77.8%
if -2.8e122 < im < -8.5e16Initial 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.8%
+-commutative77.8%
*-commutative77.8%
unpow277.8%
associate-*l*77.8%
Simplified77.8%
Taylor expanded in im around 0 46.0%
associate-*r*46.0%
associate-*r*46.0%
distribute-rgt-out46.0%
+-commutative46.0%
*-commutative46.0%
fma-def46.0%
unpow246.0%
unpow346.0%
associate-*r*46.0%
distribute-rgt-out46.0%
Simplified46.0%
Taylor expanded in re around inf 39.4%
*-commutative39.4%
*-commutative39.4%
unpow239.4%
fma-neg39.4%
unpow239.4%
metadata-eval39.4%
Simplified39.4%
if -8.5e16 < im < 3.3e50Initial program 18.0%
neg-sub018.0%
Simplified18.0%
Taylor expanded in im around 0 90.1%
mul-1-neg90.1%
*-commutative90.1%
distribute-lft-neg-in90.1%
Simplified90.1%
if 3.3e50 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 84.2%
mul-1-neg84.2%
unsub-neg84.2%
*-commutative84.2%
associate-*l*84.2%
distribute-lft-out--84.2%
Simplified84.2%
Taylor expanded in re around 0 60.6%
Final simplification79.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (pow im 3.0))))
(if (<= im -9.6e+86)
t_0
(if (<= im 2.25e+52) (* im (- (cos re))) (- t_0 im)))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * pow(im, 3.0);
double tmp;
if (im <= -9.6e+86) {
tmp = t_0;
} else if (im <= 2.25e+52) {
tmp = im * -cos(re);
} else {
tmp = 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) :: tmp
t_0 = (-0.16666666666666666d0) * (im ** 3.0d0)
if (im <= (-9.6d+86)) then
tmp = t_0
else if (im <= 2.25d+52) then
tmp = im * -cos(re)
else
tmp = 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 tmp;
if (im <= -9.6e+86) {
tmp = t_0;
} else if (im <= 2.25e+52) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0 - im;
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * math.pow(im, 3.0) tmp = 0 if im <= -9.6e+86: tmp = t_0 elif im <= 2.25e+52: tmp = im * -math.cos(re) else: tmp = t_0 - im return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * (im ^ 3.0)) tmp = 0.0 if (im <= -9.6e+86) tmp = t_0; elseif (im <= 2.25e+52) tmp = Float64(im * Float64(-cos(re))); else tmp = Float64(t_0 - im); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (im ^ 3.0); tmp = 0.0; if (im <= -9.6e+86) tmp = t_0; elseif (im <= 2.25e+52) tmp = im * -cos(re); else tmp = 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]}, If[LessEqual[im, -9.6e+86], t$95$0, If[LessEqual[im, 2.25e+52], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], N[(t$95$0 - im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot {im}^{3}\\
\mathbf{if}\;im \leq -9.6 \cdot 10^{+86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2.25 \cdot 10^{+52}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - im\\
\end{array}
\end{array}
if im < -9.6000000000000001e86Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 96.4%
mul-1-neg96.4%
unsub-neg96.4%
*-commutative96.4%
associate-*l*96.4%
distribute-lft-out--96.4%
Simplified96.4%
Taylor expanded in re around 0 72.4%
Taylor expanded in im around inf 72.4%
*-commutative72.4%
Simplified72.4%
if -9.6000000000000001e86 < im < 2.25e52Initial program 24.7%
neg-sub024.7%
Simplified24.7%
Taylor expanded in im around 0 83.0%
mul-1-neg83.0%
*-commutative83.0%
distribute-lft-neg-in83.0%
Simplified83.0%
if 2.25e52 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 84.2%
mul-1-neg84.2%
unsub-neg84.2%
*-commutative84.2%
associate-*l*84.2%
distribute-lft-out--84.2%
Simplified84.2%
Taylor expanded in re around 0 60.6%
Final simplification76.8%
(FPCore (re im) :precision binary64 (if (or (<= im -6.8e+16) (not (<= im 6.5))) (- (* re (* re (* im 0.5))) im) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -6.8e+16) || !(im <= 6.5)) {
tmp = (re * (re * (im * 0.5))) - im;
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-6.8d+16)) .or. (.not. (im <= 6.5d0))) then
tmp = (re * (re * (im * 0.5d0))) - im
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -6.8e+16) || !(im <= 6.5)) {
tmp = (re * (re * (im * 0.5))) - im;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -6.8e+16) or not (im <= 6.5): tmp = (re * (re * (im * 0.5))) - im else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -6.8e+16) || !(im <= 6.5)) tmp = Float64(Float64(re * Float64(re * Float64(im * 0.5))) - im); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -6.8e+16) || ~((im <= 6.5))) tmp = (re * (re * (im * 0.5))) - im; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -6.8e+16], N[Not[LessEqual[im, 6.5]], $MachinePrecision]], N[(N[(re * N[(re * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.8 \cdot 10^{+16} \lor \neg \left(im \leq 6.5\right):\\
\;\;\;\;re \cdot \left(re \cdot \left(im \cdot 0.5\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -6.8e16 or 6.5 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-lft-neg-in5.8%
Simplified5.8%
Taylor expanded in re around 0 26.3%
neg-mul-126.3%
+-commutative26.3%
unsub-neg26.3%
*-commutative26.3%
associate-*l*26.3%
unpow226.3%
*-commutative26.3%
associate-*l*26.3%
*-commutative26.3%
Simplified26.3%
if -6.8e16 < im < 6.5Initial program 14.5%
neg-sub014.5%
Simplified14.5%
Taylor expanded in im around 0 93.8%
mul-1-neg93.8%
*-commutative93.8%
distribute-lft-neg-in93.8%
Simplified93.8%
Final simplification63.2%
(FPCore (re im) :precision binary64 (if (or (<= im -6.5e+86) (not (<= im 8.4e+43))) (* -0.16666666666666666 (pow im 3.0)) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -6.5e+86) || !(im <= 8.4e+43)) {
tmp = -0.16666666666666666 * pow(im, 3.0);
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-6.5d+86)) .or. (.not. (im <= 8.4d+43))) then
tmp = (-0.16666666666666666d0) * (im ** 3.0d0)
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -6.5e+86) || !(im <= 8.4e+43)) {
tmp = -0.16666666666666666 * Math.pow(im, 3.0);
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -6.5e+86) or not (im <= 8.4e+43): tmp = -0.16666666666666666 * math.pow(im, 3.0) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -6.5e+86) || !(im <= 8.4e+43)) tmp = Float64(-0.16666666666666666 * (im ^ 3.0)); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -6.5e+86) || ~((im <= 8.4e+43))) tmp = -0.16666666666666666 * (im ^ 3.0); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -6.5e+86], N[Not[LessEqual[im, 8.4e+43]], $MachinePrecision]], N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.5 \cdot 10^{+86} \lor \neg \left(im \leq 8.4 \cdot 10^{+43}\right):\\
\;\;\;\;-0.16666666666666666 \cdot {im}^{3}\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -6.49999999999999996e86 or 8.40000000000000007e43 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 90.4%
mul-1-neg90.4%
unsub-neg90.4%
*-commutative90.4%
associate-*l*90.4%
distribute-lft-out--90.4%
Simplified90.4%
Taylor expanded in re around 0 66.7%
Taylor expanded in im around inf 66.7%
*-commutative66.7%
Simplified66.7%
if -6.49999999999999996e86 < im < 8.40000000000000007e43Initial program 24.7%
neg-sub024.7%
Simplified24.7%
Taylor expanded in im around 0 83.0%
mul-1-neg83.0%
*-commutative83.0%
distribute-lft-neg-in83.0%
Simplified83.0%
Final simplification76.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re -0.25))))
(if (<= re 1.05e+80)
(- (* re (* re (* im 0.5))) im)
(if (<= re 3.1e+153)
(/
(- 182.25 (* 729.0 (* t_0 t_0)))
(- 13.5 (* (* re -0.25) (* re 27.0))))
(* (+ 0.5 t_0) -3.0)))))
double code(double re, double im) {
double t_0 = re * (re * -0.25);
double tmp;
if (re <= 1.05e+80) {
tmp = (re * (re * (im * 0.5))) - im;
} else if (re <= 3.1e+153) {
tmp = (182.25 - (729.0 * (t_0 * t_0))) / (13.5 - ((re * -0.25) * (re * 27.0)));
} else {
tmp = (0.5 + t_0) * -3.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = re * (re * (-0.25d0))
if (re <= 1.05d+80) then
tmp = (re * (re * (im * 0.5d0))) - im
else if (re <= 3.1d+153) then
tmp = (182.25d0 - (729.0d0 * (t_0 * t_0))) / (13.5d0 - ((re * (-0.25d0)) * (re * 27.0d0)))
else
tmp = (0.5d0 + t_0) * (-3.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * -0.25);
double tmp;
if (re <= 1.05e+80) {
tmp = (re * (re * (im * 0.5))) - im;
} else if (re <= 3.1e+153) {
tmp = (182.25 - (729.0 * (t_0 * t_0))) / (13.5 - ((re * -0.25) * (re * 27.0)));
} else {
tmp = (0.5 + t_0) * -3.0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * -0.25) tmp = 0 if re <= 1.05e+80: tmp = (re * (re * (im * 0.5))) - im elif re <= 3.1e+153: tmp = (182.25 - (729.0 * (t_0 * t_0))) / (13.5 - ((re * -0.25) * (re * 27.0))) else: tmp = (0.5 + t_0) * -3.0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * -0.25)) tmp = 0.0 if (re <= 1.05e+80) tmp = Float64(Float64(re * Float64(re * Float64(im * 0.5))) - im); elseif (re <= 3.1e+153) tmp = Float64(Float64(182.25 - Float64(729.0 * Float64(t_0 * t_0))) / Float64(13.5 - Float64(Float64(re * -0.25) * Float64(re * 27.0)))); else tmp = Float64(Float64(0.5 + t_0) * -3.0); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * -0.25); tmp = 0.0; if (re <= 1.05e+80) tmp = (re * (re * (im * 0.5))) - im; elseif (re <= 3.1e+153) tmp = (182.25 - (729.0 * (t_0 * t_0))) / (13.5 - ((re * -0.25) * (re * 27.0))); else tmp = (0.5 + t_0) * -3.0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, 1.05e+80], N[(N[(re * N[(re * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[re, 3.1e+153], N[(N[(182.25 - N[(729.0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(13.5 - N[(N[(re * -0.25), $MachinePrecision] * N[(re * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + t$95$0), $MachinePrecision] * -3.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot -0.25\right)\\
\mathbf{if}\;re \leq 1.05 \cdot 10^{+80}:\\
\;\;\;\;re \cdot \left(re \cdot \left(im \cdot 0.5\right)\right) - im\\
\mathbf{elif}\;re \leq 3.1 \cdot 10^{+153}:\\
\;\;\;\;\frac{182.25 - 729 \cdot \left(t_0 \cdot t_0\right)}{13.5 - \left(re \cdot -0.25\right) \cdot \left(re \cdot 27\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + t_0\right) \cdot -3\\
\end{array}
\end{array}
if re < 1.05000000000000001e80Initial program 54.3%
neg-sub054.3%
Simplified54.3%
Taylor expanded in im around 0 52.7%
mul-1-neg52.7%
*-commutative52.7%
distribute-lft-neg-in52.7%
Simplified52.7%
Taylor expanded in re around 0 40.8%
neg-mul-140.8%
+-commutative40.8%
unsub-neg40.8%
*-commutative40.8%
associate-*l*40.8%
unpow240.8%
*-commutative40.8%
associate-*l*40.8%
*-commutative40.8%
Simplified40.8%
if 1.05000000000000001e80 < re < 3.1e153Initial program 39.0%
neg-sub039.0%
Simplified39.0%
Taylor expanded in re around 0 3.9%
*-commutative3.9%
associate-*r*3.9%
distribute-rgt-out17.2%
+-commutative17.2%
*-commutative17.2%
unpow217.2%
associate-*l*17.2%
Simplified17.2%
Applied egg-rr2.8%
distribute-lft-in2.8%
flip-+21.4%
metadata-eval21.4%
metadata-eval21.4%
metadata-eval21.4%
metadata-eval21.4%
Applied egg-rr21.4%
*-commutative21.4%
*-commutative21.4%
*-commutative21.4%
swap-sqr21.4%
*-commutative21.4%
metadata-eval21.4%
*-commutative21.4%
associate-*r*21.4%
Simplified21.4%
if 3.1e153 < re Initial program 53.1%
neg-sub053.1%
Simplified53.1%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out27.9%
+-commutative27.9%
*-commutative27.9%
unpow227.9%
associate-*l*27.9%
Simplified27.9%
Applied egg-rr31.8%
Final simplification38.4%
(FPCore (re im) :precision binary64 (if (<= re 5.5e+162) (- im) (* (+ 0.5 (* re (* re -0.25))) -3.0)))
double code(double re, double im) {
double tmp;
if (re <= 5.5e+162) {
tmp = -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 <= 5.5d+162) then
tmp = -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 <= 5.5e+162) {
tmp = -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5.5e+162: tmp = -im else: tmp = (0.5 + (re * (re * -0.25))) * -3.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 5.5e+162) tmp = Float64(-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 <= 5.5e+162) tmp = -im; else tmp = (0.5 + (re * (re * -0.25))) * -3.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5.5e+162], (-im), 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 5.5 \cdot 10^{+162}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\\
\end{array}
\end{array}
if re < 5.49999999999999966e162Initial program 53.4%
neg-sub053.4%
Simplified53.4%
Taylor expanded in im around 0 53.7%
mul-1-neg53.7%
*-commutative53.7%
distribute-lft-neg-in53.7%
Simplified53.7%
Taylor expanded in re around 0 33.3%
neg-mul-133.3%
Simplified33.3%
if 5.49999999999999966e162 < re Initial program 51.9%
neg-sub051.9%
Simplified51.9%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out25.9%
+-commutative25.9%
*-commutative25.9%
unpow225.9%
associate-*l*25.9%
Simplified25.9%
Applied egg-rr36.3%
Final simplification33.6%
(FPCore (re im) :precision binary64 (if (<= re 3.9e+158) (- (* re (* re (* im 0.5))) im) (* (+ 0.5 (* re (* re -0.25))) -3.0)))
double code(double re, double im) {
double tmp;
if (re <= 3.9e+158) {
tmp = (re * (re * (im * 0.5))) - 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 <= 3.9d+158) then
tmp = (re * (re * (im * 0.5d0))) - 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 <= 3.9e+158) {
tmp = (re * (re * (im * 0.5))) - im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 3.9e+158: tmp = (re * (re * (im * 0.5))) - im else: tmp = (0.5 + (re * (re * -0.25))) * -3.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 3.9e+158) tmp = Float64(Float64(re * Float64(re * Float64(im * 0.5))) - 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 <= 3.9e+158) tmp = (re * (re * (im * 0.5))) - im; else tmp = (0.5 + (re * (re * -0.25))) * -3.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 3.9e+158], N[(N[(re * N[(re * N[(im * 0.5), $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 3.9 \cdot 10^{+158}:\\
\;\;\;\;re \cdot \left(re \cdot \left(im \cdot 0.5\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 < 3.9e158Initial program 53.5%
neg-sub053.5%
Simplified53.5%
Taylor expanded in im around 0 53.5%
mul-1-neg53.5%
*-commutative53.5%
distribute-lft-neg-in53.5%
Simplified53.5%
Taylor expanded in re around 0 39.0%
neg-mul-139.0%
+-commutative39.0%
unsub-neg39.0%
*-commutative39.0%
associate-*l*39.0%
unpow239.0%
*-commutative39.0%
associate-*l*39.0%
*-commutative39.0%
Simplified39.0%
if 3.9e158 < re Initial program 51.7%
neg-sub051.7%
Simplified51.7%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out24.4%
+-commutative24.4%
*-commutative24.4%
unpow224.4%
associate-*l*24.4%
Simplified24.4%
Applied egg-rr34.2%
Final simplification38.4%
(FPCore (re im) :precision binary64 (if (<= re 2.8e+152) (- im) (* re (* re -6.75))))
double code(double re, double im) {
double tmp;
if (re <= 2.8e+152) {
tmp = -im;
} else {
tmp = re * (re * -6.75);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.8d+152) then
tmp = -im
else
tmp = re * (re * (-6.75d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.8e+152) {
tmp = -im;
} else {
tmp = re * (re * -6.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.8e+152: tmp = -im else: tmp = re * (re * -6.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.8e+152) tmp = Float64(-im); else tmp = Float64(re * Float64(re * -6.75)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.8e+152) tmp = -im; else tmp = re * (re * -6.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.8e+152], (-im), N[(re * N[(re * -6.75), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.8 \cdot 10^{+152}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot -6.75\right)\\
\end{array}
\end{array}
if re < 2.8000000000000002e152Initial program 53.3%
neg-sub053.3%
Simplified53.3%
Taylor expanded in im around 0 53.8%
mul-1-neg53.8%
*-commutative53.8%
distribute-lft-neg-in53.8%
Simplified53.8%
Taylor expanded in re around 0 33.8%
neg-mul-133.8%
Simplified33.8%
if 2.8000000000000002e152 < re Initial program 53.1%
neg-sub053.1%
Simplified53.1%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out27.9%
+-commutative27.9%
*-commutative27.9%
unpow227.9%
associate-*l*27.9%
Simplified27.9%
Applied egg-rr12.1%
Taylor expanded in re around inf 12.1%
*-commutative12.1%
unpow212.1%
Simplified12.1%
Taylor expanded in re around 0 12.1%
*-commutative12.1%
unpow212.1%
associate-*r*12.1%
Simplified12.1%
Final simplification30.7%
(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 53.2%
neg-sub053.2%
Simplified53.2%
Taylor expanded in im around 0 53.9%
mul-1-neg53.9%
*-commutative53.9%
distribute-lft-neg-in53.9%
Simplified53.9%
Taylor expanded in re around 0 30.2%
neg-mul-130.2%
Simplified30.2%
Final simplification30.2%
(FPCore (re im) :precision binary64 13.5)
double code(double re, double im) {
return 13.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 13.5d0
end function
public static double code(double re, double im) {
return 13.5;
}
def code(re, im): return 13.5
function code(re, im) return 13.5 end
function tmp = code(re, im) tmp = 13.5; end
code[re_, im_] := 13.5
\begin{array}{l}
\\
13.5
\end{array}
Initial program 53.2%
neg-sub053.2%
Simplified53.2%
Taylor expanded in re around 0 3.4%
*-commutative3.4%
associate-*r*3.4%
distribute-rgt-out37.8%
+-commutative37.8%
*-commutative37.8%
unpow237.8%
associate-*l*37.8%
Simplified37.8%
Applied egg-rr6.8%
Taylor expanded in re around 0 2.9%
Final simplification2.9%
(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 2023279
(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))))