
(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 14 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 (- INFINITY)) (not (<= t_0 5e-14)))
(* (* 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 <= -((double) INFINITY)) || !(t_0 <= 5e-14)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 5e-14)) {
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 <= -math.inf) or not (t_0 <= 5e-14): 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 <= Float64(-Inf)) || !(t_0 <= 5e-14)) 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 <= -Inf) || ~((t_0 <= 5e-14))) 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, (-Infinity)], N[Not[LessEqual[t$95$0, 5e-14]], $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 -\infty \lor \neg \left(t_0 \leq 5 \cdot 10^{-14}\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)) < -inf.0 or 5.0000000000000002e-14 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 5.0000000000000002e-14Initial program 7.1%
sub0-neg7.1%
Simplified7.1%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(if (or (<= im -1.25e+173)
(not (or (<= im -0.05) (and (not (<= im 0.122)) (<= im 5.5e+102)))))
(* (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 <= -1.25e+173) || !((im <= -0.05) || (!(im <= 0.122) && (im <= 5.5e+102)))) {
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 <= (-1.25d+173)) .or. (.not. (im <= (-0.05d0)) .or. (.not. (im <= 0.122d0)) .and. (im <= 5.5d+102))) 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 <= -1.25e+173) || !((im <= -0.05) || (!(im <= 0.122) && (im <= 5.5e+102)))) {
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 <= -1.25e+173) or not ((im <= -0.05) or (not (im <= 0.122) and (im <= 5.5e+102))): 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 <= -1.25e+173) || !((im <= -0.05) || (!(im <= 0.122) && (im <= 5.5e+102)))) 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 <= -1.25e+173) || ~(((im <= -0.05) || (~((im <= 0.122)) && (im <= 5.5e+102))))) 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, -1.25e+173], N[Not[Or[LessEqual[im, -0.05], And[N[Not[LessEqual[im, 0.122]], $MachinePrecision], LessEqual[im, 5.5e+102]]]], $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 -1.25 \cdot 10^{+173} \lor \neg \left(im \leq -0.05 \lor \neg \left(im \leq 0.122\right) \land im \leq 5.5 \cdot 10^{+102}\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 < -1.25000000000000009e173 or -0.050000000000000003 < im < 0.122 or 5.49999999999999981e102 < im Initial program 37.6%
sub0-neg37.6%
Simplified37.6%
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%
if -1.25000000000000009e173 < im < -0.050000000000000003 or 0.122 < im < 5.49999999999999981e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 81.3%
Final simplification95.6%
(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 -5.7e+102)
t_1
(if (<= im -220.0)
(* t_0 (+ 0.5 (* re (* re -0.25))))
(if (or (<= im 0.1) (not (<= im 5.5e+102))) 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 <= -5.7e+102) {
tmp = t_1;
} else if (im <= -220.0) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if ((im <= 0.1) || !(im <= 5.5e+102)) {
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 <= (-5.7d+102)) then
tmp = t_1
else if (im <= (-220.0d0)) then
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
else if ((im <= 0.1d0) .or. (.not. (im <= 5.5d+102))) 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 <= -5.7e+102) {
tmp = t_1;
} else if (im <= -220.0) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if ((im <= 0.1) || !(im <= 5.5e+102)) {
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 <= -5.7e+102: tmp = t_1 elif im <= -220.0: tmp = t_0 * (0.5 + (re * (re * -0.25))) elif (im <= 0.1) or not (im <= 5.5e+102): 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 <= -5.7e+102) tmp = t_1; elseif (im <= -220.0) tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif ((im <= 0.1) || !(im <= 5.5e+102)) 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 <= -5.7e+102) tmp = t_1; elseif (im <= -220.0) tmp = t_0 * (0.5 + (re * (re * -0.25))); elseif ((im <= 0.1) || ~((im <= 5.5e+102))) 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, -5.7e+102], t$95$1, If[LessEqual[im, -220.0], N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 0.1], N[Not[LessEqual[im, 5.5e+102]], $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 -5.7 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -220:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq 0.1 \lor \neg \left(im \leq 5.5 \cdot 10^{+102}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot t_0\\
\end{array}
\end{array}
if im < -5.6999999999999999e102 or -220 < im < 0.10000000000000001 or 5.49999999999999981e102 < im Initial program 42.5%
sub0-neg42.5%
Simplified42.5%
Taylor expanded in im around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
associate-*l*99.4%
distribute-lft-out--99.4%
Simplified99.4%
if -5.6999999999999999e102 < im < -220Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out77.3%
+-commutative77.3%
*-commutative77.3%
unpow277.3%
associate-*l*77.3%
Simplified77.3%
if 0.10000000000000001 < im < 5.49999999999999981e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 84.2%
Final simplification96.4%
(FPCore (re im)
:precision binary64
(if (<= im -3.3e+210)
(* (+ (* -0.5 (* re re)) 1.0) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (or (<= im -0.023) (not (<= im 9e-5)))
(* 0.5 (- (exp (- im)) (exp im)))
(* im (- (cos re))))))
double code(double re, double im) {
double tmp;
if (im <= -3.3e+210) {
tmp = ((-0.5 * (re * re)) + 1.0) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if ((im <= -0.023) || !(im <= 9e-5)) {
tmp = 0.5 * (exp(-im) - exp(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 <= (-3.3d+210)) then
tmp = (((-0.5d0) * (re * re)) + 1.0d0) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if ((im <= (-0.023d0)) .or. (.not. (im <= 9d-5))) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.3e+210) {
tmp = ((-0.5 * (re * re)) + 1.0) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if ((im <= -0.023) || !(im <= 9e-5)) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.3e+210: tmp = ((-0.5 * (re * re)) + 1.0) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif (im <= -0.023) or not (im <= 9e-5): tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if (im <= -3.3e+210) tmp = Float64(Float64(Float64(-0.5 * Float64(re * re)) + 1.0) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif ((im <= -0.023) || !(im <= 9e-5)) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.3e+210) tmp = ((-0.5 * (re * re)) + 1.0) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif ((im <= -0.023) || ~((im <= 9e-5))) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.3e+210], N[(N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -0.023], N[Not[LessEqual[im, 9e-5]], $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.3 \cdot 10^{+210}:\\
\;\;\;\;\left(-0.5 \cdot \left(re \cdot re\right) + 1\right) \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq -0.023 \lor \neg \left(im \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -3.29999999999999995e210Initial program 100.0%
sub0-neg100.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 0.0%
associate--l+0.0%
associate-*r*0.0%
distribute-lft1-in92.9%
unpow292.9%
Simplified92.9%
if -3.29999999999999995e210 < im < -0.023 or 9.00000000000000057e-5 < im Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in re around 0 78.2%
if -0.023 < im < 9.00000000000000057e-5Initial program 6.5%
sub0-neg6.5%
Simplified6.5%
Taylor expanded in im around 0 99.5%
mul-1-neg99.5%
*-commutative99.5%
distribute-lft-neg-in99.5%
Simplified99.5%
Final simplification90.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) -0.16666666666666666))
(t_1 (* (+ (* -0.5 (* re re)) 1.0) (- t_0 im))))
(if (<= im -5e+214)
t_1
(if (<= im -2.15e+96)
t_0
(if (or (<= im -6.4e+17) (not (<= im 9e-5)))
t_1
(* im (- (cos re))))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * -0.16666666666666666;
double t_1 = ((-0.5 * (re * re)) + 1.0) * (t_0 - im);
double tmp;
if (im <= -5e+214) {
tmp = t_1;
} else if (im <= -2.15e+96) {
tmp = t_0;
} else if ((im <= -6.4e+17) || !(im <= 9e-5)) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (im ** 3.0d0) * (-0.16666666666666666d0)
t_1 = (((-0.5d0) * (re * re)) + 1.0d0) * (t_0 - im)
if (im <= (-5d+214)) then
tmp = t_1
else if (im <= (-2.15d+96)) then
tmp = t_0
else if ((im <= (-6.4d+17)) .or. (.not. (im <= 9d-5))) then
tmp = t_1
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 3.0) * -0.16666666666666666;
double t_1 = ((-0.5 * (re * re)) + 1.0) * (t_0 - im);
double tmp;
if (im <= -5e+214) {
tmp = t_1;
} else if (im <= -2.15e+96) {
tmp = t_0;
} else if ((im <= -6.4e+17) || !(im <= 9e-5)) {
tmp = t_1;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * -0.16666666666666666 t_1 = ((-0.5 * (re * re)) + 1.0) * (t_0 - im) tmp = 0 if im <= -5e+214: tmp = t_1 elif im <= -2.15e+96: tmp = t_0 elif (im <= -6.4e+17) or not (im <= 9e-5): tmp = t_1 else: tmp = im * -math.cos(re) return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * -0.16666666666666666) t_1 = Float64(Float64(Float64(-0.5 * Float64(re * re)) + 1.0) * Float64(t_0 - im)) tmp = 0.0 if (im <= -5e+214) tmp = t_1; elseif (im <= -2.15e+96) tmp = t_0; elseif ((im <= -6.4e+17) || !(im <= 9e-5)) tmp = t_1; else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * -0.16666666666666666; t_1 = ((-0.5 * (re * re)) + 1.0) * (t_0 - im); tmp = 0.0; if (im <= -5e+214) tmp = t_1; elseif (im <= -2.15e+96) tmp = t_0; elseif ((im <= -6.4e+17) || ~((im <= 9e-5))) tmp = t_1; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(t$95$0 - im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5e+214], t$95$1, If[LessEqual[im, -2.15e+96], t$95$0, If[Or[LessEqual[im, -6.4e+17], N[Not[LessEqual[im, 9e-5]], $MachinePrecision]], t$95$1, N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666\\
t_1 := \left(-0.5 \cdot \left(re \cdot re\right) + 1\right) \cdot \left(t_0 - im\right)\\
\mathbf{if}\;im \leq -5 \cdot 10^{+214}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -2.15 \cdot 10^{+96}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -6.4 \cdot 10^{+17} \lor \neg \left(im \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -4.99999999999999953e214 or -2.15000000000000001e96 < im < -6.4e17 or 9.00000000000000057e-5 < im Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in im around 0 65.0%
mul-1-neg65.0%
unsub-neg65.0%
*-commutative65.0%
associate-*l*65.0%
distribute-lft-out--65.0%
Simplified65.0%
Taylor expanded in re around 0 11.3%
associate--l+11.3%
associate-*r*11.3%
distribute-lft1-in63.0%
unpow263.0%
Simplified63.0%
if -4.99999999999999953e214 < im < -2.15000000000000001e96Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
mul-1-neg88.1%
unsub-neg88.1%
*-commutative88.1%
associate-*l*88.1%
distribute-lft-out--88.1%
Simplified88.1%
Taylor expanded in re around 0 81.5%
Taylor expanded in im around inf 81.5%
if -6.4e17 < im < 9.00000000000000057e-5Initial program 9.9%
sub0-neg9.9%
Simplified9.9%
Taylor expanded in im around 0 96.0%
mul-1-neg96.0%
*-commutative96.0%
distribute-lft-neg-in96.0%
Simplified96.0%
Final simplification82.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) -0.16666666666666666))
(t_1 (- (* (* re re) (* im 0.5)) im)))
(if (<= im -2.4e+94)
t_0
(if (<= im -6.4e+17)
t_1
(if (<= im 7.6e+15) (- im) (if (<= im 1.7e+106) t_1 t_0))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * -0.16666666666666666;
double t_1 = ((re * re) * (im * 0.5)) - im;
double tmp;
if (im <= -2.4e+94) {
tmp = t_0;
} else if (im <= -6.4e+17) {
tmp = t_1;
} else if (im <= 7.6e+15) {
tmp = -im;
} else if (im <= 1.7e+106) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (im ** 3.0d0) * (-0.16666666666666666d0)
t_1 = ((re * re) * (im * 0.5d0)) - im
if (im <= (-2.4d+94)) then
tmp = t_0
else if (im <= (-6.4d+17)) then
tmp = t_1
else if (im <= 7.6d+15) then
tmp = -im
else if (im <= 1.7d+106) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 3.0) * -0.16666666666666666;
double t_1 = ((re * re) * (im * 0.5)) - im;
double tmp;
if (im <= -2.4e+94) {
tmp = t_0;
} else if (im <= -6.4e+17) {
tmp = t_1;
} else if (im <= 7.6e+15) {
tmp = -im;
} else if (im <= 1.7e+106) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * -0.16666666666666666 t_1 = ((re * re) * (im * 0.5)) - im tmp = 0 if im <= -2.4e+94: tmp = t_0 elif im <= -6.4e+17: tmp = t_1 elif im <= 7.6e+15: tmp = -im elif im <= 1.7e+106: tmp = t_1 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * -0.16666666666666666) t_1 = Float64(Float64(Float64(re * re) * Float64(im * 0.5)) - im) tmp = 0.0 if (im <= -2.4e+94) tmp = t_0; elseif (im <= -6.4e+17) tmp = t_1; elseif (im <= 7.6e+15) tmp = Float64(-im); elseif (im <= 1.7e+106) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * -0.16666666666666666; t_1 = ((re * re) * (im * 0.5)) - im; tmp = 0.0; if (im <= -2.4e+94) tmp = t_0; elseif (im <= -6.4e+17) tmp = t_1; elseif (im <= 7.6e+15) tmp = -im; elseif (im <= 1.7e+106) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -2.4e+94], t$95$0, If[LessEqual[im, -6.4e+17], t$95$1, If[LessEqual[im, 7.6e+15], (-im), If[LessEqual[im, 1.7e+106], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666\\
t_1 := \left(re \cdot re\right) \cdot \left(im \cdot 0.5\right) - im\\
\mathbf{if}\;im \leq -2.4 \cdot 10^{+94}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -6.4 \cdot 10^{+17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 7.6 \cdot 10^{+15}:\\
\;\;\;\;-im\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+106}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.39999999999999983e94 or 1.69999999999999997e106 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 95.8%
mul-1-neg95.8%
unsub-neg95.8%
*-commutative95.8%
associate-*l*95.8%
distribute-lft-out--95.8%
Simplified95.8%
Taylor expanded in re around 0 73.1%
Taylor expanded in im around inf 73.1%
if -2.39999999999999983e94 < im < -6.4e17 or 7.6e15 < im < 1.69999999999999997e106Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.7%
mul-1-neg3.7%
*-commutative3.7%
distribute-lft-neg-in3.7%
Simplified3.7%
Taylor expanded in re around 0 29.0%
neg-mul-129.0%
+-commutative29.0%
unsub-neg29.0%
*-commutative29.0%
associate-*l*29.0%
unpow229.0%
Simplified29.0%
if -6.4e17 < im < 7.6e15Initial program 13.0%
sub0-neg13.0%
Simplified13.0%
Taylor expanded in im around 0 93.7%
mul-1-neg93.7%
unsub-neg93.7%
*-commutative93.7%
associate-*l*93.7%
distribute-lft-out--93.7%
Simplified93.7%
Taylor expanded in re around 0 46.3%
Taylor expanded in im around 0 46.0%
neg-mul-146.0%
Simplified46.0%
Final simplification52.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) -0.16666666666666666)))
(if (<= im -1.9e+96)
t_0
(if (<= im -6.4e+17)
(- (* (* re re) (* im 0.5)) im)
(if (<= im 4.7e-5) (* im (- (cos re))) (- t_0 im))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -1.9e+96) {
tmp = t_0;
} else if (im <= -6.4e+17) {
tmp = ((re * re) * (im * 0.5)) - im;
} else if (im <= 4.7e-5) {
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 = (im ** 3.0d0) * (-0.16666666666666666d0)
if (im <= (-1.9d+96)) then
tmp = t_0
else if (im <= (-6.4d+17)) then
tmp = ((re * re) * (im * 0.5d0)) - im
else if (im <= 4.7d-5) 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 = Math.pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -1.9e+96) {
tmp = t_0;
} else if (im <= -6.4e+17) {
tmp = ((re * re) * (im * 0.5)) - im;
} else if (im <= 4.7e-5) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0 - im;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * -0.16666666666666666 tmp = 0 if im <= -1.9e+96: tmp = t_0 elif im <= -6.4e+17: tmp = ((re * re) * (im * 0.5)) - im elif im <= 4.7e-5: tmp = im * -math.cos(re) else: tmp = t_0 - im return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * -0.16666666666666666) tmp = 0.0 if (im <= -1.9e+96) tmp = t_0; elseif (im <= -6.4e+17) tmp = Float64(Float64(Float64(re * re) * Float64(im * 0.5)) - im); elseif (im <= 4.7e-5) tmp = Float64(im * Float64(-cos(re))); else tmp = Float64(t_0 - im); end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * -0.16666666666666666; tmp = 0.0; if (im <= -1.9e+96) tmp = t_0; elseif (im <= -6.4e+17) tmp = ((re * re) * (im * 0.5)) - im; elseif (im <= 4.7e-5) tmp = im * -cos(re); else tmp = t_0 - im; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, If[LessEqual[im, -1.9e+96], t$95$0, If[LessEqual[im, -6.4e+17], N[(N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[im, 4.7e-5], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], N[(t$95$0 - im), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666\\
\mathbf{if}\;im \leq -1.9 \cdot 10^{+96}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -6.4 \cdot 10^{+17}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right) - im\\
\mathbf{elif}\;im \leq 4.7 \cdot 10^{-5}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - im\\
\end{array}
\end{array}
if im < -1.9000000000000001e96Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 91.9%
mul-1-neg91.9%
unsub-neg91.9%
*-commutative91.9%
associate-*l*91.9%
distribute-lft-out--91.9%
Simplified91.9%
Taylor expanded in re around 0 71.5%
Taylor expanded in im around inf 71.5%
if -1.9000000000000001e96 < im < -6.4e17Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.6%
mul-1-neg3.6%
*-commutative3.6%
distribute-lft-neg-in3.6%
Simplified3.6%
Taylor expanded in re around 0 37.3%
neg-mul-137.3%
+-commutative37.3%
unsub-neg37.3%
*-commutative37.3%
associate-*l*37.3%
unpow237.3%
Simplified37.3%
if -6.4e17 < im < 4.69999999999999972e-5Initial program 9.9%
sub0-neg9.9%
Simplified9.9%
Taylor expanded in im around 0 96.0%
mul-1-neg96.0%
*-commutative96.0%
distribute-lft-neg-in96.0%
Simplified96.0%
if 4.69999999999999972e-5 < im Initial program 99.7%
sub0-neg99.7%
Simplified99.7%
Taylor expanded in im around 0 70.6%
mul-1-neg70.6%
unsub-neg70.6%
*-commutative70.6%
associate-*l*70.6%
distribute-lft-out--70.6%
Simplified70.6%
Taylor expanded in re around 0 52.4%
Final simplification78.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) -0.16666666666666666)))
(if (<= im -2.1e+96)
t_0
(if (<= im -6.4e+17)
(- (* (* re re) (* im 0.5)) im)
(if (<= im 1.2e+61) (* im (- (cos re))) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -2.1e+96) {
tmp = t_0;
} else if (im <= -6.4e+17) {
tmp = ((re * re) * (im * 0.5)) - im;
} else if (im <= 1.2e+61) {
tmp = im * -cos(re);
} 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)
if (im <= (-2.1d+96)) then
tmp = t_0
else if (im <= (-6.4d+17)) then
tmp = ((re * re) * (im * 0.5d0)) - im
else if (im <= 1.2d+61) then
tmp = im * -cos(re)
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;
double tmp;
if (im <= -2.1e+96) {
tmp = t_0;
} else if (im <= -6.4e+17) {
tmp = ((re * re) * (im * 0.5)) - im;
} else if (im <= 1.2e+61) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * -0.16666666666666666 tmp = 0 if im <= -2.1e+96: tmp = t_0 elif im <= -6.4e+17: tmp = ((re * re) * (im * 0.5)) - im elif im <= 1.2e+61: tmp = im * -math.cos(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * -0.16666666666666666) tmp = 0.0 if (im <= -2.1e+96) tmp = t_0; elseif (im <= -6.4e+17) tmp = Float64(Float64(Float64(re * re) * Float64(im * 0.5)) - im); elseif (im <= 1.2e+61) tmp = Float64(im * Float64(-cos(re))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * -0.16666666666666666; tmp = 0.0; if (im <= -2.1e+96) tmp = t_0; elseif (im <= -6.4e+17) tmp = ((re * re) * (im * 0.5)) - im; elseif (im <= 1.2e+61) tmp = im * -cos(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, If[LessEqual[im, -2.1e+96], t$95$0, If[LessEqual[im, -6.4e+17], N[(N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[im, 1.2e+61], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666\\
\mathbf{if}\;im \leq -2.1 \cdot 10^{+96}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -6.4 \cdot 10^{+17}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right) - im\\
\mathbf{elif}\;im \leq 1.2 \cdot 10^{+61}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.1000000000000001e96 or 1.1999999999999999e61 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 87.4%
mul-1-neg87.4%
unsub-neg87.4%
*-commutative87.4%
associate-*l*87.4%
distribute-lft-out--87.4%
Simplified87.4%
Taylor expanded in re around 0 66.1%
Taylor expanded in im around inf 66.1%
if -2.1000000000000001e96 < im < -6.4e17Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.6%
mul-1-neg3.6%
*-commutative3.6%
distribute-lft-neg-in3.6%
Simplified3.6%
Taylor expanded in re around 0 37.3%
neg-mul-137.3%
+-commutative37.3%
unsub-neg37.3%
*-commutative37.3%
associate-*l*37.3%
unpow237.3%
Simplified37.3%
if -6.4e17 < im < 1.1999999999999999e61Initial program 16.5%
sub0-neg16.5%
Simplified16.5%
Taylor expanded in im around 0 89.6%
mul-1-neg89.6%
*-commutative89.6%
distribute-lft-neg-in89.6%
Simplified89.6%
Final simplification78.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* re re) 0.75)))
(if (<= re 4.2e+75)
(- (* (* re re) (* im 0.5)) im)
(if (<= re 1.75e+126)
(/ (- 2.25 (* t_0 t_0)) (- -1.5 t_0))
(- (* re (* re (* im 0.5))) im)))))
double code(double re, double im) {
double t_0 = (re * re) * 0.75;
double tmp;
if (re <= 4.2e+75) {
tmp = ((re * re) * (im * 0.5)) - im;
} else if (re <= 1.75e+126) {
tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
} else {
tmp = (re * (re * (im * 0.5))) - 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 = (re * re) * 0.75d0
if (re <= 4.2d+75) then
tmp = ((re * re) * (im * 0.5d0)) - im
else if (re <= 1.75d+126) then
tmp = (2.25d0 - (t_0 * t_0)) / ((-1.5d0) - t_0)
else
tmp = (re * (re * (im * 0.5d0))) - im
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (re * re) * 0.75;
double tmp;
if (re <= 4.2e+75) {
tmp = ((re * re) * (im * 0.5)) - im;
} else if (re <= 1.75e+126) {
tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
} else {
tmp = (re * (re * (im * 0.5))) - im;
}
return tmp;
}
def code(re, im): t_0 = (re * re) * 0.75 tmp = 0 if re <= 4.2e+75: tmp = ((re * re) * (im * 0.5)) - im elif re <= 1.75e+126: tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0) else: tmp = (re * (re * (im * 0.5))) - im return tmp
function code(re, im) t_0 = Float64(Float64(re * re) * 0.75) tmp = 0.0 if (re <= 4.2e+75) tmp = Float64(Float64(Float64(re * re) * Float64(im * 0.5)) - im); elseif (re <= 1.75e+126) tmp = Float64(Float64(2.25 - Float64(t_0 * t_0)) / Float64(-1.5 - t_0)); else tmp = Float64(Float64(re * Float64(re * Float64(im * 0.5))) - im); end return tmp end
function tmp_2 = code(re, im) t_0 = (re * re) * 0.75; tmp = 0.0; if (re <= 4.2e+75) tmp = ((re * re) * (im * 0.5)) - im; elseif (re <= 1.75e+126) tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0); else tmp = (re * (re * (im * 0.5))) - im; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]}, If[LessEqual[re, 4.2e+75], N[(N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[re, 1.75e+126], N[(N[(2.25 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-1.5 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot 0.75\\
\mathbf{if}\;re \leq 4.2 \cdot 10^{+75}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right) - im\\
\mathbf{elif}\;re \leq 1.75 \cdot 10^{+126}:\\
\;\;\;\;\frac{2.25 - t_0 \cdot t_0}{-1.5 - t_0}\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(im \cdot 0.5\right)\right) - im\\
\end{array}
\end{array}
if re < 4.19999999999999997e75Initial program 51.5%
sub0-neg51.5%
Simplified51.5%
Taylor expanded in im around 0 54.4%
mul-1-neg54.4%
*-commutative54.4%
distribute-lft-neg-in54.4%
Simplified54.4%
Taylor expanded in re around 0 37.0%
neg-mul-137.0%
+-commutative37.0%
unsub-neg37.0%
*-commutative37.0%
associate-*l*37.0%
unpow237.0%
Simplified37.0%
if 4.19999999999999997e75 < re < 1.7500000000000001e126Initial program 64.2%
sub0-neg64.2%
Simplified64.2%
Taylor expanded in re around 0 1.8%
*-commutative1.8%
associate-*r*1.8%
distribute-rgt-out26.8%
+-commutative26.8%
*-commutative26.8%
unpow226.8%
associate-*l*26.8%
Simplified26.8%
Applied egg-rr3.7%
distribute-lft-in3.7%
flip-+38.3%
metadata-eval38.3%
metadata-eval38.3%
metadata-eval38.3%
*-commutative38.3%
*-commutative38.3%
associate-*r*38.3%
associate-*l*38.3%
metadata-eval38.3%
associate-*r*38.3%
associate-*l*38.3%
metadata-eval38.3%
metadata-eval38.3%
*-commutative38.3%
associate-*r*38.3%
associate-*l*38.3%
metadata-eval38.3%
Applied egg-rr38.3%
if 1.7500000000000001e126 < re Initial program 50.3%
sub0-neg50.3%
Simplified50.3%
Taylor expanded in im around 0 54.8%
mul-1-neg54.8%
*-commutative54.8%
distribute-lft-neg-in54.8%
Simplified54.8%
Taylor expanded in re around 0 21.6%
neg-mul-121.6%
+-commutative21.6%
unsub-neg21.6%
*-commutative21.6%
associate-*l*21.6%
unpow221.6%
Simplified21.6%
sub-neg21.6%
associate-*l*21.7%
Applied egg-rr21.7%
Final simplification35.0%
(FPCore (re im) :precision binary64 (- (* (* re re) (* im 0.5)) im))
double code(double re, double im) {
return ((re * re) * (im * 0.5)) - im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = ((re * re) * (im * 0.5d0)) - im
end function
public static double code(double re, double im) {
return ((re * re) * (im * 0.5)) - im;
}
def code(re, im): return ((re * re) * (im * 0.5)) - im
function code(re, im) return Float64(Float64(Float64(re * re) * Float64(im * 0.5)) - im) end
function tmp = code(re, im) tmp = ((re * re) * (im * 0.5)) - im; end
code[re_, im_] := N[(N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]
\begin{array}{l}
\\
\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right) - im
\end{array}
Initial program 51.7%
sub0-neg51.7%
Simplified51.7%
Taylor expanded in im around 0 54.0%
mul-1-neg54.0%
*-commutative54.0%
distribute-lft-neg-in54.0%
Simplified54.0%
Taylor expanded in re around 0 34.3%
neg-mul-134.3%
+-commutative34.3%
unsub-neg34.3%
*-commutative34.3%
associate-*l*34.3%
unpow234.3%
Simplified34.3%
Final simplification34.3%
(FPCore (re im) :precision binary64 (- (* re (* re (* im 0.5))) im))
double code(double re, double im) {
return (re * (re * (im * 0.5))) - im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (re * (re * (im * 0.5d0))) - im
end function
public static double code(double re, double im) {
return (re * (re * (im * 0.5))) - im;
}
def code(re, im): return (re * (re * (im * 0.5))) - im
function code(re, im) return Float64(Float64(re * Float64(re * Float64(im * 0.5))) - im) end
function tmp = code(re, im) tmp = (re * (re * (im * 0.5))) - im; end
code[re_, im_] := N[(N[(re * N[(re * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]
\begin{array}{l}
\\
re \cdot \left(re \cdot \left(im \cdot 0.5\right)\right) - im
\end{array}
Initial program 51.7%
sub0-neg51.7%
Simplified51.7%
Taylor expanded in im around 0 54.0%
mul-1-neg54.0%
*-commutative54.0%
distribute-lft-neg-in54.0%
Simplified54.0%
Taylor expanded in re around 0 34.3%
neg-mul-134.3%
+-commutative34.3%
unsub-neg34.3%
*-commutative34.3%
associate-*l*34.3%
unpow234.3%
Simplified34.3%
sub-neg34.3%
associate-*l*34.3%
Applied egg-rr34.3%
Final simplification34.3%
(FPCore (re im) :precision binary64 (if (<= re 1.65e+182) (- im) (* (* re re) 0.75)))
double code(double re, double im) {
double tmp;
if (re <= 1.65e+182) {
tmp = -im;
} else {
tmp = (re * re) * 0.75;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 1.65d+182) then
tmp = -im
else
tmp = (re * re) * 0.75d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.65e+182) {
tmp = -im;
} else {
tmp = (re * re) * 0.75;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.65e+182: tmp = -im else: tmp = (re * re) * 0.75 return tmp
function code(re, im) tmp = 0.0 if (re <= 1.65e+182) tmp = Float64(-im); else tmp = Float64(Float64(re * re) * 0.75); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.65e+182) tmp = -im; else tmp = (re * re) * 0.75; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.65e+182], (-im), N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.65 \cdot 10^{+182}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\end{array}
\end{array}
if re < 1.65e182Initial program 51.4%
sub0-neg51.4%
Simplified51.4%
Taylor expanded in im around 0 85.1%
mul-1-neg85.1%
unsub-neg85.1%
*-commutative85.1%
associate-*l*85.1%
distribute-lft-out--85.1%
Simplified85.1%
Taylor expanded in re around 0 53.3%
Taylor expanded in im around 0 29.8%
neg-mul-129.8%
Simplified29.8%
if 1.65e182 < re Initial program 54.8%
sub0-neg54.8%
Simplified54.8%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out22.2%
+-commutative22.2%
*-commutative22.2%
unpow222.2%
associate-*l*22.2%
Simplified22.2%
Applied egg-rr30.6%
distribute-lft-in30.6%
flip-+0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
*-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
associate-*l*0.0%
metadata-eval0.0%
associate-*r*0.0%
associate-*l*0.0%
metadata-eval0.0%
metadata-eval0.0%
*-commutative0.0%
associate-*r*0.0%
associate-*l*0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in re around inf 30.6%
unpow230.6%
Simplified30.6%
Final simplification29.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 51.7%
sub0-neg51.7%
Simplified51.7%
Taylor expanded in im around 0 84.4%
mul-1-neg84.4%
unsub-neg84.4%
*-commutative84.4%
associate-*l*84.4%
distribute-lft-out--84.4%
Simplified84.4%
Taylor expanded in re around 0 50.2%
Taylor expanded in im around 0 27.3%
neg-mul-127.3%
Simplified27.3%
Final simplification27.3%
(FPCore (re im) :precision binary64 -1.5)
double code(double re, double im) {
return -1.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -1.5d0
end function
public static double code(double re, double im) {
return -1.5;
}
def code(re, im): return -1.5
function code(re, im) return -1.5 end
function tmp = code(re, im) tmp = -1.5; end
code[re_, im_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 51.7%
sub0-neg51.7%
Simplified51.7%
Taylor expanded in re around 0 2.4%
*-commutative2.4%
associate-*r*2.4%
distribute-rgt-out38.7%
+-commutative38.7%
*-commutative38.7%
unpow238.7%
associate-*l*38.7%
Simplified38.7%
Applied egg-rr8.2%
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 2023201
(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))))