
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -10.0) (not (<= t_0 0.0002)))
(* (* (cos re) 0.5) t_0)
(*
(cos re)
(+
(+
(* (pow im 5.0) -0.008333333333333333)
(* (pow im 7.0) -0.0001984126984126984))
(- (* (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 <= -10.0) || !(t_0 <= 0.0002)) {
tmp = (cos(re) * 0.5) * t_0;
} else {
tmp = cos(re) * (((pow(im, 5.0) * -0.008333333333333333) + (pow(im, 7.0) * -0.0001984126984126984)) + ((pow(im, 3.0) * -0.16666666666666666) - im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-im) - exp(im)
if ((t_0 <= (-10.0d0)) .or. (.not. (t_0 <= 0.0002d0))) then
tmp = (cos(re) * 0.5d0) * t_0
else
tmp = cos(re) * ((((im ** 5.0d0) * (-0.008333333333333333d0)) + ((im ** 7.0d0) * (-0.0001984126984126984d0))) + (((im ** 3.0d0) * (-0.16666666666666666d0)) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -10.0) || !(t_0 <= 0.0002)) {
tmp = (Math.cos(re) * 0.5) * t_0;
} else {
tmp = Math.cos(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) + (Math.pow(im, 7.0) * -0.0001984126984126984)) + ((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 <= -10.0) or not (t_0 <= 0.0002): tmp = (math.cos(re) * 0.5) * t_0 else: tmp = math.cos(re) * (((math.pow(im, 5.0) * -0.008333333333333333) + (math.pow(im, 7.0) * -0.0001984126984126984)) + ((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 <= -10.0) || !(t_0 <= 0.0002)) tmp = Float64(Float64(cos(re) * 0.5) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) + Float64((im ^ 7.0) * -0.0001984126984126984)) + 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 <= -10.0) || ~((t_0 <= 0.0002))) tmp = (cos(re) * 0.5) * t_0; else tmp = cos(re) * ((((im ^ 5.0) * -0.008333333333333333) + ((im ^ 7.0) * -0.0001984126984126984)) + (((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, -10.0], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] + N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -10 \lor \neg \left(t_0 \leq 0.0002\right):\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left({im}^{3} \cdot -0.16666666666666666 - im\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -10 or 2.0000000000000001e-4 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -10 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 2.0000000000000001e-4Initial program 8.7%
sub0-neg8.7%
Simplified8.7%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
distribute-lft-out99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -0.05) (not (<= t_0 0.0002)))
(* (* (cos re) 0.5) 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 <= -0.05) || !(t_0 <= 0.0002)) {
tmp = (cos(re) * 0.5) * t_0;
} else {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-im) - exp(im)
if ((t_0 <= (-0.05d0)) .or. (.not. (t_0 <= 0.0002d0))) then
tmp = (cos(re) * 0.5d0) * t_0
else
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -0.05) || !(t_0 <= 0.0002)) {
tmp = (Math.cos(re) * 0.5) * 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 <= -0.05) or not (t_0 <= 0.0002): tmp = (math.cos(re) * 0.5) * 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 <= -0.05) || !(t_0 <= 0.0002)) tmp = Float64(Float64(cos(re) * 0.5) * 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 <= -0.05) || ~((t_0 <= 0.0002))) tmp = (cos(re) * 0.5) * 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, -0.05], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $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 -0.05 \lor \neg \left(t_0 \leq 0.0002\right):\\
\;\;\;\;\left(\cos re \cdot 0.5\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)) < -0.050000000000000003 or 2.0000000000000001e-4 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -0.050000000000000003 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 2.0000000000000001e-4Initial program 8.0%
sub0-neg8.0%
Simplified8.0%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(*
(cos re)
(+
(+
(* (pow im 5.0) -0.008333333333333333)
(* (pow im 7.0) -0.0001984126984126984))
(- (log (+ 1.0 (expm1 (* (pow im 3.0) -0.16666666666666666)))) im))))
double code(double re, double im) {
return cos(re) * (((pow(im, 5.0) * -0.008333333333333333) + (pow(im, 7.0) * -0.0001984126984126984)) + (log((1.0 + expm1((pow(im, 3.0) * -0.16666666666666666)))) - im));
}
public static double code(double re, double im) {
return Math.cos(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) + (Math.pow(im, 7.0) * -0.0001984126984126984)) + (Math.log((1.0 + Math.expm1((Math.pow(im, 3.0) * -0.16666666666666666)))) - im));
}
def code(re, im): return math.cos(re) * (((math.pow(im, 5.0) * -0.008333333333333333) + (math.pow(im, 7.0) * -0.0001984126984126984)) + (math.log((1.0 + math.expm1((math.pow(im, 3.0) * -0.16666666666666666)))) - im))
function code(re, im) return Float64(cos(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) + Float64((im ^ 7.0) * -0.0001984126984126984)) + Float64(log(Float64(1.0 + expm1(Float64((im ^ 3.0) * -0.16666666666666666)))) - im))) end
code[re_, im_] := N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] + N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(1.0 + N[(Exp[N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left(\log \left(1 + \mathsf{expm1}\left({im}^{3} \cdot -0.16666666666666666\right)\right) - im\right)\right)
\end{array}
Initial program 49.3%
sub0-neg49.3%
Simplified49.3%
Taylor expanded in im around 0 90.8%
associate-+r+90.8%
+-commutative90.8%
*-commutative90.8%
associate-*l*90.8%
*-commutative90.8%
associate-*l*90.8%
distribute-lft-out90.8%
mul-1-neg90.8%
unsub-neg90.8%
*-commutative90.8%
associate-*l*90.8%
distribute-lft-out--90.8%
distribute-lft-out90.8%
Simplified90.8%
log1p-expm1-u99.3%
log1p-udef99.0%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im)))
(t_1 (* -0.0001984126984126984 (* (cos re) (pow im 7.0)))))
(if (<= im -4.1e+46)
t_1
(if (<= im -0.054)
(* t_0 (+ 0.5 (* re (* re -0.25))))
(if (<= im 0.04)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) (* 0.5 t_0) t_1))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
double tmp;
if (im <= -4.1e+46) {
tmp = t_1;
} else if (im <= -0.054) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if (im <= 0.04) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = 0.5 * t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-im) - exp(im)
t_1 = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
if (im <= (-4.1d+46)) then
tmp = t_1
else if (im <= (-0.054d0)) then
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
else if (im <= 0.04d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = 0.5d0 * t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double t_1 = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -4.1e+46) {
tmp = t_1;
} else if (im <= -0.054) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if (im <= 0.04) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = 0.5 * t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) tmp = 0 if im <= -4.1e+46: tmp = t_1 elif im <= -0.054: tmp = t_0 * (0.5 + (re * (re * -0.25))) elif im <= 0.04: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = 0.5 * t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -4.1e+46) tmp = t_1; elseif (im <= -0.054) tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif (im <= 0.04) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = Float64(0.5 * t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -4.1e+46) tmp = t_1; elseif (im <= -0.054) tmp = t_0 * (0.5 + (re * (re * -0.25))); elseif (im <= 0.04) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = 0.5 * t_0; 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[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.1e+46], t$95$1, If[LessEqual[im, -0.054], N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 0.04], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(0.5 * t$95$0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -4.1 \cdot 10^{+46}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.054:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq 0.04:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.1e46 or 1.09999999999999998e44 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -4.1e46 < im < -0.0539999999999999994Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out86.7%
*-commutative86.7%
unpow286.7%
associate-*l*86.7%
Simplified86.7%
if -0.0539999999999999994 < im < 0.0400000000000000008Initial program 8.7%
sub0-neg8.7%
Simplified8.7%
Taylor expanded in im around 0 99.6%
mul-1-neg99.6%
unsub-neg99.6%
*-commutative99.6%
associate-*l*99.6%
distribute-lft-out--99.6%
Simplified99.6%
if 0.0400000000000000008 < im < 1.09999999999999998e44Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 74.9%
Final simplification97.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* -0.0001984126984126984 (* (cos re) (pow im 7.0)))))
(if (<= im -1.1e+44)
t_1
(if (<= im -2e-5)
t_0
(if (<= im 0.033) (* (cos re) (- im)) (if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_1;
} else if (im <= -2e-5) {
tmp = t_0;
} else if (im <= 0.033) {
tmp = cos(re) * -im;
} else if (im <= 1.1e+44) {
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 = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
if (im <= (-1.1d+44)) then
tmp = t_1
else if (im <= (-2d-5)) then
tmp = t_0
else if (im <= 0.033d0) then
tmp = cos(re) * -im
else if (im <= 1.1d+44) 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 = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_1;
} else if (im <= -2e-5) {
tmp = t_0;
} else if (im <= 0.033) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.1e+44) {
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 = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) tmp = 0 if im <= -1.1e+44: tmp = t_1 elif im <= -2e-5: tmp = t_0 elif im <= 0.033: tmp = math.cos(re) * -im elif im <= 1.1e+44: 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(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -1.1e+44) tmp = t_1; elseif (im <= -2e-5) tmp = t_0; elseif (im <= 0.033) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.1e+44) 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 = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -1.1e+44) tmp = t_1; elseif (im <= -2e-5) tmp = t_0; elseif (im <= 0.033) tmp = cos(re) * -im; elseif (im <= 1.1e+44) 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[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.1e+44], t$95$1, If[LessEqual[im, -2e-5], t$95$0, If[LessEqual[im, 0.033], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.1e+44], 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 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -2 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.033:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.09999999999999998e44 or 1.09999999999999998e44 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -1.09999999999999998e44 < im < -2.00000000000000016e-5 or 0.033000000000000002 < im < 1.09999999999999998e44Initial program 98.6%
sub0-neg98.6%
Simplified98.6%
Taylor expanded in re around 0 77.2%
if -2.00000000000000016e-5 < im < 0.033000000000000002Initial program 7.6%
sub0-neg7.6%
Simplified7.6%
Taylor expanded in im around 0 99.2%
mul-1-neg99.2%
*-commutative99.2%
distribute-lft-neg-in99.2%
Simplified99.2%
Final simplification97.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* -0.0001984126984126984 (* (cos re) (pow im 7.0)))))
(if (<= im -1.1e+44)
t_1
(if (<= im -0.11)
t_0
(if (<= im 0.053)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 2e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_1;
} else if (im <= -0.11) {
tmp = t_0;
} else if (im <= 0.053) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 2e+44) {
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 = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
if (im <= (-1.1d+44)) then
tmp = t_1
else if (im <= (-0.11d0)) then
tmp = t_0
else if (im <= 0.053d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 2d+44) 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 = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_1;
} else if (im <= -0.11) {
tmp = t_0;
} else if (im <= 0.053) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 2e+44) {
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 = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) tmp = 0 if im <= -1.1e+44: tmp = t_1 elif im <= -0.11: tmp = t_0 elif im <= 0.053: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 2e+44: 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(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -1.1e+44) tmp = t_1; elseif (im <= -0.11) tmp = t_0; elseif (im <= 0.053) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 2e+44) 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 = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -1.1e+44) tmp = t_1; elseif (im <= -0.11) tmp = t_0; elseif (im <= 0.053) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 2e+44) 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[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.1e+44], t$95$1, If[LessEqual[im, -0.11], t$95$0, If[LessEqual[im, 0.053], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2e+44], 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 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.11:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.053:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.09999999999999998e44 or 2.0000000000000002e44 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -1.09999999999999998e44 < im < -0.110000000000000001 or 0.0529999999999999985 < im < 2.0000000000000002e44Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 77.0%
if -0.110000000000000001 < im < 0.0529999999999999985Initial program 8.7%
sub0-neg8.7%
Simplified8.7%
Taylor expanded in im around 0 99.6%
mul-1-neg99.6%
unsub-neg99.6%
*-commutative99.6%
associate-*l*99.6%
distribute-lft-out--99.6%
Simplified99.6%
Final simplification97.5%
(FPCore (re im) :precision binary64 (if (or (<= im -4.2) (not (<= im 4.2))) (* -0.0001984126984126984 (* (cos re) (pow im 7.0))) (* (cos re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -4.2) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (cos(re) * pow(im, 7.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) :: tmp
if ((im <= (-4.2d0)) .or. (.not. (im <= 4.2d0))) then
tmp = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
else
tmp = cos(re) * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -4.2) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
} else {
tmp = Math.cos(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -4.2) or not (im <= 4.2): tmp = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) else: tmp = math.cos(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -4.2) || !(im <= 4.2)) tmp = Float64(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))); else tmp = Float64(cos(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -4.2) || ~((im <= 4.2))) tmp = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); else tmp = cos(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -4.2], N[Not[LessEqual[im, 4.2]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -4.2 \lor \neg \left(im \leq 4.2\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -4.20000000000000018 or 4.20000000000000018 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 79.9%
associate-+r+79.9%
+-commutative79.9%
*-commutative79.9%
associate-*l*79.9%
*-commutative79.9%
associate-*l*79.9%
distribute-lft-out79.9%
mul-1-neg79.9%
unsub-neg79.9%
*-commutative79.9%
associate-*l*79.9%
distribute-lft-out--79.9%
distribute-lft-out79.9%
Simplified79.9%
Taylor expanded in im around inf 79.9%
*-commutative79.9%
Simplified79.9%
if -4.20000000000000018 < im < 4.20000000000000018Initial program 9.3%
sub0-neg9.3%
Simplified9.3%
Taylor expanded in im around 0 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-lft-neg-in98.2%
Simplified98.2%
Final simplification90.1%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(- (* (pow im 3.0) -0.16666666666666666) im)
(+ 1.0 (* -0.5 (* re re)))))
(t_1 (* 0.5 (+ (* im -2.0) (* (pow im 5.0) -0.016666666666666666)))))
(if (<= im -3.8e+72)
t_1
(if (<= im -3.15e-6)
t_0
(if (<= im 1.3e+15)
(* (cos re) (- im))
(if (<= im 1.2e+112) t_1 t_0))))))
double code(double re, double im) {
double t_0 = ((pow(im, 3.0) * -0.16666666666666666) - im) * (1.0 + (-0.5 * (re * re)));
double t_1 = 0.5 * ((im * -2.0) + (pow(im, 5.0) * -0.016666666666666666));
double tmp;
if (im <= -3.8e+72) {
tmp = t_1;
} else if (im <= -3.15e-6) {
tmp = t_0;
} else if (im <= 1.3e+15) {
tmp = cos(re) * -im;
} else if (im <= 1.2e+112) {
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)) - im) * (1.0d0 + ((-0.5d0) * (re * re)))
t_1 = 0.5d0 * ((im * (-2.0d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0)))
if (im <= (-3.8d+72)) then
tmp = t_1
else if (im <= (-3.15d-6)) then
tmp = t_0
else if (im <= 1.3d+15) then
tmp = cos(re) * -im
else if (im <= 1.2d+112) 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) - im) * (1.0 + (-0.5 * (re * re)));
double t_1 = 0.5 * ((im * -2.0) + (Math.pow(im, 5.0) * -0.016666666666666666));
double tmp;
if (im <= -3.8e+72) {
tmp = t_1;
} else if (im <= -3.15e-6) {
tmp = t_0;
} else if (im <= 1.3e+15) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.2e+112) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = ((math.pow(im, 3.0) * -0.16666666666666666) - im) * (1.0 + (-0.5 * (re * re))) t_1 = 0.5 * ((im * -2.0) + (math.pow(im, 5.0) * -0.016666666666666666)) tmp = 0 if im <= -3.8e+72: tmp = t_1 elif im <= -3.15e-6: tmp = t_0 elif im <= 1.3e+15: tmp = math.cos(re) * -im elif im <= 1.2e+112: tmp = t_1 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) * Float64(1.0 + Float64(-0.5 * Float64(re * re)))) t_1 = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 5.0) * -0.016666666666666666))) tmp = 0.0 if (im <= -3.8e+72) tmp = t_1; elseif (im <= -3.15e-6) tmp = t_0; elseif (im <= 1.3e+15) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.2e+112) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (((im ^ 3.0) * -0.16666666666666666) - im) * (1.0 + (-0.5 * (re * re))); t_1 = 0.5 * ((im * -2.0) + ((im ^ 5.0) * -0.016666666666666666)); tmp = 0.0; if (im <= -3.8e+72) tmp = t_1; elseif (im <= -3.15e-6) tmp = t_0; elseif (im <= 1.3e+15) tmp = cos(re) * -im; elseif (im <= 1.2e+112) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+72], t$95$1, If[LessEqual[im, -3.15e-6], t$95$0, If[LessEqual[im, 1.3e+15], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.2e+112], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\\
t_1 := 0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\
\mathbf{if}\;im \leq -3.8 \cdot 10^{+72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -3.15 \cdot 10^{-6}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1.3 \cdot 10^{+15}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.2 \cdot 10^{+112}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -3.80000000000000006e72 or 1.3e15 < im < 1.2e112Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 95.9%
Taylor expanded in im around 0 82.5%
Taylor expanded in im around inf 82.5%
*-commutative82.5%
Simplified82.5%
if -3.80000000000000006e72 < im < -3.14999999999999991e-6 or 1.2e112 < im Initial program 99.0%
sub0-neg99.0%
Simplified99.0%
Taylor expanded in im around 0 61.4%
mul-1-neg61.4%
unsub-neg61.4%
*-commutative61.4%
associate-*l*61.4%
distribute-lft-out--61.4%
Simplified61.4%
Taylor expanded in re around 0 18.7%
*-commutative18.7%
associate-+r-18.7%
associate-*r*18.7%
*-commutative18.7%
*-lft-identity18.7%
distribute-rgt-out62.2%
*-commutative62.2%
unpow262.2%
Simplified62.2%
if -3.14999999999999991e-6 < im < 1.3e15Initial program 11.0%
sub0-neg11.0%
Simplified11.0%
Taylor expanded in im around 0 95.5%
mul-1-neg95.5%
*-commutative95.5%
distribute-lft-neg-in95.5%
Simplified95.5%
Final simplification85.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* 0.5 (* im (* re re))) im))
(t_1 (* 0.5 (+ (* im -2.0) (* (pow im 5.0) -0.016666666666666666)))))
(if (<= im -3.6e+72)
t_1
(if (<= im -1.12e+15)
t_0
(if (<= im 1.5e+15)
(* (cos re) (- im))
(if (<= im 5.9e+175)
t_1
(if (<= im 1.75e+196)
t_0
(- (* (pow im 3.0) -0.16666666666666666) im))))))))
double code(double re, double im) {
double t_0 = (0.5 * (im * (re * re))) - im;
double t_1 = 0.5 * ((im * -2.0) + (pow(im, 5.0) * -0.016666666666666666));
double tmp;
if (im <= -3.6e+72) {
tmp = t_1;
} else if (im <= -1.12e+15) {
tmp = t_0;
} else if (im <= 1.5e+15) {
tmp = cos(re) * -im;
} else if (im <= 5.9e+175) {
tmp = t_1;
} else if (im <= 1.75e+196) {
tmp = t_0;
} else {
tmp = (pow(im, 3.0) * -0.16666666666666666) - im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (0.5d0 * (im * (re * re))) - im
t_1 = 0.5d0 * ((im * (-2.0d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0)))
if (im <= (-3.6d+72)) then
tmp = t_1
else if (im <= (-1.12d+15)) then
tmp = t_0
else if (im <= 1.5d+15) then
tmp = cos(re) * -im
else if (im <= 5.9d+175) then
tmp = t_1
else if (im <= 1.75d+196) then
tmp = t_0
else
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (0.5 * (im * (re * re))) - im;
double t_1 = 0.5 * ((im * -2.0) + (Math.pow(im, 5.0) * -0.016666666666666666));
double tmp;
if (im <= -3.6e+72) {
tmp = t_1;
} else if (im <= -1.12e+15) {
tmp = t_0;
} else if (im <= 1.5e+15) {
tmp = Math.cos(re) * -im;
} else if (im <= 5.9e+175) {
tmp = t_1;
} else if (im <= 1.75e+196) {
tmp = t_0;
} else {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
}
return tmp;
}
def code(re, im): t_0 = (0.5 * (im * (re * re))) - im t_1 = 0.5 * ((im * -2.0) + (math.pow(im, 5.0) * -0.016666666666666666)) tmp = 0 if im <= -3.6e+72: tmp = t_1 elif im <= -1.12e+15: tmp = t_0 elif im <= 1.5e+15: tmp = math.cos(re) * -im elif im <= 5.9e+175: tmp = t_1 elif im <= 1.75e+196: tmp = t_0 else: tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im return tmp
function code(re, im) t_0 = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im) t_1 = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 5.0) * -0.016666666666666666))) tmp = 0.0 if (im <= -3.6e+72) tmp = t_1; elseif (im <= -1.12e+15) tmp = t_0; elseif (im <= 1.5e+15) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 5.9e+175) tmp = t_1; elseif (im <= 1.75e+196) tmp = t_0; else tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im); end return tmp end
function tmp_2 = code(re, im) t_0 = (0.5 * (im * (re * re))) - im; t_1 = 0.5 * ((im * -2.0) + ((im ^ 5.0) * -0.016666666666666666)); tmp = 0.0; if (im <= -3.6e+72) tmp = t_1; elseif (im <= -1.12e+15) tmp = t_0; elseif (im <= 1.5e+15) tmp = cos(re) * -im; elseif (im <= 5.9e+175) tmp = t_1; elseif (im <= 1.75e+196) tmp = t_0; else tmp = ((im ^ 3.0) * -0.16666666666666666) - im; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.6e+72], t$95$1, If[LessEqual[im, -1.12e+15], t$95$0, If[LessEqual[im, 1.5e+15], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 5.9e+175], t$95$1, If[LessEqual[im, 1.75e+196], t$95$0, N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\
t_1 := 0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\
\mathbf{if}\;im \leq -3.6 \cdot 10^{+72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.12 \cdot 10^{+15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+15}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 5.9 \cdot 10^{+175}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 1.75 \cdot 10^{+196}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\end{array}
\end{array}
if im < -3.60000000000000035e72 or 1.5e15 < im < 5.9000000000000003e175Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 89.1%
Taylor expanded in im around 0 78.8%
Taylor expanded in im around inf 78.8%
*-commutative78.8%
Simplified78.8%
if -3.60000000000000035e72 < im < -1.12e15 or 5.9000000000000003e175 < im < 1.7499999999999999e196Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.8%
mul-1-neg3.8%
*-commutative3.8%
distribute-lft-neg-in3.8%
Simplified3.8%
Taylor expanded in re around 0 44.3%
neg-mul-144.3%
+-commutative44.3%
unsub-neg44.3%
*-commutative44.3%
unpow244.3%
Simplified44.3%
if -1.12e15 < im < 1.5e15Initial program 14.7%
sub0-neg14.7%
Simplified14.7%
Taylor expanded in im around 0 92.6%
mul-1-neg92.6%
*-commutative92.6%
distribute-lft-neg-in92.6%
Simplified92.6%
if 1.7499999999999999e196 < im Initial 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 78.6%
Final simplification83.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im))
(t_1 (- (* 0.5 (* im (* re re))) im)))
(if (<= im -9.2e+77)
t_0
(if (<= im -8.6e+16)
t_1
(if (<= im 0.058)
(* (cos re) (- im))
(if (or (<= im 5.9e+175) (not (<= im 1.75e+196))) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double t_1 = (0.5 * (im * (re * re))) - im;
double tmp;
if (im <= -9.2e+77) {
tmp = t_0;
} else if (im <= -8.6e+16) {
tmp = t_1;
} else if (im <= 0.058) {
tmp = cos(re) * -im;
} else if ((im <= 5.9e+175) || !(im <= 1.75e+196)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
t_1 = (0.5d0 * (im * (re * re))) - im
if (im <= (-9.2d+77)) then
tmp = t_0
else if (im <= (-8.6d+16)) then
tmp = t_1
else if (im <= 0.058d0) then
tmp = cos(re) * -im
else if ((im <= 5.9d+175) .or. (.not. (im <= 1.75d+196))) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double t_1 = (0.5 * (im * (re * re))) - im;
double tmp;
if (im <= -9.2e+77) {
tmp = t_0;
} else if (im <= -8.6e+16) {
tmp = t_1;
} else if (im <= 0.058) {
tmp = Math.cos(re) * -im;
} else if ((im <= 5.9e+175) || !(im <= 1.75e+196)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im t_1 = (0.5 * (im * (re * re))) - im tmp = 0 if im <= -9.2e+77: tmp = t_0 elif im <= -8.6e+16: tmp = t_1 elif im <= 0.058: tmp = math.cos(re) * -im elif (im <= 5.9e+175) or not (im <= 1.75e+196): tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) t_1 = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im) tmp = 0.0 if (im <= -9.2e+77) tmp = t_0; elseif (im <= -8.6e+16) tmp = t_1; elseif (im <= 0.058) tmp = Float64(cos(re) * Float64(-im)); elseif ((im <= 5.9e+175) || !(im <= 1.75e+196)) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; t_1 = (0.5 * (im * (re * re))) - im; tmp = 0.0; if (im <= -9.2e+77) tmp = t_0; elseif (im <= -8.6e+16) tmp = t_1; elseif (im <= 0.058) tmp = cos(re) * -im; elseif ((im <= 5.9e+175) || ~((im <= 1.75e+196))) tmp = t_0; else tmp = t_1; 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]}, Block[{t$95$1 = N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -9.2e+77], t$95$0, If[LessEqual[im, -8.6e+16], t$95$1, If[LessEqual[im, 0.058], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[Or[LessEqual[im, 5.9e+175], N[Not[LessEqual[im, 1.75e+196]], $MachinePrecision]], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
t_1 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{if}\;im \leq -9.2 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -8.6 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 0.058:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 5.9 \cdot 10^{+175} \lor \neg \left(im \leq 1.75 \cdot 10^{+196}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -9.19999999999999979e77 or 0.0580000000000000029 < im < 5.9000000000000003e175 or 1.7499999999999999e196 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 76.6%
mul-1-neg76.6%
unsub-neg76.6%
*-commutative76.6%
associate-*l*76.6%
distribute-lft-out--76.6%
Simplified76.6%
Taylor expanded in re around 0 64.7%
if -9.19999999999999979e77 < im < -8.6e16 or 5.9000000000000003e175 < im < 1.7499999999999999e196Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.8%
mul-1-neg3.8%
*-commutative3.8%
distribute-lft-neg-in3.8%
Simplified3.8%
Taylor expanded in re around 0 45.9%
neg-mul-145.9%
+-commutative45.9%
unsub-neg45.9%
*-commutative45.9%
unpow245.9%
Simplified45.9%
if -8.6e16 < im < 0.0580000000000000029Initial program 11.8%
sub0-neg11.8%
Simplified11.8%
Taylor expanded in im around 0 95.5%
mul-1-neg95.5%
*-commutative95.5%
distribute-lft-neg-in95.5%
Simplified95.5%
Final simplification80.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* re re) 0.75)) (t_1 (- (* 0.5 (* im (* re re))) im)))
(if (<= im -2.25e+123)
(* im (* (pow re 4.0) -0.041666666666666664))
(if (<= im -8500000000.0)
t_1
(if (<= im -1700000000.0)
(/ (- 2.25 (* t_0 t_0)) (- -1.5 t_0))
(if (<= im 250.0) (* (cos re) (- im)) t_1))))))
double code(double re, double im) {
double t_0 = (re * re) * 0.75;
double t_1 = (0.5 * (im * (re * re))) - im;
double tmp;
if (im <= -2.25e+123) {
tmp = im * (pow(re, 4.0) * -0.041666666666666664);
} else if (im <= -8500000000.0) {
tmp = t_1;
} else if (im <= -1700000000.0) {
tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
} else if (im <= 250.0) {
tmp = cos(re) * -im;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (re * re) * 0.75d0
t_1 = (0.5d0 * (im * (re * re))) - im
if (im <= (-2.25d+123)) then
tmp = im * ((re ** 4.0d0) * (-0.041666666666666664d0))
else if (im <= (-8500000000.0d0)) then
tmp = t_1
else if (im <= (-1700000000.0d0)) then
tmp = (2.25d0 - (t_0 * t_0)) / ((-1.5d0) - t_0)
else if (im <= 250.0d0) then
tmp = cos(re) * -im
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (re * re) * 0.75;
double t_1 = (0.5 * (im * (re * re))) - im;
double tmp;
if (im <= -2.25e+123) {
tmp = im * (Math.pow(re, 4.0) * -0.041666666666666664);
} else if (im <= -8500000000.0) {
tmp = t_1;
} else if (im <= -1700000000.0) {
tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
} else if (im <= 250.0) {
tmp = Math.cos(re) * -im;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (re * re) * 0.75 t_1 = (0.5 * (im * (re * re))) - im tmp = 0 if im <= -2.25e+123: tmp = im * (math.pow(re, 4.0) * -0.041666666666666664) elif im <= -8500000000.0: tmp = t_1 elif im <= -1700000000.0: tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0) elif im <= 250.0: tmp = math.cos(re) * -im else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(re * re) * 0.75) t_1 = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im) tmp = 0.0 if (im <= -2.25e+123) tmp = Float64(im * Float64((re ^ 4.0) * -0.041666666666666664)); elseif (im <= -8500000000.0) tmp = t_1; elseif (im <= -1700000000.0) tmp = Float64(Float64(2.25 - Float64(t_0 * t_0)) / Float64(-1.5 - t_0)); elseif (im <= 250.0) tmp = Float64(cos(re) * Float64(-im)); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (re * re) * 0.75; t_1 = (0.5 * (im * (re * re))) - im; tmp = 0.0; if (im <= -2.25e+123) tmp = im * ((re ^ 4.0) * -0.041666666666666664); elseif (im <= -8500000000.0) tmp = t_1; elseif (im <= -1700000000.0) tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0); elseif (im <= 250.0) tmp = cos(re) * -im; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -2.25e+123], N[(im * N[(N[Power[re, 4.0], $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -8500000000.0], t$95$1, If[LessEqual[im, -1700000000.0], N[(N[(2.25 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-1.5 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 250.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot 0.75\\
t_1 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{if}\;im \leq -2.25 \cdot 10^{+123}:\\
\;\;\;\;im \cdot \left({re}^{4} \cdot -0.041666666666666664\right)\\
\mathbf{elif}\;im \leq -8500000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1700000000:\\
\;\;\;\;\frac{2.25 - t_0 \cdot t_0}{-1.5 - t_0}\\
\mathbf{elif}\;im \leq 250:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.24999999999999991e123Initial 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 6.4%
neg-mul-16.4%
associate-+r+6.4%
+-commutative6.4%
associate-*r*6.4%
*-commutative6.4%
associate-*r*6.4%
neg-mul-16.4%
distribute-rgt-out6.4%
distribute-lft-out29.8%
*-commutative29.8%
unpow229.8%
*-commutative29.8%
Simplified29.8%
Taylor expanded in re around inf 41.1%
*-commutative41.1%
Simplified41.1%
if -2.24999999999999991e123 < im < -8.5e9 or 250 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.5%
mul-1-neg4.5%
*-commutative4.5%
distribute-lft-neg-in4.5%
Simplified4.5%
Taylor expanded in re around 0 25.0%
neg-mul-125.0%
+-commutative25.0%
unsub-neg25.0%
*-commutative25.0%
unpow225.0%
Simplified25.0%
if -8.5e9 < im < -1.7e9Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out0.0%
*-commutative0.0%
unpow20.0%
associate-*l*0.0%
Simplified0.0%
Applied egg-rr6.9%
distribute-lft-in6.9%
flip-+100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*l*100.0%
metadata-eval100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*l*100.0%
metadata-eval100.0%
metadata-eval100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*l*100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if -1.7e9 < im < 250Initial program 9.9%
sub0-neg9.9%
Simplified9.9%
Taylor expanded in im around 0 97.6%
mul-1-neg97.6%
*-commutative97.6%
distribute-lft-neg-in97.6%
Simplified97.6%
Final simplification68.0%
(FPCore (re im) :precision binary64 (if (or (<= im -1.36e+17) (not (<= im 250.0))) (- (* 0.5 (* im (* re re))) im) (* (cos re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -1.36e+17) || !(im <= 250.0)) {
tmp = (0.5 * (im * (re * 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 <= (-1.36d+17)) .or. (.not. (im <= 250.0d0))) then
tmp = (0.5d0 * (im * (re * 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 <= -1.36e+17) || !(im <= 250.0)) {
tmp = (0.5 * (im * (re * re))) - im;
} else {
tmp = Math.cos(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.36e+17) or not (im <= 250.0): tmp = (0.5 * (im * (re * re))) - im else: tmp = math.cos(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.36e+17) || !(im <= 250.0)) tmp = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im); else tmp = Float64(cos(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.36e+17) || ~((im <= 250.0))) tmp = (0.5 * (im * (re * re))) - im; else tmp = cos(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.36e+17], N[Not[LessEqual[im, 250.0]], $MachinePrecision]], N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.36 \cdot 10^{+17} \lor \neg \left(im \leq 250\right):\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -1.36e17 or 250 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.0%
mul-1-neg5.0%
*-commutative5.0%
distribute-lft-neg-in5.0%
Simplified5.0%
Taylor expanded in re around 0 21.3%
neg-mul-121.3%
+-commutative21.3%
unsub-neg21.3%
*-commutative21.3%
unpow221.3%
Simplified21.3%
if -1.36e17 < im < 250Initial program 12.4%
sub0-neg12.4%
Simplified12.4%
Taylor expanded in im around 0 95.0%
mul-1-neg95.0%
*-commutative95.0%
distribute-lft-neg-in95.0%
Simplified95.0%
Final simplification63.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* re re) 0.75)))
(if (<= re 9.6e+76)
(- im)
(if (<= re 8.5e+153)
(/ (- 2.25 (* t_0 t_0)) (- -1.5 t_0))
(* (+ 0.5 (* re (* re -0.25))) 27.0)))))
double code(double re, double im) {
double t_0 = (re * re) * 0.75;
double tmp;
if (re <= 9.6e+76) {
tmp = -im;
} else if (re <= 8.5e+153) {
tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
} else {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (re * re) * 0.75d0
if (re <= 9.6d+76) then
tmp = -im
else if (re <= 8.5d+153) then
tmp = (2.25d0 - (t_0 * t_0)) / ((-1.5d0) - t_0)
else
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * 27.0d0
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 <= 9.6e+76) {
tmp = -im;
} else if (re <= 8.5e+153) {
tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
} else {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
}
return tmp;
}
def code(re, im): t_0 = (re * re) * 0.75 tmp = 0 if re <= 9.6e+76: tmp = -im elif re <= 8.5e+153: tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0) else: tmp = (0.5 + (re * (re * -0.25))) * 27.0 return tmp
function code(re, im) t_0 = Float64(Float64(re * re) * 0.75) tmp = 0.0 if (re <= 9.6e+76) tmp = Float64(-im); elseif (re <= 8.5e+153) tmp = Float64(Float64(2.25 - Float64(t_0 * t_0)) / Float64(-1.5 - t_0)); else tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * 27.0); end return tmp end
function tmp_2 = code(re, im) t_0 = (re * re) * 0.75; tmp = 0.0; if (re <= 9.6e+76) tmp = -im; elseif (re <= 8.5e+153) tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0); else tmp = (0.5 + (re * (re * -0.25))) * 27.0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]}, If[LessEqual[re, 9.6e+76], (-im), If[LessEqual[re, 8.5e+153], N[(N[(2.25 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-1.5 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 27.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot 0.75\\
\mathbf{if}\;re \leq 9.6 \cdot 10^{+76}:\\
\;\;\;\;-im\\
\mathbf{elif}\;re \leq 8.5 \cdot 10^{+153}:\\
\;\;\;\;\frac{2.25 - t_0 \cdot t_0}{-1.5 - t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\
\end{array}
\end{array}
if re < 9.5999999999999999e76Initial program 49.5%
sub0-neg49.5%
Simplified49.5%
Taylor expanded in im around 0 56.9%
mul-1-neg56.9%
*-commutative56.9%
distribute-lft-neg-in56.9%
Simplified56.9%
Taylor expanded in re around 0 42.6%
neg-mul-142.6%
Simplified42.6%
if 9.5999999999999999e76 < re < 8.49999999999999935e153Initial program 63.4%
sub0-neg63.4%
Simplified63.4%
Taylor expanded in re around 0 2.2%
+-commutative2.2%
*-commutative2.2%
associate-*r*2.2%
distribute-rgt-out32.9%
*-commutative32.9%
unpow232.9%
associate-*l*32.9%
Simplified32.9%
Applied egg-rr2.5%
distribute-lft-in2.5%
flip-+31.4%
metadata-eval31.4%
metadata-eval31.4%
metadata-eval31.4%
*-commutative31.4%
associate-*r*31.4%
associate-*l*31.4%
metadata-eval31.4%
*-commutative31.4%
associate-*r*31.4%
associate-*l*31.4%
metadata-eval31.4%
metadata-eval31.4%
*-commutative31.4%
associate-*r*31.4%
associate-*l*31.4%
metadata-eval31.4%
Applied egg-rr31.4%
if 8.49999999999999935e153 < re Initial program 42.6%
sub0-neg42.6%
Simplified42.6%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out19.4%
*-commutative19.4%
unpow219.4%
associate-*l*19.4%
Simplified19.4%
Applied egg-rr23.7%
Final simplification39.7%
(FPCore (re im) :precision binary64 (if (<= re 2.85e+158) (- im) (* (+ 0.5 (* re (* re -0.25))) 27.0)))
double code(double re, double im) {
double tmp;
if (re <= 2.85e+158) {
tmp = -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.85d+158) then
tmp = -im
else
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * 27.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.85e+158) {
tmp = -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.85e+158: tmp = -im else: tmp = (0.5 + (re * (re * -0.25))) * 27.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 2.85e+158) tmp = Float64(-im); else tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * 27.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.85e+158) tmp = -im; else tmp = (0.5 + (re * (re * -0.25))) * 27.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.85e+158], (-im), N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 27.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.85 \cdot 10^{+158}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\
\end{array}
\end{array}
if re < 2.8500000000000001e158Initial program 50.1%
sub0-neg50.1%
Simplified50.1%
Taylor expanded in im around 0 56.4%
mul-1-neg56.4%
*-commutative56.4%
distribute-lft-neg-in56.4%
Simplified56.4%
Taylor expanded in re around 0 40.3%
neg-mul-140.3%
Simplified40.3%
if 2.8500000000000001e158 < re Initial program 43.8%
sub0-neg43.8%
Simplified43.8%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out20.0%
*-commutative20.0%
unpow220.0%
associate-*l*20.0%
Simplified20.0%
Applied egg-rr24.4%
Final simplification38.4%
(FPCore (re im) :precision binary64 (- (* 0.5 (* im (* re re))) im))
double code(double re, double im) {
return (0.5 * (im * (re * re))) - im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * (im * (re * re))) - im
end function
public static double code(double re, double im) {
return (0.5 * (im * (re * re))) - im;
}
def code(re, im): return (0.5 * (im * (re * re))) - im
function code(re, im) return Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im) end
function tmp = code(re, im) tmp = (0.5 * (im * (re * re))) - im; end
code[re_, im_] := N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im
\end{array}
Initial program 49.3%
sub0-neg49.3%
Simplified49.3%
Taylor expanded in im around 0 57.0%
mul-1-neg57.0%
*-commutative57.0%
distribute-lft-neg-in57.0%
Simplified57.0%
Taylor expanded in re around 0 41.6%
neg-mul-141.6%
+-commutative41.6%
unsub-neg41.6%
*-commutative41.6%
unpow241.6%
Simplified41.6%
Final simplification41.6%
(FPCore (re im) :precision binary64 (if (<= re 1.75e+190) (- im) (* re (* re 0.75))))
double code(double re, double im) {
double tmp;
if (re <= 1.75e+190) {
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.75d+190) 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.75e+190) {
tmp = -im;
} else {
tmp = re * (re * 0.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.75e+190: tmp = -im else: tmp = re * (re * 0.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.75e+190) tmp = Float64(-im); else tmp = Float64(re * Float64(re * 0.75)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.75e+190) tmp = -im; else tmp = re * (re * 0.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.75e+190], (-im), N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.75 \cdot 10^{+190}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\end{array}
\end{array}
if re < 1.7499999999999999e190Initial program 49.7%
sub0-neg49.7%
Simplified49.7%
Taylor expanded in im around 0 56.7%
mul-1-neg56.7%
*-commutative56.7%
distribute-lft-neg-in56.7%
Simplified56.7%
Taylor expanded in re around 0 40.0%
neg-mul-140.0%
Simplified40.0%
if 1.7499999999999999e190 < re Initial program 46.7%
sub0-neg46.7%
Simplified46.7%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out21.5%
*-commutative21.5%
unpow221.5%
associate-*l*21.5%
Simplified21.5%
Applied egg-rr18.8%
Taylor expanded in re around inf 18.8%
*-commutative18.8%
unpow218.8%
associate-*l*18.8%
Simplified18.8%
Final simplification37.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 49.3%
sub0-neg49.3%
Simplified49.3%
Taylor expanded in im around 0 57.0%
mul-1-neg57.0%
*-commutative57.0%
distribute-lft-neg-in57.0%
Simplified57.0%
Taylor expanded in re around 0 36.7%
neg-mul-136.7%
Simplified36.7%
Final simplification36.7%
(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 49.3%
sub0-neg49.3%
Simplified49.3%
Taylor expanded in re around 0 4.1%
+-commutative4.1%
*-commutative4.1%
associate-*r*4.1%
distribute-rgt-out37.3%
*-commutative37.3%
unpow237.3%
associate-*l*37.3%
Simplified37.3%
Applied egg-rr6.0%
Taylor expanded in re around 0 2.8%
Final simplification2.8%
(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 2023199
(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))))