
(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 (- INFINITY)) (not (<= t_0 5e-5)))
(* (* 0.5 (cos re)) t_0)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 5e-5)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 5e-5)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 5e-5): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 5e-5)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 5e-5))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 5e-5]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 5.00000000000000024e-5 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 5.00000000000000024e-5Initial program 8.9%
sub0-neg8.9%
Simplified8.9%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(if (or (<= im -8.6e+89)
(not
(or (<= im -2.3e+15) (and (not (<= im 0.055)) (<= im 5.7e+102)))))
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(* 0.5 (- (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if ((im <= -8.6e+89) || !((im <= -2.3e+15) || (!(im <= 0.055) && (im <= 5.7e+102)))) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = 0.5 * (exp(-im) - exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-8.6d+89)) .or. (.not. (im <= (-2.3d+15)) .or. (.not. (im <= 0.055d0)) .and. (im <= 5.7d+102))) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else
tmp = 0.5d0 * (exp(-im) - exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -8.6e+89) || !((im <= -2.3e+15) || (!(im <= 0.055) && (im <= 5.7e+102)))) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -8.6e+89) or not ((im <= -2.3e+15) or (not (im <= 0.055) and (im <= 5.7e+102))): tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) else: tmp = 0.5 * (math.exp(-im) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if ((im <= -8.6e+89) || !((im <= -2.3e+15) || (!(im <= 0.055) && (im <= 5.7e+102)))) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); else tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -8.6e+89) || ~(((im <= -2.3e+15) || (~((im <= 0.055)) && (im <= 5.7e+102))))) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); else tmp = 0.5 * (exp(-im) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -8.6e+89], N[Not[Or[LessEqual[im, -2.3e+15], And[N[Not[LessEqual[im, 0.055]], $MachinePrecision], LessEqual[im, 5.7e+102]]]], $MachinePrecision]], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -8.6 \cdot 10^{+89} \lor \neg \left(im \leq -2.3 \cdot 10^{+15} \lor \neg \left(im \leq 0.055\right) \land im \leq 5.7 \cdot 10^{+102}\right):\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\end{array}
if im < -8.6000000000000003e89 or -2.3e15 < im < 0.0550000000000000003 or 5.6999999999999999e102 < im Initial program 47.6%
sub0-neg47.6%
Simplified47.6%
Taylor expanded in im around 0 98.5%
mul-1-neg98.5%
unsub-neg98.5%
*-commutative98.5%
associate-*l*98.5%
distribute-lft-out--98.5%
Simplified98.5%
if -8.6000000000000003e89 < im < -2.3e15 or 0.0550000000000000003 < im < 5.6999999999999999e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 83.9%
Final simplification95.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (/ (* (cos re) (- 9.0 (* im im))) (+ im -3.0))))
(if (<= im -1.35e+154)
t_1
(if (<= im -1.7e-5)
t_0
(if (<= im 0.00027)
(* (cos re) (- im))
(if (<= im 1.32e+154) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = (cos(re) * (9.0 - (im * im))) / (im + -3.0);
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -1.7e-5) {
tmp = t_0;
} else if (im <= 0.00027) {
tmp = cos(re) * -im;
} else if (im <= 1.32e+154) {
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) * (9.0d0 - (im * im))) / (im + (-3.0d0))
if (im <= (-1.35d+154)) then
tmp = t_1
else if (im <= (-1.7d-5)) then
tmp = t_0
else if (im <= 0.00027d0) then
tmp = cos(re) * -im
else if (im <= 1.32d+154) 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) * (9.0 - (im * im))) / (im + -3.0);
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -1.7e-5) {
tmp = t_0;
} else if (im <= 0.00027) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.32e+154) {
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) * (9.0 - (im * im))) / (im + -3.0) tmp = 0 if im <= -1.35e+154: tmp = t_1 elif im <= -1.7e-5: tmp = t_0 elif im <= 0.00027: tmp = math.cos(re) * -im elif im <= 1.32e+154: 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(Float64(cos(re) * Float64(9.0 - Float64(im * im))) / Float64(im + -3.0)) tmp = 0.0 if (im <= -1.35e+154) tmp = t_1; elseif (im <= -1.7e-5) tmp = t_0; elseif (im <= 0.00027) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.32e+154) 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) * (9.0 - (im * im))) / (im + -3.0); tmp = 0.0; if (im <= -1.35e+154) tmp = t_1; elseif (im <= -1.7e-5) tmp = t_0; elseif (im <= 0.00027) tmp = cos(re) * -im; elseif (im <= 1.32e+154) 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[(N[Cos[re], $MachinePrecision] * N[(9.0 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -1.7e-5], t$95$0, If[LessEqual[im, 0.00027], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.32e+154], 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 := \frac{\cos re \cdot \left(9 - im \cdot im\right)}{im + -3}\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.7 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.00027:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or 1.31999999999999998e154 < 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%
Applied egg-rr7.0%
*-commutative7.0%
flip--100.0%
associate-*l/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
if -1.35000000000000003e154 < im < -1.7e-5 or 2.70000000000000003e-4 < im < 1.31999999999999998e154Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in re around 0 77.5%
if -1.7e-5 < im < 2.70000000000000003e-4Initial program 8.2%
sub0-neg8.2%
Simplified8.2%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Final simplification92.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im))
(t_1 (/ (* (cos re) (- 9.0 (* im im))) (+ im -3.0)))
(t_2 (* (- -3.0 im) (fma re (* 0.5 re) 1.0))))
(if (<= im -1.35e+154)
t_1
(if (<= im -4.8e+85)
t_0
(if (<= im -1.48e+23)
t_2
(if (<= im 515000000.0)
(* (cos re) (- im))
(if (<= im 4.2e+100) t_2 (if (<= im 1.32e+154) t_0 t_1))))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double t_1 = (cos(re) * (9.0 - (im * im))) / (im + -3.0);
double t_2 = (-3.0 - im) * fma(re, (0.5 * re), 1.0);
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -4.8e+85) {
tmp = t_0;
} else if (im <= -1.48e+23) {
tmp = t_2;
} else if (im <= 515000000.0) {
tmp = cos(re) * -im;
} else if (im <= 4.2e+100) {
tmp = t_2;
} else if (im <= 1.32e+154) {
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(cos(re) * Float64(9.0 - Float64(im * im))) / Float64(im + -3.0)) t_2 = Float64(Float64(-3.0 - im) * fma(re, Float64(0.5 * re), 1.0)) tmp = 0.0 if (im <= -1.35e+154) tmp = t_1; elseif (im <= -4.8e+85) tmp = t_0; elseif (im <= -1.48e+23) tmp = t_2; elseif (im <= 515000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 4.2e+100) tmp = t_2; elseif (im <= 1.32e+154) tmp = t_0; else tmp = t_1; end return 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[(N[Cos[re], $MachinePrecision] * N[(9.0 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-3.0 - im), $MachinePrecision] * N[(re * N[(0.5 * re), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -4.8e+85], t$95$0, If[LessEqual[im, -1.48e+23], t$95$2, If[LessEqual[im, 515000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 4.2e+100], t$95$2, If[LessEqual[im, 1.32e+154], t$95$0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
t_1 := \frac{\cos re \cdot \left(9 - im \cdot im\right)}{im + -3}\\
t_2 := \left(-3 - im\right) \cdot \mathsf{fma}\left(re, 0.5 \cdot re, 1\right)\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -4.8 \cdot 10^{+85}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.48 \cdot 10^{+23}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 515000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+100}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or 1.31999999999999998e154 < 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%
Applied egg-rr7.0%
*-commutative7.0%
flip--100.0%
associate-*l/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
if -1.35000000000000003e154 < im < -4.79999999999999993e85 or 4.1999999999999997e100 < im < 1.31999999999999998e154Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*l*85.4%
distribute-lft-out--85.4%
Simplified85.4%
Taylor expanded in re around 0 60.8%
if -4.79999999999999993e85 < im < -1.4799999999999999e23 or 5.15e8 < im < 4.1999999999999997e100Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.1%
mul-1-neg5.1%
unsub-neg5.1%
*-commutative5.1%
associate-*l*5.1%
distribute-lft-out--5.1%
Simplified5.1%
Applied egg-rr3.6%
Taylor expanded in re around 0 8.5%
associate-*r*8.5%
distribute-rgt-out8.5%
+-commutative8.5%
metadata-eval8.5%
metadata-eval8.5%
distribute-lft-neg-in8.5%
unpow28.5%
associate-*r*8.5%
*-commutative8.5%
distribute-neg-in8.5%
+-commutative8.5%
distribute-neg-in8.5%
*-commutative8.5%
distribute-lft-neg-in8.5%
distribute-lft-neg-in8.5%
metadata-eval8.5%
metadata-eval8.5%
Simplified8.5%
distribute-rgt-in8.5%
add-sqr-sqrt8.5%
associate-*l*8.5%
*-commutative8.5%
fma-def8.5%
Applied egg-rr0.0%
fma-udef0.0%
+-commutative0.0%
*-lft-identity0.0%
associate-*r*0.0%
swap-sqr0.0%
unpow20.0%
rem-square-sqrt28.8%
metadata-eval28.8%
associate-*l*28.8%
unpow228.8%
associate-*r*28.8%
*-commutative28.8%
associate-*r*28.8%
*-commutative28.8%
*-commutative28.8%
associate-*l*28.8%
neg-mul-128.8%
distribute-lft-neg-in28.8%
distribute-rgt-neg-in28.8%
neg-mul-128.8%
distribute-rgt-in28.8%
metadata-eval28.8%
fma-udef28.8%
Simplified28.8%
if -1.4799999999999999e23 < im < 5.15e8Initial program 13.4%
sub0-neg13.4%
Simplified13.4%
Taylor expanded in im around 0 94.7%
mul-1-neg94.7%
*-commutative94.7%
distribute-lft-neg-in94.7%
Simplified94.7%
Final simplification80.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im))
(t_1 (* (+ (* -0.5 (* re re)) 1.0) t_0)))
(if (<= im -1.75e+84)
t_1
(if (<= im -1.55e+23)
(* (- -3.0 im) (fma re (* 0.5 re) 1.0))
(if (<= im -1.7e-5)
t_1
(if (<= im 9000000000.0)
(* (cos re) (- im))
(if (<= im 1.32e+154)
(* re (* t_0 (* 0.5 re)))
(/ (* (cos re) (- 9.0 (* im im))) (+ im -3.0)))))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double t_1 = ((-0.5 * (re * re)) + 1.0) * t_0;
double tmp;
if (im <= -1.75e+84) {
tmp = t_1;
} else if (im <= -1.55e+23) {
tmp = (-3.0 - im) * fma(re, (0.5 * re), 1.0);
} else if (im <= -1.7e-5) {
tmp = t_1;
} else if (im <= 9000000000.0) {
tmp = cos(re) * -im;
} else if (im <= 1.32e+154) {
tmp = re * (t_0 * (0.5 * re));
} else {
tmp = (cos(re) * (9.0 - (im * im))) / (im + -3.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) t_1 = Float64(Float64(Float64(-0.5 * Float64(re * re)) + 1.0) * t_0) tmp = 0.0 if (im <= -1.75e+84) tmp = t_1; elseif (im <= -1.55e+23) tmp = Float64(Float64(-3.0 - im) * fma(re, Float64(0.5 * re), 1.0)); elseif (im <= -1.7e-5) tmp = t_1; elseif (im <= 9000000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.32e+154) tmp = Float64(re * Float64(t_0 * Float64(0.5 * re))); else tmp = Float64(Float64(cos(re) * Float64(9.0 - Float64(im * im))) / Float64(im + -3.0)); end return 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[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[im, -1.75e+84], t$95$1, If[LessEqual[im, -1.55e+23], N[(N[(-3.0 - im), $MachinePrecision] * N[(re * N[(0.5 * re), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -1.7e-5], t$95$1, If[LessEqual[im, 9000000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.32e+154], N[(re * N[(t$95$0 * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[re], $MachinePrecision] * N[(9.0 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + -3.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
t_1 := \left(-0.5 \cdot \left(re \cdot re\right) + 1\right) \cdot t_0\\
\mathbf{if}\;im \leq -1.75 \cdot 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.55 \cdot 10^{+23}:\\
\;\;\;\;\left(-3 - im\right) \cdot \mathsf{fma}\left(re, 0.5 \cdot re, 1\right)\\
\mathbf{elif}\;im \leq -1.7 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 9000000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;re \cdot \left(t_0 \cdot \left(0.5 \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos re \cdot \left(9 - im \cdot im\right)}{im + -3}\\
\end{array}
\end{array}
if im < -1.7499999999999999e84 or -1.54999999999999985e23 < im < -1.7e-5Initial program 99.6%
sub0-neg99.6%
Simplified99.6%
Taylor expanded in im around 0 86.8%
mul-1-neg86.8%
unsub-neg86.8%
*-commutative86.8%
associate-*l*86.8%
distribute-lft-out--86.8%
Simplified86.8%
Taylor expanded in re around 0 10.3%
associate--l+10.3%
associate-*r*10.3%
distribute-lft1-in82.3%
unpow282.3%
Simplified82.3%
if -1.7499999999999999e84 < im < -1.54999999999999985e23Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.9%
mul-1-neg4.9%
unsub-neg4.9%
*-commutative4.9%
associate-*l*4.9%
distribute-lft-out--4.9%
Simplified4.9%
Applied egg-rr3.5%
Taylor expanded in re around 0 2.5%
associate-*r*2.5%
distribute-rgt-out2.5%
+-commutative2.5%
metadata-eval2.5%
metadata-eval2.5%
distribute-lft-neg-in2.5%
unpow22.5%
associate-*r*2.5%
*-commutative2.5%
distribute-neg-in2.5%
+-commutative2.5%
distribute-neg-in2.5%
*-commutative2.5%
distribute-lft-neg-in2.5%
distribute-lft-neg-in2.5%
metadata-eval2.5%
metadata-eval2.5%
Simplified2.5%
distribute-rgt-in2.5%
add-sqr-sqrt2.5%
associate-*l*2.5%
*-commutative2.5%
fma-def2.5%
Applied egg-rr0.0%
fma-udef0.0%
+-commutative0.0%
*-lft-identity0.0%
associate-*r*0.0%
swap-sqr0.0%
unpow20.0%
rem-square-sqrt29.0%
metadata-eval29.0%
associate-*l*29.0%
unpow229.0%
associate-*r*29.0%
*-commutative29.0%
associate-*r*29.0%
*-commutative29.0%
*-commutative29.0%
associate-*l*29.0%
neg-mul-129.0%
distribute-lft-neg-in29.0%
distribute-rgt-neg-in29.0%
neg-mul-129.0%
distribute-rgt-in29.0%
metadata-eval29.0%
fma-udef29.0%
Simplified29.0%
if -1.7e-5 < im < 9e9Initial program 10.6%
sub0-neg10.6%
Simplified10.6%
Taylor expanded in im around 0 97.3%
mul-1-neg97.3%
*-commutative97.3%
distribute-lft-neg-in97.3%
Simplified97.3%
if 9e9 < im < 1.31999999999999998e154Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 29.1%
mul-1-neg29.1%
unsub-neg29.1%
*-commutative29.1%
associate-*l*29.1%
distribute-lft-out--29.1%
Simplified29.1%
Taylor expanded in re around 0 16.5%
associate--l+16.5%
associate-*r*16.5%
distribute-lft1-in34.0%
unpow234.0%
Simplified34.0%
Taylor expanded in re around inf 20.5%
fma-neg20.5%
associate-*r*20.5%
unpow220.5%
fma-neg20.5%
Simplified20.5%
sub-neg20.5%
distribute-lft-in20.5%
add-sqr-sqrt0.2%
sqrt-unprod18.3%
swap-sqr18.3%
metadata-eval18.3%
metadata-eval18.3%
swap-sqr18.3%
associate-*l*18.3%
associate-*l*18.3%
sqrt-unprod16.1%
add-sqr-sqrt16.1%
*-commutative16.1%
*-commutative16.1%
Applied egg-rr38.6%
distribute-lft-out38.6%
fma-udef38.6%
associate-*l*46.2%
fma-neg46.2%
Simplified46.2%
if 1.31999999999999998e154 < 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%
Applied egg-rr7.1%
*-commutative7.1%
flip--100.0%
associate-*l/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
Final simplification81.6%
(FPCore (re im)
:precision binary64
(let* ((t_0
(* re (* (- (* (pow im 3.0) -0.16666666666666666) im) (* 0.5 re))))
(t_1 (/ (* (cos re) (- 9.0 (* im im))) (+ im -3.0))))
(if (<= im -1.35e+154)
t_1
(if (<= im -1.48e+23)
t_0
(if (<= im 9500000000.0)
(* (cos re) (- im))
(if (<= im 1.32e+154) t_0 t_1))))))
double code(double re, double im) {
double t_0 = re * (((pow(im, 3.0) * -0.16666666666666666) - im) * (0.5 * re));
double t_1 = (cos(re) * (9.0 - (im * im))) / (im + -3.0);
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -1.48e+23) {
tmp = t_0;
} else if (im <= 9500000000.0) {
tmp = cos(re) * -im;
} else if (im <= 1.32e+154) {
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 = re * ((((im ** 3.0d0) * (-0.16666666666666666d0)) - im) * (0.5d0 * re))
t_1 = (cos(re) * (9.0d0 - (im * im))) / (im + (-3.0d0))
if (im <= (-1.35d+154)) then
tmp = t_1
else if (im <= (-1.48d+23)) then
tmp = t_0
else if (im <= 9500000000.0d0) then
tmp = cos(re) * -im
else if (im <= 1.32d+154) 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 = re * (((Math.pow(im, 3.0) * -0.16666666666666666) - im) * (0.5 * re));
double t_1 = (Math.cos(re) * (9.0 - (im * im))) / (im + -3.0);
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -1.48e+23) {
tmp = t_0;
} else if (im <= 9500000000.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.32e+154) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = re * (((math.pow(im, 3.0) * -0.16666666666666666) - im) * (0.5 * re)) t_1 = (math.cos(re) * (9.0 - (im * im))) / (im + -3.0) tmp = 0 if im <= -1.35e+154: tmp = t_1 elif im <= -1.48e+23: tmp = t_0 elif im <= 9500000000.0: tmp = math.cos(re) * -im elif im <= 1.32e+154: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(re * Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) * Float64(0.5 * re))) t_1 = Float64(Float64(cos(re) * Float64(9.0 - Float64(im * im))) / Float64(im + -3.0)) tmp = 0.0 if (im <= -1.35e+154) tmp = t_1; elseif (im <= -1.48e+23) tmp = t_0; elseif (im <= 9500000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.32e+154) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = re * ((((im ^ 3.0) * -0.16666666666666666) - im) * (0.5 * re)); t_1 = (cos(re) * (9.0 - (im * im))) / (im + -3.0); tmp = 0.0; if (im <= -1.35e+154) tmp = t_1; elseif (im <= -1.48e+23) tmp = t_0; elseif (im <= 9500000000.0) tmp = cos(re) * -im; elseif (im <= 1.32e+154) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Cos[re], $MachinePrecision] * N[(9.0 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -1.48e+23], t$95$0, If[LessEqual[im, 9500000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.32e+154], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(0.5 \cdot re\right)\right)\\
t_1 := \frac{\cos re \cdot \left(9 - im \cdot im\right)}{im + -3}\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.48 \cdot 10^{+23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 9500000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or 1.31999999999999998e154 < 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%
Applied egg-rr7.0%
*-commutative7.0%
flip--100.0%
associate-*l/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
if -1.35000000000000003e154 < im < -1.4799999999999999e23 or 9.5e9 < im < 1.31999999999999998e154Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 32.6%
mul-1-neg32.6%
unsub-neg32.6%
*-commutative32.6%
associate-*l*32.6%
distribute-lft-out--32.6%
Simplified32.6%
Taylor expanded in re around 0 12.8%
associate--l+12.8%
associate-*r*12.8%
distribute-lft1-in34.7%
unpow234.7%
Simplified34.7%
Taylor expanded in re around inf 19.7%
fma-neg19.7%
associate-*r*19.7%
unpow219.7%
fma-neg19.7%
Simplified19.7%
sub-neg19.7%
distribute-lft-in19.7%
add-sqr-sqrt0.3%
sqrt-unprod13.2%
swap-sqr13.2%
metadata-eval13.2%
metadata-eval13.2%
swap-sqr13.2%
associate-*l*13.2%
associate-*l*13.2%
sqrt-unprod13.5%
add-sqr-sqrt13.5%
*-commutative13.5%
*-commutative13.5%
Applied egg-rr34.0%
distribute-lft-out34.0%
fma-udef34.0%
associate-*l*42.3%
fma-neg42.3%
Simplified42.3%
if -1.4799999999999999e23 < im < 9.5e9Initial program 14.1%
sub0-neg14.1%
Simplified14.1%
Taylor expanded in im around 0 94.0%
mul-1-neg94.0%
*-commutative94.0%
distribute-lft-neg-in94.0%
Simplified94.0%
Final simplification80.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im))
(t_1 (* (* re re) (* (pow im 3.0) 0.08333333333333333))))
(if (<= im -7.2e+102)
t_0
(if (<= im -600.0)
t_1
(if (<= im -1.4e-5)
t_0
(if (<= im 2.6e+28)
(* (cos re) (- im))
(if (<= im 5.3e+88) t_1 t_0)))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double t_1 = (re * re) * (pow(im, 3.0) * 0.08333333333333333);
double tmp;
if (im <= -7.2e+102) {
tmp = t_0;
} else if (im <= -600.0) {
tmp = t_1;
} else if (im <= -1.4e-5) {
tmp = t_0;
} else if (im <= 2.6e+28) {
tmp = cos(re) * -im;
} else if (im <= 5.3e+88) {
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
t_1 = (re * re) * ((im ** 3.0d0) * 0.08333333333333333d0)
if (im <= (-7.2d+102)) then
tmp = t_0
else if (im <= (-600.0d0)) then
tmp = t_1
else if (im <= (-1.4d-5)) then
tmp = t_0
else if (im <= 2.6d+28) then
tmp = cos(re) * -im
else if (im <= 5.3d+88) 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;
double t_1 = (re * re) * (Math.pow(im, 3.0) * 0.08333333333333333);
double tmp;
if (im <= -7.2e+102) {
tmp = t_0;
} else if (im <= -600.0) {
tmp = t_1;
} else if (im <= -1.4e-5) {
tmp = t_0;
} else if (im <= 2.6e+28) {
tmp = Math.cos(re) * -im;
} else if (im <= 5.3e+88) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im t_1 = (re * re) * (math.pow(im, 3.0) * 0.08333333333333333) tmp = 0 if im <= -7.2e+102: tmp = t_0 elif im <= -600.0: tmp = t_1 elif im <= -1.4e-5: tmp = t_0 elif im <= 2.6e+28: tmp = math.cos(re) * -im elif im <= 5.3e+88: tmp = t_1 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) t_1 = Float64(Float64(re * re) * Float64((im ^ 3.0) * 0.08333333333333333)) tmp = 0.0 if (im <= -7.2e+102) tmp = t_0; elseif (im <= -600.0) tmp = t_1; elseif (im <= -1.4e-5) tmp = t_0; elseif (im <= 2.6e+28) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 5.3e+88) 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; t_1 = (re * re) * ((im ^ 3.0) * 0.08333333333333333); tmp = 0.0; if (im <= -7.2e+102) tmp = t_0; elseif (im <= -600.0) tmp = t_1; elseif (im <= -1.4e-5) tmp = t_0; elseif (im <= 2.6e+28) tmp = cos(re) * -im; elseif (im <= 5.3e+88) tmp = t_1; 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]}, Block[{t$95$1 = N[(N[(re * re), $MachinePrecision] * N[(N[Power[im, 3.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -7.2e+102], t$95$0, If[LessEqual[im, -600.0], t$95$1, If[LessEqual[im, -1.4e-5], t$95$0, If[LessEqual[im, 2.6e+28], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 5.3e+88], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
t_1 := \left(re \cdot re\right) \cdot \left({im}^{3} \cdot 0.08333333333333333\right)\\
\mathbf{if}\;im \leq -7.2 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -600:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.4 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2.6 \cdot 10^{+28}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 5.3 \cdot 10^{+88}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -7.2000000000000003e102 or -600 < im < -1.39999999999999998e-5 or 5.29999999999999987e88 < im Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in im around 0 95.8%
mul-1-neg95.8%
unsub-neg95.8%
*-commutative95.8%
associate-*l*95.8%
distribute-lft-out--95.8%
Simplified95.8%
Taylor expanded in re around 0 71.4%
if -7.2000000000000003e102 < im < -600 or 2.6000000000000002e28 < im < 5.29999999999999987e88Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 7.0%
mul-1-neg7.0%
unsub-neg7.0%
*-commutative7.0%
associate-*l*7.0%
distribute-lft-out--7.0%
Simplified7.0%
Taylor expanded in re around 0 23.0%
associate--l+23.0%
associate-*r*23.0%
distribute-lft1-in25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in re around inf 23.1%
fma-neg23.1%
associate-*r*23.1%
unpow223.1%
fma-neg23.1%
Simplified23.1%
Taylor expanded in im around inf 23.1%
*-commutative23.1%
associate-*l*23.1%
unpow223.1%
Simplified23.1%
if -1.39999999999999998e-5 < im < 2.6000000000000002e28Initial program 13.5%
sub0-neg13.5%
Simplified13.5%
Taylor expanded in im around 0 94.2%
mul-1-neg94.2%
*-commutative94.2%
distribute-lft-neg-in94.2%
Simplified94.2%
Final simplification72.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im))
(t_1 (* (- -3.0 im) (fma re (* 0.5 re) 1.0))))
(if (<= im -4.8e+85)
t_0
(if (<= im -1.65e+23)
t_1
(if (<= im 510000000.0)
(* (cos re) (- im))
(if (<= im 4.2e+100) t_1 t_0))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double t_1 = (-3.0 - im) * fma(re, (0.5 * re), 1.0);
double tmp;
if (im <= -4.8e+85) {
tmp = t_0;
} else if (im <= -1.65e+23) {
tmp = t_1;
} else if (im <= 510000000.0) {
tmp = cos(re) * -im;
} else if (im <= 4.2e+100) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) t_1 = Float64(Float64(-3.0 - im) * fma(re, Float64(0.5 * re), 1.0)) tmp = 0.0 if (im <= -4.8e+85) tmp = t_0; elseif (im <= -1.65e+23) tmp = t_1; elseif (im <= 510000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 4.2e+100) tmp = t_1; else tmp = t_0; end return 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[(-3.0 - im), $MachinePrecision] * N[(re * N[(0.5 * re), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.8e+85], t$95$0, If[LessEqual[im, -1.65e+23], t$95$1, If[LessEqual[im, 510000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 4.2e+100], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
t_1 := \left(-3 - im\right) \cdot \mathsf{fma}\left(re, 0.5 \cdot re, 1\right)\\
\mathbf{if}\;im \leq -4.8 \cdot 10^{+85}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.65 \cdot 10^{+23}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 510000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.79999999999999993e85 or 4.1999999999999997e100 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 95.8%
mul-1-neg95.8%
unsub-neg95.8%
*-commutative95.8%
associate-*l*95.8%
distribute-lft-out--95.8%
Simplified95.8%
Taylor expanded in re around 0 70.0%
if -4.79999999999999993e85 < im < -1.65000000000000015e23 or 5.1e8 < im < 4.1999999999999997e100Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.1%
mul-1-neg5.1%
unsub-neg5.1%
*-commutative5.1%
associate-*l*5.1%
distribute-lft-out--5.1%
Simplified5.1%
Applied egg-rr3.6%
Taylor expanded in re around 0 8.5%
associate-*r*8.5%
distribute-rgt-out8.5%
+-commutative8.5%
metadata-eval8.5%
metadata-eval8.5%
distribute-lft-neg-in8.5%
unpow28.5%
associate-*r*8.5%
*-commutative8.5%
distribute-neg-in8.5%
+-commutative8.5%
distribute-neg-in8.5%
*-commutative8.5%
distribute-lft-neg-in8.5%
distribute-lft-neg-in8.5%
metadata-eval8.5%
metadata-eval8.5%
Simplified8.5%
distribute-rgt-in8.5%
add-sqr-sqrt8.5%
associate-*l*8.5%
*-commutative8.5%
fma-def8.5%
Applied egg-rr0.0%
fma-udef0.0%
+-commutative0.0%
*-lft-identity0.0%
associate-*r*0.0%
swap-sqr0.0%
unpow20.0%
rem-square-sqrt28.8%
metadata-eval28.8%
associate-*l*28.8%
unpow228.8%
associate-*r*28.8%
*-commutative28.8%
associate-*r*28.8%
*-commutative28.8%
*-commutative28.8%
associate-*l*28.8%
neg-mul-128.8%
distribute-lft-neg-in28.8%
distribute-rgt-neg-in28.8%
neg-mul-128.8%
distribute-rgt-in28.8%
metadata-eval28.8%
fma-udef28.8%
Simplified28.8%
if -1.65000000000000015e23 < im < 5.1e8Initial program 13.4%
sub0-neg13.4%
Simplified13.4%
Taylor expanded in im around 0 94.7%
mul-1-neg94.7%
*-commutative94.7%
distribute-lft-neg-in94.7%
Simplified94.7%
Final simplification73.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -1.7e-5)
t_0
(if (<= im 30000000000.0)
(* (cos re) (- im))
(if (<= im 1.65e+100) (* 27.0 (+ 0.5 (* re (* re -0.25)))) t_0)))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -1.7e-5) {
tmp = t_0;
} else if (im <= 30000000000.0) {
tmp = cos(re) * -im;
} else if (im <= 1.65e+100) {
tmp = 27.0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
if (im <= (-1.7d-5)) then
tmp = t_0
else if (im <= 30000000000.0d0) then
tmp = cos(re) * -im
else if (im <= 1.65d+100) then
tmp = 27.0d0 * (0.5d0 + (re * (re * (-0.25d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -1.7e-5) {
tmp = t_0;
} else if (im <= 30000000000.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.65e+100) {
tmp = 27.0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -1.7e-5: tmp = t_0 elif im <= 30000000000.0: tmp = math.cos(re) * -im elif im <= 1.65e+100: tmp = 27.0 * (0.5 + (re * (re * -0.25))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -1.7e-5) tmp = t_0; elseif (im <= 30000000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.65e+100) tmp = Float64(27.0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -1.7e-5) tmp = t_0; elseif (im <= 30000000000.0) tmp = cos(re) * -im; elseif (im <= 1.65e+100) tmp = 27.0 * (0.5 + (re * (re * -0.25))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -1.7e-5], t$95$0, If[LessEqual[im, 30000000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.65e+100], N[(27.0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -1.7 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 30000000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.65 \cdot 10^{+100}:\\
\;\;\;\;27 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.7e-5 or 1.6500000000000001e100 < im Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in im around 0 76.8%
mul-1-neg76.8%
unsub-neg76.8%
*-commutative76.8%
associate-*l*76.8%
distribute-lft-out--76.8%
Simplified76.8%
Taylor expanded in re around 0 56.5%
if -1.7e-5 < im < 3e10Initial program 10.6%
sub0-neg10.6%
Simplified10.6%
Taylor expanded in im around 0 97.3%
mul-1-neg97.3%
*-commutative97.3%
distribute-lft-neg-in97.3%
Simplified97.3%
if 3e10 < im < 1.6500000000000001e100Initial 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-out62.1%
*-commutative62.1%
unpow262.1%
associate-*l*62.1%
Simplified62.1%
Applied egg-rr22.3%
Final simplification71.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* im (* 0.5 (* re re))) im)))
(if (<= im -430.0)
t_0
(if (<= im 10600000000000.0)
(* (cos re) (- im))
(if (<= im 4.5e+231) (* 27.0 (+ 0.5 (* re (* re -0.25)))) t_0)))))
double code(double re, double im) {
double t_0 = (im * (0.5 * (re * re))) - im;
double tmp;
if (im <= -430.0) {
tmp = t_0;
} else if (im <= 10600000000000.0) {
tmp = cos(re) * -im;
} else if (im <= 4.5e+231) {
tmp = 27.0 * (0.5 + (re * (re * -0.25)));
} 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 * (0.5d0 * (re * re))) - im
if (im <= (-430.0d0)) then
tmp = t_0
else if (im <= 10600000000000.0d0) then
tmp = cos(re) * -im
else if (im <= 4.5d+231) then
tmp = 27.0d0 * (0.5d0 + (re * (re * (-0.25d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * (0.5 * (re * re))) - im;
double tmp;
if (im <= -430.0) {
tmp = t_0;
} else if (im <= 10600000000000.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 4.5e+231) {
tmp = 27.0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (im * (0.5 * (re * re))) - im tmp = 0 if im <= -430.0: tmp = t_0 elif im <= 10600000000000.0: tmp = math.cos(re) * -im elif im <= 4.5e+231: tmp = 27.0 * (0.5 + (re * (re * -0.25))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im) tmp = 0.0 if (im <= -430.0) tmp = t_0; elseif (im <= 10600000000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 4.5e+231) tmp = Float64(27.0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im * (0.5 * (re * re))) - im; tmp = 0.0; if (im <= -430.0) tmp = t_0; elseif (im <= 10600000000000.0) tmp = cos(re) * -im; elseif (im <= 4.5e+231) tmp = 27.0 * (0.5 + (re * (re * -0.25))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -430.0], t$95$0, If[LessEqual[im, 10600000000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 4.5e+231], N[(27.0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{if}\;im \leq -430:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 10600000000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+231}:\\
\;\;\;\;27 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -430 or 4.49999999999999991e231 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-lft-neg-in5.9%
Simplified5.9%
Taylor expanded in re around 0 27.5%
neg-mul-127.5%
+-commutative27.5%
unsub-neg27.5%
*-commutative27.5%
*-commutative27.5%
associate-*l*27.5%
unpow227.5%
Simplified27.5%
if -430 < im < 1.06e13Initial program 11.2%
sub0-neg11.2%
Simplified11.2%
Taylor expanded in im around 0 97.1%
mul-1-neg97.1%
*-commutative97.1%
distribute-lft-neg-in97.1%
Simplified97.1%
if 1.06e13 < im < 4.49999999999999991e231Initial 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-out63.0%
*-commutative63.0%
unpow263.0%
associate-*l*63.0%
Simplified63.0%
Applied egg-rr21.8%
Final simplification58.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* re re) (* im 0.5))))
(if (<= im -410.0)
t_0
(if (<= im 12500000000.0)
(- im)
(if (<= im 2.6e+255) (* 27.0 (+ 0.5 (* re (* re -0.25)))) t_0)))))
double code(double re, double im) {
double t_0 = (re * re) * (im * 0.5);
double tmp;
if (im <= -410.0) {
tmp = t_0;
} else if (im <= 12500000000.0) {
tmp = -im;
} else if (im <= 2.6e+255) {
tmp = 27.0 * (0.5 + (re * (re * -0.25)));
} 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 = (re * re) * (im * 0.5d0)
if (im <= (-410.0d0)) then
tmp = t_0
else if (im <= 12500000000.0d0) then
tmp = -im
else if (im <= 2.6d+255) then
tmp = 27.0d0 * (0.5d0 + (re * (re * (-0.25d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (re * re) * (im * 0.5);
double tmp;
if (im <= -410.0) {
tmp = t_0;
} else if (im <= 12500000000.0) {
tmp = -im;
} else if (im <= 2.6e+255) {
tmp = 27.0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (re * re) * (im * 0.5) tmp = 0 if im <= -410.0: tmp = t_0 elif im <= 12500000000.0: tmp = -im elif im <= 2.6e+255: tmp = 27.0 * (0.5 + (re * (re * -0.25))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(re * re) * Float64(im * 0.5)) tmp = 0.0 if (im <= -410.0) tmp = t_0; elseif (im <= 12500000000.0) tmp = Float64(-im); elseif (im <= 2.6e+255) tmp = Float64(27.0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (re * re) * (im * 0.5); tmp = 0.0; if (im <= -410.0) tmp = t_0; elseif (im <= 12500000000.0) tmp = -im; elseif (im <= 2.6e+255) tmp = 27.0 * (0.5 + (re * (re * -0.25))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -410.0], t$95$0, If[LessEqual[im, 12500000000.0], (-im), If[LessEqual[im, 2.6e+255], N[(27.0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\mathbf{if}\;im \leq -410:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 12500000000:\\
\;\;\;\;-im\\
\mathbf{elif}\;im \leq 2.6 \cdot 10^{+255}:\\
\;\;\;\;27 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -410 or 2.6000000000000001e255 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 69.9%
mul-1-neg69.9%
unsub-neg69.9%
*-commutative69.9%
associate-*l*69.9%
distribute-lft-out--69.9%
Simplified69.9%
Taylor expanded in re around 0 5.8%
associate--l+5.8%
associate-*r*5.8%
distribute-lft1-in66.8%
unpow266.8%
Simplified66.8%
Taylor expanded in re around inf 28.3%
fma-neg28.3%
associate-*r*28.3%
unpow228.3%
fma-neg28.3%
Simplified28.3%
Taylor expanded in im around 0 25.3%
associate-*r*25.3%
*-commutative25.3%
associate-*l*25.3%
unpow225.3%
Simplified25.3%
if -410 < im < 1.25e10Initial program 11.2%
sub0-neg11.2%
Simplified11.2%
Taylor expanded in im around 0 97.1%
mul-1-neg97.1%
*-commutative97.1%
distribute-lft-neg-in97.1%
Simplified97.1%
Taylor expanded in re around 0 48.1%
neg-mul-148.1%
Simplified48.1%
if 1.25e10 < im < 2.6000000000000001e255Initial 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-out62.5%
*-commutative62.5%
unpow262.5%
associate-*l*62.5%
Simplified62.5%
Applied egg-rr21.2%
Final simplification34.9%
(FPCore (re im) :precision binary64 (if (or (<= im -900.0) (not (<= im 1.35e+28))) (* (* re re) (* im 0.5)) (- im)))
double code(double re, double im) {
double tmp;
if ((im <= -900.0) || !(im <= 1.35e+28)) {
tmp = (re * re) * (im * 0.5);
} else {
tmp = -im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-900.0d0)) .or. (.not. (im <= 1.35d+28))) then
tmp = (re * re) * (im * 0.5d0)
else
tmp = -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -900.0) || !(im <= 1.35e+28)) {
tmp = (re * re) * (im * 0.5);
} else {
tmp = -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -900.0) or not (im <= 1.35e+28): tmp = (re * re) * (im * 0.5) else: tmp = -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -900.0) || !(im <= 1.35e+28)) tmp = Float64(Float64(re * re) * Float64(im * 0.5)); else tmp = Float64(-im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -900.0) || ~((im <= 1.35e+28))) tmp = (re * re) * (im * 0.5); else tmp = -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -900.0], N[Not[LessEqual[im, 1.35e+28]], $MachinePrecision]], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision], (-im)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -900 \lor \neg \left(im \leq 1.35 \cdot 10^{+28}\right):\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\end{array}
if im < -900 or 1.3500000000000001e28 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 63.3%
mul-1-neg63.3%
unsub-neg63.3%
*-commutative63.3%
associate-*l*63.3%
distribute-lft-out--63.3%
Simplified63.3%
Taylor expanded in re around 0 8.4%
associate--l+8.4%
associate-*r*8.4%
distribute-lft1-in58.5%
unpow258.5%
Simplified58.5%
Taylor expanded in re around inf 24.1%
fma-neg24.1%
associate-*r*24.1%
unpow224.1%
fma-neg24.1%
Simplified24.1%
Taylor expanded in im around 0 19.7%
associate-*r*19.7%
*-commutative19.7%
associate-*l*19.7%
unpow219.7%
Simplified19.7%
if -900 < im < 1.3500000000000001e28Initial program 14.1%
sub0-neg14.1%
Simplified14.1%
Taylor expanded in im around 0 94.0%
mul-1-neg94.0%
*-commutative94.0%
distribute-lft-neg-in94.0%
Simplified94.0%
Taylor expanded in re around 0 46.7%
neg-mul-146.7%
Simplified46.7%
Final simplification32.5%
(FPCore (re im) :precision binary64 (if (<= re -2.5e+167) (* 27.0 (+ 0.5 (* re (* re -0.25)))) (- (* im (* 0.5 (* re re))) im)))
double code(double re, double im) {
double tmp;
if (re <= -2.5e+167) {
tmp = 27.0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = (im * (0.5 * (re * re))) - im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-2.5d+167)) then
tmp = 27.0d0 * (0.5d0 + (re * (re * (-0.25d0))))
else
tmp = (im * (0.5d0 * (re * re))) - im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -2.5e+167) {
tmp = 27.0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = (im * (0.5 * (re * re))) - im;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.5e+167: tmp = 27.0 * (0.5 + (re * (re * -0.25))) else: tmp = (im * (0.5 * (re * re))) - im return tmp
function code(re, im) tmp = 0.0 if (re <= -2.5e+167) tmp = Float64(27.0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); else tmp = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.5e+167) tmp = 27.0 * (0.5 + (re * (re * -0.25))); else tmp = (im * (0.5 * (re * re))) - im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.5e+167], N[(27.0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.5 \cdot 10^{+167}:\\
\;\;\;\;27 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\end{array}
\end{array}
if re < -2.4999999999999998e167Initial program 50.1%
sub0-neg50.1%
Simplified50.1%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out18.2%
*-commutative18.2%
unpow218.2%
associate-*l*18.2%
Simplified18.2%
Applied egg-rr31.4%
if -2.4999999999999998e167 < re Initial program 60.4%
sub0-neg60.4%
Simplified60.4%
Taylor expanded in im around 0 46.2%
mul-1-neg46.2%
*-commutative46.2%
distribute-lft-neg-in46.2%
Simplified46.2%
Taylor expanded in re around 0 33.3%
neg-mul-133.3%
+-commutative33.3%
unsub-neg33.3%
*-commutative33.3%
*-commutative33.3%
associate-*l*33.3%
unpow233.3%
Simplified33.3%
Final simplification33.0%
(FPCore (re im) :precision binary64 (if (<= re 8e+153) (- im) (* (* re re) 0.75)))
double code(double re, double im) {
double tmp;
if (re <= 8e+153) {
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 <= 8d+153) 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 <= 8e+153) {
tmp = -im;
} else {
tmp = (re * re) * 0.75;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 8e+153: tmp = -im else: tmp = (re * re) * 0.75 return tmp
function code(re, im) tmp = 0.0 if (re <= 8e+153) 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 <= 8e+153) tmp = -im; else tmp = (re * re) * 0.75; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 8e+153], (-im), N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 8 \cdot 10^{+153}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\end{array}
\end{array}
if re < 8e153Initial program 58.0%
sub0-neg58.0%
Simplified58.0%
Taylor expanded in im around 0 48.9%
mul-1-neg48.9%
*-commutative48.9%
distribute-lft-neg-in48.9%
Simplified48.9%
Taylor expanded in re around 0 26.7%
neg-mul-126.7%
Simplified26.7%
if 8e153 < re Initial program 68.2%
sub0-neg68.2%
Simplified68.2%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out33.3%
*-commutative33.3%
unpow233.3%
associate-*l*33.3%
Simplified33.3%
Applied egg-rr33.9%
Taylor expanded in re around inf 33.9%
*-commutative33.9%
unpow233.9%
associate-*l*33.9%
Simplified33.9%
Taylor expanded in re around 0 33.9%
unpow233.9%
Simplified33.9%
Final simplification27.4%
(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 59.1%
sub0-neg59.1%
Simplified59.1%
Taylor expanded in im around 0 47.5%
mul-1-neg47.5%
*-commutative47.5%
distribute-lft-neg-in47.5%
Simplified47.5%
Taylor expanded in re around 0 24.3%
neg-mul-124.3%
Simplified24.3%
Final simplification24.3%
(FPCore (re im) :precision binary64 -1.5)
double code(double re, double im) {
return -1.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -1.5d0
end function
public static double code(double re, double im) {
return -1.5;
}
def code(re, im): return -1.5
function code(re, im) return -1.5 end
function tmp = code(re, im) tmp = -1.5; end
code[re_, im_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 59.1%
sub0-neg59.1%
Simplified59.1%
Taylor expanded in re around 0 2.7%
+-commutative2.7%
*-commutative2.7%
associate-*r*2.7%
distribute-rgt-out44.9%
*-commutative44.9%
unpow244.9%
associate-*l*44.9%
Simplified44.9%
Applied egg-rr7.9%
Taylor expanded in re around 0 2.7%
Final simplification2.7%
(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 2023195
(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))))