
(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 16 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 -2e+110) (not (<= t_0 2e-10)))
(* (* 0.5 (cos re)) t_0)
(* (cos re) (- im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -2e+110) || !(t_0 <= 2e-10)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * -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 <= (-2d+110)) .or. (.not. (t_0 <= 2d-10))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * -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 <= -2e+110) || !(t_0 <= 2e-10)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * -im;
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -2e+110) or not (t_0 <= 2e-10): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * -im return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -2e+110) || !(t_0 <= 2e-10)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -2e+110) || ~((t_0 <= 2e-10))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * -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, -2e+110], N[Not[LessEqual[t$95$0, 2e-10]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+110} \lor \neg \left(t_0 \leq 2 \cdot 10^{-10}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -2e110 or 2.00000000000000007e-10 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -2e110 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 2.00000000000000007e-10Initial program 7.3%
sub0-neg7.3%
Simplified7.3%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Final simplification99.9%
(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 -4.1e+93)
t_1
(if (<= im -0.00155)
(* 0.5 t_0)
(if (<= im 260.0)
(* (cos re) (- im))
(if (<= im 1.42e+102) (* t_0 (+ 0.5 (* re (* re -0.25)))) t_1))))))
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 <= -4.1e+93) {
tmp = t_1;
} else if (im <= -0.00155) {
tmp = 0.5 * t_0;
} else if (im <= 260.0) {
tmp = cos(re) * -im;
} else if (im <= 1.42e+102) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-im) - exp(im)
t_1 = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
if (im <= (-4.1d+93)) then
tmp = t_1
else if (im <= (-0.00155d0)) then
tmp = 0.5d0 * t_0
else if (im <= 260.0d0) then
tmp = cos(re) * -im
else if (im <= 1.42d+102) then
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double t_1 = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -4.1e+93) {
tmp = t_1;
} else if (im <= -0.00155) {
tmp = 0.5 * t_0;
} else if (im <= 260.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.42e+102) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = t_1;
}
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 <= -4.1e+93: tmp = t_1 elif im <= -0.00155: tmp = 0.5 * t_0 elif im <= 260.0: tmp = math.cos(re) * -im elif im <= 1.42e+102: tmp = t_0 * (0.5 + (re * (re * -0.25))) else: tmp = t_1 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 <= -4.1e+93) tmp = t_1; elseif (im <= -0.00155) tmp = Float64(0.5 * t_0); elseif (im <= 260.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.42e+102) tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); else tmp = t_1; 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 <= -4.1e+93) tmp = t_1; elseif (im <= -0.00155) tmp = 0.5 * t_0; elseif (im <= 260.0) tmp = cos(re) * -im; elseif (im <= 1.42e+102) tmp = t_0 * (0.5 + (re * (re * -0.25))); else tmp = t_1; 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, -4.1e+93], t$95$1, If[LessEqual[im, -0.00155], N[(0.5 * t$95$0), $MachinePrecision], If[LessEqual[im, 260.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.42e+102], N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\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 -4.1 \cdot 10^{+93}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00155:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{elif}\;im \leq 260:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.42 \cdot 10^{+102}:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.1000000000000001e93 or 1.4200000000000001e102 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.0%
mul-1-neg98.0%
unsub-neg98.0%
*-commutative98.0%
associate-*l*98.0%
distribute-lft-out--98.0%
Simplified98.0%
if -4.1000000000000001e93 < im < -0.00154999999999999995Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 87.5%
if -0.00154999999999999995 < im < 260Initial program 8.0%
sub0-neg8.0%
Simplified8.0%
Taylor expanded in im around 0 99.1%
mul-1-neg99.1%
*-commutative99.1%
distribute-lft-neg-in99.1%
Simplified99.1%
if 260 < im < 1.4200000000000001e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out85.7%
+-commutative85.7%
*-commutative85.7%
unpow285.7%
associate-*l*85.7%
Simplified85.7%
Final simplification96.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))))
(if (<= im -4.1e+93)
t_1
(if (<= im -0.0135)
t_0
(if (<= im 0.052) (* (cos re) (- im)) (if (<= im 5.6e+102) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -4.1e+93) {
tmp = t_1;
} else if (im <= -0.0135) {
tmp = t_0;
} else if (im <= 0.052) {
tmp = cos(re) * -im;
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
if (im <= (-4.1d+93)) then
tmp = t_1
else if (im <= (-0.0135d0)) then
tmp = t_0
else if (im <= 0.052d0) then
tmp = cos(re) * -im
else if (im <= 5.6d+102) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -4.1e+93) {
tmp = t_1;
} else if (im <= -0.0135) {
tmp = t_0;
} else if (im <= 0.052) {
tmp = Math.cos(re) * -im;
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) tmp = 0 if im <= -4.1e+93: tmp = t_1 elif im <= -0.0135: tmp = t_0 elif im <= 0.052: tmp = math.cos(re) * -im elif im <= 5.6e+102: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)) tmp = 0.0 if (im <= -4.1e+93) tmp = t_1; elseif (im <= -0.0135) tmp = t_0; elseif (im <= 0.052) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); tmp = 0.0; if (im <= -4.1e+93) tmp = t_1; elseif (im <= -0.0135) tmp = t_0; elseif (im <= 0.052) tmp = cos(re) * -im; elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $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, -4.1e+93], t$95$1, If[LessEqual[im, -0.0135], t$95$0, If[LessEqual[im, 0.052], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 5.6e+102], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := \cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{if}\;im \leq -4.1 \cdot 10^{+93}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0135:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.052:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.1000000000000001e93 or 5.60000000000000037e102 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
*-commutative98.9%
associate-*l*98.9%
distribute-lft-out--98.9%
Simplified98.9%
if -4.1000000000000001e93 < im < -0.0134999999999999998 or 0.0519999999999999976 < im < 5.60000000000000037e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 77.5%
if -0.0134999999999999998 < im < 0.0519999999999999976Initial program 7.3%
sub0-neg7.3%
Simplified7.3%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Final simplification96.1%
(FPCore (re im) :precision binary64 (if (or (<= im -0.00135) (not (<= im 0.0021))) (* 0.5 (- (exp (- im)) (exp im))) (* (cos re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -0.00135) || !(im <= 0.0021)) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = cos(re) * -im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-0.00135d0)) .or. (.not. (im <= 0.0021d0))) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = cos(re) * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -0.00135) || !(im <= 0.0021)) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = Math.cos(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -0.00135) or not (im <= 0.0021): tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = math.cos(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -0.00135) || !(im <= 0.0021)) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = Float64(cos(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -0.00135) || ~((im <= 0.0021))) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = cos(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -0.00135], N[Not[LessEqual[im, 0.0021]], $MachinePrecision]], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.00135 \lor \neg \left(im \leq 0.0021\right):\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -0.0013500000000000001 or 0.00209999999999999987 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 76.4%
if -0.0013500000000000001 < im < 0.00209999999999999987Initial program 7.3%
sub0-neg7.3%
Simplified7.3%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Final simplification88.3%
(FPCore (re im)
:precision binary64
(if (<= im -3.7e+25)
(- (* (pow im 3.0) -0.16666666666666666) im)
(if (<= im 2100.0)
(* (cos re) (- im))
(*
(+ 0.5 (* re (* re -0.25)))
(+ (* im -2.0) (* (pow im 3.0) -0.3333333333333333))))))
double code(double re, double im) {
double tmp;
if (im <= -3.7e+25) {
tmp = (pow(im, 3.0) * -0.16666666666666666) - im;
} else if (im <= 2100.0) {
tmp = cos(re) * -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * ((im * -2.0) + (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) :: tmp
if (im <= (-3.7d+25)) then
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
else if (im <= 2100.0d0) then
tmp = cos(re) * -im
else
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * ((im * (-2.0d0)) + ((im ** 3.0d0) * (-0.3333333333333333d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.7e+25) {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
} else if (im <= 2100.0) {
tmp = Math.cos(re) * -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * ((im * -2.0) + (Math.pow(im, 3.0) * -0.3333333333333333));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.7e+25: tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im elif im <= 2100.0: tmp = math.cos(re) * -im else: tmp = (0.5 + (re * (re * -0.25))) * ((im * -2.0) + (math.pow(im, 3.0) * -0.3333333333333333)) return tmp
function code(re, im) tmp = 0.0 if (im <= -3.7e+25) tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 2100.0) tmp = Float64(cos(re) * Float64(-im)); else tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * Float64(Float64(im * -2.0) + Float64((im ^ 3.0) * -0.3333333333333333))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.7e+25) tmp = ((im ^ 3.0) * -0.16666666666666666) - im; elseif (im <= 2100.0) tmp = cos(re) * -im; else tmp = (0.5 + (re * (re * -0.25))) * ((im * -2.0) + ((im ^ 3.0) * -0.3333333333333333)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.7e+25], N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[im, 2100.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.7 \cdot 10^{+25}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{elif}\;im \leq 2100:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\\
\end{array}
\end{array}
if im < -3.6999999999999999e25Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.9%
mul-1-neg84.9%
unsub-neg84.9%
*-commutative84.9%
associate-*l*84.9%
distribute-lft-out--84.9%
Simplified84.9%
Taylor expanded in re around 0 66.9%
if -3.6999999999999999e25 < im < 2100Initial program 13.3%
sub0-neg13.3%
Simplified13.3%
Taylor expanded in im around 0 93.6%
mul-1-neg93.6%
*-commutative93.6%
distribute-lft-neg-in93.6%
Simplified93.6%
if 2100 < im Initial 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.0%
+-commutative77.0%
*-commutative77.0%
unpow277.0%
associate-*l*77.0%
Simplified77.0%
Taylor expanded in im around 0 57.0%
Final simplification79.0%
(FPCore (re im)
:precision binary64
(if (<= im -3.8e+25)
(- (* (pow im 3.0) -0.16666666666666666) im)
(if (<= im 700.0)
(* (cos re) (- im))
(* -0.3333333333333333 (* (pow im 3.0) (+ 0.5 (* -0.25 (* re re))))))))
double code(double re, double im) {
double tmp;
if (im <= -3.8e+25) {
tmp = (pow(im, 3.0) * -0.16666666666666666) - im;
} else if (im <= 700.0) {
tmp = cos(re) * -im;
} else {
tmp = -0.3333333333333333 * (pow(im, 3.0) * (0.5 + (-0.25 * (re * 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.8d+25)) then
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
else if (im <= 700.0d0) then
tmp = cos(re) * -im
else
tmp = (-0.3333333333333333d0) * ((im ** 3.0d0) * (0.5d0 + ((-0.25d0) * (re * re))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.8e+25) {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
} else if (im <= 700.0) {
tmp = Math.cos(re) * -im;
} else {
tmp = -0.3333333333333333 * (Math.pow(im, 3.0) * (0.5 + (-0.25 * (re * re))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.8e+25: tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im elif im <= 700.0: tmp = math.cos(re) * -im else: tmp = -0.3333333333333333 * (math.pow(im, 3.0) * (0.5 + (-0.25 * (re * re)))) return tmp
function code(re, im) tmp = 0.0 if (im <= -3.8e+25) tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 700.0) tmp = Float64(cos(re) * Float64(-im)); else tmp = Float64(-0.3333333333333333 * Float64((im ^ 3.0) * Float64(0.5 + Float64(-0.25 * Float64(re * re))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.8e+25) tmp = ((im ^ 3.0) * -0.16666666666666666) - im; elseif (im <= 700.0) tmp = cos(re) * -im; else tmp = -0.3333333333333333 * ((im ^ 3.0) * (0.5 + (-0.25 * (re * re)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.8e+25], N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[im, 700.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(-0.3333333333333333 * N[(N[Power[im, 3.0], $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.8 \cdot 10^{+25}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{elif}\;im \leq 700:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left({im}^{3} \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\right)\\
\end{array}
\end{array}
if im < -3.8e25Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.9%
mul-1-neg84.9%
unsub-neg84.9%
*-commutative84.9%
associate-*l*84.9%
distribute-lft-out--84.9%
Simplified84.9%
Taylor expanded in re around 0 66.9%
if -3.8e25 < im < 700Initial program 13.3%
sub0-neg13.3%
Simplified13.3%
Taylor expanded in im around 0 93.6%
mul-1-neg93.6%
*-commutative93.6%
distribute-lft-neg-in93.6%
Simplified93.6%
if 700 < im Initial 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.0%
+-commutative77.0%
*-commutative77.0%
unpow277.0%
associate-*l*77.0%
Simplified77.0%
Taylor expanded in im around 0 57.0%
Taylor expanded in im around inf 57.0%
*-commutative57.0%
unpow257.0%
Simplified57.0%
Final simplification79.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -3.1e+25)
t_0
(if (<= im 2.25e+18)
(* (cos re) (- im))
(if (<= im 1.42e+102)
(* im (* 0.001388888888888889 (pow re 6.0)))
t_0)))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -3.1e+25) {
tmp = t_0;
} else if (im <= 2.25e+18) {
tmp = cos(re) * -im;
} else if (im <= 1.42e+102) {
tmp = im * (0.001388888888888889 * pow(re, 6.0));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
if (im <= (-3.1d+25)) then
tmp = t_0
else if (im <= 2.25d+18) then
tmp = cos(re) * -im
else if (im <= 1.42d+102) then
tmp = im * (0.001388888888888889d0 * (re ** 6.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -3.1e+25) {
tmp = t_0;
} else if (im <= 2.25e+18) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.42e+102) {
tmp = im * (0.001388888888888889 * Math.pow(re, 6.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -3.1e+25: tmp = t_0 elif im <= 2.25e+18: tmp = math.cos(re) * -im elif im <= 1.42e+102: tmp = im * (0.001388888888888889 * math.pow(re, 6.0)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -3.1e+25) tmp = t_0; elseif (im <= 2.25e+18) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.42e+102) tmp = Float64(im * Float64(0.001388888888888889 * (re ^ 6.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -3.1e+25) tmp = t_0; elseif (im <= 2.25e+18) tmp = cos(re) * -im; elseif (im <= 1.42e+102) tmp = im * (0.001388888888888889 * (re ^ 6.0)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -3.1e+25], t$95$0, If[LessEqual[im, 2.25e+18], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.42e+102], N[(im * N[(0.001388888888888889 * N[Power[re, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -3.1 \cdot 10^{+25}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2.25 \cdot 10^{+18}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.42 \cdot 10^{+102}:\\
\;\;\;\;im \cdot \left(0.001388888888888889 \cdot {re}^{6}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -3.0999999999999998e25 or 1.4200000000000001e102 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 90.3%
mul-1-neg90.3%
unsub-neg90.3%
*-commutative90.3%
associate-*l*90.3%
distribute-lft-out--90.3%
Simplified90.3%
Taylor expanded in re around 0 69.4%
if -3.0999999999999998e25 < im < 2.25e18Initial program 14.5%
sub0-neg14.5%
Simplified14.5%
Taylor expanded in im around 0 92.4%
mul-1-neg92.4%
*-commutative92.4%
distribute-lft-neg-in92.4%
Simplified92.4%
if 2.25e18 < im < 1.4200000000000001e102Initial 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 2.2%
Taylor expanded in re around inf 27.3%
associate-*r*27.3%
Simplified27.3%
Final simplification78.9%
(FPCore (re im) :precision binary64 (if (or (<= im -2.6e+18) (not (<= im 600.0))) (- (* 0.5 (* re (* im re))) im) (* (cos re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -2.6e+18) || !(im <= 600.0)) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = cos(re) * -im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-2.6d+18)) .or. (.not. (im <= 600.0d0))) then
tmp = (0.5d0 * (re * (im * re))) - im
else
tmp = cos(re) * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -2.6e+18) || !(im <= 600.0)) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = Math.cos(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -2.6e+18) or not (im <= 600.0): tmp = (0.5 * (re * (im * re))) - im else: tmp = math.cos(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -2.6e+18) || !(im <= 600.0)) tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); else tmp = Float64(cos(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -2.6e+18) || ~((im <= 600.0))) tmp = (0.5 * (re * (im * re))) - im; else tmp = cos(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -2.6e+18], N[Not[LessEqual[im, 600.0]], $MachinePrecision]], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.6 \cdot 10^{+18} \lor \neg \left(im \leq 600\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -2.6e18 or 600 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.6%
mul-1-neg5.6%
*-commutative5.6%
distribute-lft-neg-in5.6%
Simplified5.6%
Taylor expanded in re around 0 3.8%
Taylor expanded in re around 0 22.5%
+-commutative22.5%
mul-1-neg22.5%
unsub-neg22.5%
unpow222.5%
associate-*l*22.5%
Simplified22.5%
if -2.6e18 < im < 600Initial program 12.0%
sub0-neg12.0%
Simplified12.0%
Taylor expanded in im around 0 95.0%
mul-1-neg95.0%
*-commutative95.0%
distribute-lft-neg-in95.0%
Simplified95.0%
Final simplification61.3%
(FPCore (re im) :precision binary64 (if (<= im -2.8e+18) (* im (* 0.001388888888888889 (pow re 6.0))) (if (<= im 2050000.0) (* (cos re) (- im)) (- (* 0.5 (* re (* im re))) im))))
double code(double re, double im) {
double tmp;
if (im <= -2.8e+18) {
tmp = im * (0.001388888888888889 * pow(re, 6.0));
} else if (im <= 2050000.0) {
tmp = cos(re) * -im;
} else {
tmp = (0.5 * (re * (im * re))) - im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-2.8d+18)) then
tmp = im * (0.001388888888888889d0 * (re ** 6.0d0))
else if (im <= 2050000.0d0) then
tmp = cos(re) * -im
else
tmp = (0.5d0 * (re * (im * re))) - im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -2.8e+18) {
tmp = im * (0.001388888888888889 * Math.pow(re, 6.0));
} else if (im <= 2050000.0) {
tmp = Math.cos(re) * -im;
} else {
tmp = (0.5 * (re * (im * re))) - im;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -2.8e+18: tmp = im * (0.001388888888888889 * math.pow(re, 6.0)) elif im <= 2050000.0: tmp = math.cos(re) * -im else: tmp = (0.5 * (re * (im * re))) - im return tmp
function code(re, im) tmp = 0.0 if (im <= -2.8e+18) tmp = Float64(im * Float64(0.001388888888888889 * (re ^ 6.0))); elseif (im <= 2050000.0) tmp = Float64(cos(re) * Float64(-im)); else tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -2.8e+18) tmp = im * (0.001388888888888889 * (re ^ 6.0)); elseif (im <= 2050000.0) tmp = cos(re) * -im; else tmp = (0.5 * (re * (im * re))) - im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -2.8e+18], N[(im * N[(0.001388888888888889 * N[Power[re, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2050000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.8 \cdot 10^{+18}:\\
\;\;\;\;im \cdot \left(0.001388888888888889 \cdot {re}^{6}\right)\\
\mathbf{elif}\;im \leq 2050000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\end{array}
\end{array}
if im < -2.8e18Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 6.1%
mul-1-neg6.1%
*-commutative6.1%
distribute-lft-neg-in6.1%
Simplified6.1%
Taylor expanded in re around 0 5.0%
Taylor expanded in re around inf 21.6%
associate-*r*21.6%
Simplified21.6%
if -2.8e18 < im < 2.05e6Initial program 12.0%
sub0-neg12.0%
Simplified12.0%
Taylor expanded in im around 0 95.0%
mul-1-neg95.0%
*-commutative95.0%
distribute-lft-neg-in95.0%
Simplified95.0%
if 2.05e6 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.1%
mul-1-neg5.1%
*-commutative5.1%
distribute-lft-neg-in5.1%
Simplified5.1%
Taylor expanded in re around 0 2.6%
Taylor expanded in re around 0 25.7%
+-commutative25.7%
mul-1-neg25.7%
unsub-neg25.7%
unpow225.7%
associate-*l*25.7%
Simplified25.7%
Final simplification61.8%
(FPCore (re im) :precision binary64 (if (<= re 1.1e+158) (- im) (if (<= re 1.85e+176) (* (* re re) 0.75) (+ 13.5 (* (* re re) -6.75)))))
double code(double re, double im) {
double tmp;
if (re <= 1.1e+158) {
tmp = -im;
} else if (re <= 1.85e+176) {
tmp = (re * re) * 0.75;
} else {
tmp = 13.5 + ((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 <= 1.1d+158) then
tmp = -im
else if (re <= 1.85d+176) then
tmp = (re * re) * 0.75d0
else
tmp = 13.5d0 + ((re * re) * (-6.75d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.1e+158) {
tmp = -im;
} else if (re <= 1.85e+176) {
tmp = (re * re) * 0.75;
} else {
tmp = 13.5 + ((re * re) * -6.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.1e+158: tmp = -im elif re <= 1.85e+176: tmp = (re * re) * 0.75 else: tmp = 13.5 + ((re * re) * -6.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.1e+158) tmp = Float64(-im); elseif (re <= 1.85e+176) tmp = Float64(Float64(re * re) * 0.75); else tmp = Float64(13.5 + Float64(Float64(re * re) * -6.75)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.1e+158) tmp = -im; elseif (re <= 1.85e+176) tmp = (re * re) * 0.75; else tmp = 13.5 + ((re * re) * -6.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.1e+158], (-im), If[LessEqual[re, 1.85e+176], N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision], N[(13.5 + N[(N[(re * re), $MachinePrecision] * -6.75), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.1 \cdot 10^{+158}:\\
\;\;\;\;-im\\
\mathbf{elif}\;re \leq 1.85 \cdot 10^{+176}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{else}:\\
\;\;\;\;13.5 + \left(re \cdot re\right) \cdot -6.75\\
\end{array}
\end{array}
if re < 1.1000000000000001e158Initial program 53.4%
sub0-neg53.4%
Simplified53.4%
Taylor expanded in im around 0 52.9%
mul-1-neg52.9%
*-commutative52.9%
distribute-lft-neg-in52.9%
Simplified52.9%
Taylor expanded in re around 0 32.2%
neg-mul-132.2%
Simplified32.2%
if 1.1000000000000001e158 < re < 1.8499999999999999e176Initial program 58.3%
sub0-neg58.3%
Simplified58.3%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out33.4%
+-commutative33.4%
*-commutative33.4%
unpow233.4%
associate-*l*33.4%
Simplified33.4%
Applied egg-rr51.0%
Taylor expanded in re around inf 51.0%
unpow251.0%
Simplified51.0%
if 1.8499999999999999e176 < re Initial program 44.7%
sub0-neg44.7%
Simplified44.7%
Applied egg-rr2.6%
Taylor expanded in re around 0 24.6%
*-commutative24.6%
unpow224.6%
Simplified24.6%
Final simplification32.1%
(FPCore (re im) :precision binary64 (if (<= re 1.8e+172) (- (* 0.5 (* re (* im re))) im) (+ 13.5 (* (* re re) -6.75))))
double code(double re, double im) {
double tmp;
if (re <= 1.8e+172) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = 13.5 + ((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 <= 1.8d+172) then
tmp = (0.5d0 * (re * (im * re))) - im
else
tmp = 13.5d0 + ((re * re) * (-6.75d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.8e+172) {
tmp = (0.5 * (re * (im * re))) - im;
} else {
tmp = 13.5 + ((re * re) * -6.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.8e+172: tmp = (0.5 * (re * (im * re))) - im else: tmp = 13.5 + ((re * re) * -6.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.8e+172) tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); else tmp = Float64(13.5 + Float64(Float64(re * re) * -6.75)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.8e+172) tmp = (0.5 * (re * (im * re))) - im; else tmp = 13.5 + ((re * re) * -6.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.8e+172], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], N[(13.5 + N[(N[(re * re), $MachinePrecision] * -6.75), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.8 \cdot 10^{+172}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;13.5 + \left(re \cdot re\right) \cdot -6.75\\
\end{array}
\end{array}
if re < 1.79999999999999987e172Initial program 53.3%
sub0-neg53.3%
Simplified53.3%
Taylor expanded in im around 0 53.1%
mul-1-neg53.1%
*-commutative53.1%
distribute-lft-neg-in53.1%
Simplified53.1%
Taylor expanded in re around 0 29.5%
Taylor expanded in re around 0 37.8%
+-commutative37.8%
mul-1-neg37.8%
unsub-neg37.8%
unpow237.8%
associate-*l*37.8%
Simplified37.8%
if 1.79999999999999987e172 < re Initial program 47.8%
sub0-neg47.8%
Simplified47.8%
Applied egg-rr2.7%
Taylor expanded in re around 0 23.2%
*-commutative23.2%
unpow223.2%
Simplified23.2%
Final simplification36.8%
(FPCore (re im) :precision binary64 (if (<= re 8.1e+157) (- im) (* (* re re) 0.75)))
double code(double re, double im) {
double tmp;
if (re <= 8.1e+157) {
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 <= 8.1d+157) 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 <= 8.1e+157) {
tmp = -im;
} else {
tmp = (re * re) * 0.75;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 8.1e+157: tmp = -im else: tmp = (re * re) * 0.75 return tmp
function code(re, im) tmp = 0.0 if (re <= 8.1e+157) 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 <= 8.1e+157) tmp = -im; else tmp = (re * re) * 0.75; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 8.1e+157], (-im), N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 8.1 \cdot 10^{+157}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\end{array}
\end{array}
if re < 8.10000000000000009e157Initial program 53.4%
sub0-neg53.4%
Simplified53.4%
Taylor expanded in im around 0 52.9%
mul-1-neg52.9%
*-commutative52.9%
distribute-lft-neg-in52.9%
Simplified52.9%
Taylor expanded in re around 0 32.2%
neg-mul-132.2%
Simplified32.2%
if 8.10000000000000009e157 < re Initial program 48.2%
sub0-neg48.2%
Simplified48.2%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out21.8%
+-commutative21.8%
*-commutative21.8%
unpow221.8%
associate-*l*21.8%
Simplified21.8%
Applied egg-rr27.0%
Taylor expanded in re around inf 27.0%
unpow227.0%
Simplified27.0%
Final simplification31.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 52.9%
sub0-neg52.9%
Simplified52.9%
Taylor expanded in im around 0 53.4%
mul-1-neg53.4%
*-commutative53.4%
distribute-lft-neg-in53.4%
Simplified53.4%
Taylor expanded in re around 0 30.4%
neg-mul-130.4%
Simplified30.4%
Final simplification30.4%
(FPCore (re im) :precision binary64 -3.0)
double code(double re, double im) {
return -3.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -3.0d0
end function
public static double code(double re, double im) {
return -3.0;
}
def code(re, im): return -3.0
function code(re, im) return -3.0 end
function tmp = code(re, im) tmp = -3.0; end
code[re_, im_] := -3.0
\begin{array}{l}
\\
-3
\end{array}
Initial program 52.9%
sub0-neg52.9%
Simplified52.9%
Taylor expanded in im around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
associate-*l*85.2%
distribute-lft-out--85.2%
Simplified85.2%
Applied egg-rr2.9%
Final simplification2.9%
(FPCore (re im) :precision binary64 -9.92290301275212e-8)
double code(double re, double im) {
return -9.92290301275212e-8;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -9.92290301275212d-8
end function
public static double code(double re, double im) {
return -9.92290301275212e-8;
}
def code(re, im): return -9.92290301275212e-8
function code(re, im) return -9.92290301275212e-8 end
function tmp = code(re, im) tmp = -9.92290301275212e-8; end
code[re_, im_] := -9.92290301275212e-8
\begin{array}{l}
\\
-9.92290301275212 \cdot 10^{-8}
\end{array}
Initial program 52.9%
sub0-neg52.9%
Simplified52.9%
Taylor expanded in im around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
associate-*l*85.2%
distribute-lft-out--85.2%
Simplified85.2%
Applied egg-rr3.0%
Final simplification3.0%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 52.9%
sub0-neg52.9%
Simplified52.9%
Taylor expanded in im around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
associate-*l*85.2%
distribute-lft-out--85.2%
Simplified85.2%
Applied egg-rr3.6%
Final simplification3.6%
(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 2023224
(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))))