
(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 15 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 -0.2) (not (<= t_0 0.0005)))
(* (* 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 <= -0.2) || !(t_0 <= 0.0005)) {
tmp = (0.5 * cos(re)) * 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.2d0)) .or. (.not. (t_0 <= 0.0005d0))) then
tmp = (0.5d0 * cos(re)) * 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.2) || !(t_0 <= 0.0005)) {
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 <= -0.2) or not (t_0 <= 0.0005): 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 <= -0.2) || !(t_0 <= 0.0005)) 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 <= -0.2) || ~((t_0 <= 0.0005))) 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, -0.2], N[Not[LessEqual[t$95$0, 0.0005]], $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 -0.2 \lor \neg \left(t_0 \leq 0.0005\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)) < -0.20000000000000001 or 5.0000000000000001e-4 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 5.0000000000000001e-4Initial program 9.4%
sub0-neg9.4%
Simplified9.4%
Taylor expanded in im around 0 99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
associate-*l*99.7%
distribute-lft-out--99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im)))
(t_1 (* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))))
(if (<= im -3.5e+128)
t_1
(if (<= im -0.265)
(* 0.5 t_0)
(if (or (<= im 0.102) (not (<= im 5.6e+102)))
t_1
(* t_0 (+ 0.5 (* re (* re -0.25)))))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -3.5e+128) {
tmp = t_1;
} else if (im <= -0.265) {
tmp = 0.5 * t_0;
} else if ((im <= 0.102) || !(im <= 5.6e+102)) {
tmp = t_1;
} else {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-im) - exp(im)
t_1 = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
if (im <= (-3.5d+128)) then
tmp = t_1
else if (im <= (-0.265d0)) then
tmp = 0.5d0 * t_0
else if ((im <= 0.102d0) .or. (.not. (im <= 5.6d+102))) then
tmp = t_1
else
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double t_1 = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -3.5e+128) {
tmp = t_1;
} else if (im <= -0.265) {
tmp = 0.5 * t_0;
} else if ((im <= 0.102) || !(im <= 5.6e+102)) {
tmp = t_1;
} else {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) tmp = 0 if im <= -3.5e+128: tmp = t_1 elif im <= -0.265: tmp = 0.5 * t_0 elif (im <= 0.102) or not (im <= 5.6e+102): tmp = t_1 else: tmp = t_0 * (0.5 + (re * (re * -0.25))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)) tmp = 0.0 if (im <= -3.5e+128) tmp = t_1; elseif (im <= -0.265) tmp = Float64(0.5 * t_0); elseif ((im <= 0.102) || !(im <= 5.6e+102)) tmp = t_1; else tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); tmp = 0.0; if (im <= -3.5e+128) tmp = t_1; elseif (im <= -0.265) tmp = 0.5 * t_0; elseif ((im <= 0.102) || ~((im <= 5.6e+102))) tmp = t_1; else tmp = t_0 * (0.5 + (re * (re * -0.25))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.5e+128], t$95$1, If[LessEqual[im, -0.265], N[(0.5 * t$95$0), $MachinePrecision], If[Or[LessEqual[im, 0.102], N[Not[LessEqual[im, 5.6e+102]], $MachinePrecision]], t$95$1, N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := \cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{if}\;im \leq -3.5 \cdot 10^{+128}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.265:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{elif}\;im \leq 0.102 \lor \neg \left(im \leq 5.6 \cdot 10^{+102}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\end{array}
\end{array}
if im < -3.49999999999999969e128 or -0.26500000000000001 < im < 0.101999999999999993 or 5.60000000000000037e102 < im Initial program 43.5%
sub0-neg43.5%
Simplified43.5%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
if -3.49999999999999969e128 < im < -0.26500000000000001Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 82.1%
if 0.101999999999999993 < im < 5.60000000000000037e102Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Taylor expanded in re around 0 9.4%
*-commutative9.4%
associate-*r*9.4%
distribute-rgt-out71.4%
+-commutative71.4%
*-commutative71.4%
unpow271.4%
associate-*l*71.4%
Simplified71.4%
Final simplification95.6%
(FPCore (re im)
:precision binary64
(if (or (<= im -3.5e+128)
(not (or (<= im -0.092) (and (not (<= im 0.039)) (<= im 5.6e+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 <= -3.5e+128) || !((im <= -0.092) || (!(im <= 0.039) && (im <= 5.6e+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 <= (-3.5d+128)) .or. (.not. (im <= (-0.092d0)) .or. (.not. (im <= 0.039d0)) .and. (im <= 5.6d+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 <= -3.5e+128) || !((im <= -0.092) || (!(im <= 0.039) && (im <= 5.6e+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 <= -3.5e+128) or not ((im <= -0.092) or (not (im <= 0.039) and (im <= 5.6e+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 <= -3.5e+128) || !((im <= -0.092) || (!(im <= 0.039) && (im <= 5.6e+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 <= -3.5e+128) || ~(((im <= -0.092) || (~((im <= 0.039)) && (im <= 5.6e+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, -3.5e+128], N[Not[Or[LessEqual[im, -0.092], And[N[Not[LessEqual[im, 0.039]], $MachinePrecision], LessEqual[im, 5.6e+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 -3.5 \cdot 10^{+128} \lor \neg \left(im \leq -0.092 \lor \neg \left(im \leq 0.039\right) \land im \leq 5.6 \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 < -3.49999999999999969e128 or -0.091999999999999998 < im < 0.0389999999999999999 or 5.60000000000000037e102 < im Initial program 43.5%
sub0-neg43.5%
Simplified43.5%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
if -3.49999999999999969e128 < im < -0.091999999999999998 or 0.0389999999999999999 < im < 5.60000000000000037e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 75.5%
Final simplification95.2%
(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 -6.8e+143)
t_1
(if (<= im -0.00192)
t_0
(if (<= im 0.0018)
(* im (- (cos re)))
(if (<= im 1.3e+152) 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 <= -6.8e+143) {
tmp = t_1;
} else if (im <= -0.00192) {
tmp = t_0;
} else if (im <= 0.0018) {
tmp = im * -cos(re);
} else if (im <= 1.3e+152) {
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 <= (-6.8d+143)) then
tmp = t_1
else if (im <= (-0.00192d0)) then
tmp = t_0
else if (im <= 0.0018d0) then
tmp = im * -cos(re)
else if (im <= 1.3d+152) 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 <= -6.8e+143) {
tmp = t_1;
} else if (im <= -0.00192) {
tmp = t_0;
} else if (im <= 0.0018) {
tmp = im * -Math.cos(re);
} else if (im <= 1.3e+152) {
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 <= -6.8e+143: tmp = t_1 elif im <= -0.00192: tmp = t_0 elif im <= 0.0018: tmp = im * -math.cos(re) elif im <= 1.3e+152: 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 <= -6.8e+143) tmp = t_1; elseif (im <= -0.00192) tmp = t_0; elseif (im <= 0.0018) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.3e+152) 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 <= -6.8e+143) tmp = t_1; elseif (im <= -0.00192) tmp = t_0; elseif (im <= 0.0018) tmp = im * -cos(re); elseif (im <= 1.3e+152) 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, -6.8e+143], t$95$1, If[LessEqual[im, -0.00192], t$95$0, If[LessEqual[im, 0.0018], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.3e+152], 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 -6.8 \cdot 10^{+143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00192:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0018:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.3 \cdot 10^{+152}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -6.79999999999999964e143 or 1.3e152 < 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-rr6.9%
*-commutative6.9%
flip--95.6%
associate-*l/95.6%
metadata-eval95.6%
+-commutative95.6%
Applied egg-rr95.6%
if -6.79999999999999964e143 < im < -0.00192000000000000005 or 0.0018 < im < 1.3e152Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 75.8%
if -0.00192000000000000005 < im < 0.0018Initial program 9.4%
sub0-neg9.4%
Simplified9.4%
Taylor expanded in im around 0 99.2%
mul-1-neg99.2%
*-commutative99.2%
distribute-lft-neg-in99.2%
Simplified99.2%
Final simplification92.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im))
(t_1 (- (* im (* 0.5 (* re re))) im))
(t_2 (/ (* (cos re) (- 9.0 (* im im))) (+ im -3.0))))
(if (<= im -6.8e+143)
t_2
(if (<= im -5.6e+102)
t_0
(if (<= im -5.6e+24)
(* re (* re 0.75))
(if (<= im 3.2e+30)
(* im (- (cos re)))
(if (<= im 2.8e+64)
t_1
(if (<= im 7.5e+144) t_0 (if (<= im 1.35e+154) t_1 t_2)))))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double t_1 = (im * (0.5 * (re * re))) - im;
double t_2 = (cos(re) * (9.0 - (im * im))) / (im + -3.0);
double tmp;
if (im <= -6.8e+143) {
tmp = t_2;
} else if (im <= -5.6e+102) {
tmp = t_0;
} else if (im <= -5.6e+24) {
tmp = re * (re * 0.75);
} else if (im <= 3.2e+30) {
tmp = im * -cos(re);
} else if (im <= 2.8e+64) {
tmp = t_1;
} else if (im <= 7.5e+144) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
t_1 = (im * (0.5d0 * (re * re))) - im
t_2 = (cos(re) * (9.0d0 - (im * im))) / (im + (-3.0d0))
if (im <= (-6.8d+143)) then
tmp = t_2
else if (im <= (-5.6d+102)) then
tmp = t_0
else if (im <= (-5.6d+24)) then
tmp = re * (re * 0.75d0)
else if (im <= 3.2d+30) then
tmp = im * -cos(re)
else if (im <= 2.8d+64) then
tmp = t_1
else if (im <= 7.5d+144) then
tmp = t_0
else if (im <= 1.35d+154) then
tmp = t_1
else
tmp = t_2
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 = (im * (0.5 * (re * re))) - im;
double t_2 = (Math.cos(re) * (9.0 - (im * im))) / (im + -3.0);
double tmp;
if (im <= -6.8e+143) {
tmp = t_2;
} else if (im <= -5.6e+102) {
tmp = t_0;
} else if (im <= -5.6e+24) {
tmp = re * (re * 0.75);
} else if (im <= 3.2e+30) {
tmp = im * -Math.cos(re);
} else if (im <= 2.8e+64) {
tmp = t_1;
} else if (im <= 7.5e+144) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im t_1 = (im * (0.5 * (re * re))) - im t_2 = (math.cos(re) * (9.0 - (im * im))) / (im + -3.0) tmp = 0 if im <= -6.8e+143: tmp = t_2 elif im <= -5.6e+102: tmp = t_0 elif im <= -5.6e+24: tmp = re * (re * 0.75) elif im <= 3.2e+30: tmp = im * -math.cos(re) elif im <= 2.8e+64: tmp = t_1 elif im <= 7.5e+144: tmp = t_0 elif im <= 1.35e+154: tmp = t_1 else: tmp = t_2 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) t_1 = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im) t_2 = Float64(Float64(cos(re) * Float64(9.0 - Float64(im * im))) / Float64(im + -3.0)) tmp = 0.0 if (im <= -6.8e+143) tmp = t_2; elseif (im <= -5.6e+102) tmp = t_0; elseif (im <= -5.6e+24) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 3.2e+30) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 2.8e+64) tmp = t_1; elseif (im <= 7.5e+144) tmp = t_0; elseif (im <= 1.35e+154) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; t_1 = (im * (0.5 * (re * re))) - im; t_2 = (cos(re) * (9.0 - (im * im))) / (im + -3.0); tmp = 0.0; if (im <= -6.8e+143) tmp = t_2; elseif (im <= -5.6e+102) tmp = t_0; elseif (im <= -5.6e+24) tmp = re * (re * 0.75); elseif (im <= 3.2e+30) tmp = im * -cos(re); elseif (im <= 2.8e+64) tmp = t_1; elseif (im <= 7.5e+144) tmp = t_0; elseif (im <= 1.35e+154) tmp = t_1; else tmp = t_2; 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[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Cos[re], $MachinePrecision] * N[(9.0 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.8e+143], t$95$2, If[LessEqual[im, -5.6e+102], t$95$0, If[LessEqual[im, -5.6e+24], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.2e+30], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 2.8e+64], t$95$1, If[LessEqual[im, 7.5e+144], t$95$0, If[LessEqual[im, 1.35e+154], t$95$1, t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
t_1 := im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
t_2 := \frac{\cos re \cdot \left(9 - im \cdot im\right)}{im + -3}\\
\mathbf{if}\;im \leq -6.8 \cdot 10^{+143}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -5.6 \cdot 10^{+24}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 3.2 \cdot 10^{+30}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 2.8 \cdot 10^{+64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 7.5 \cdot 10^{+144}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < -6.79999999999999964e143 or 1.35000000000000003e154 < 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--98.5%
associate-*l/98.5%
metadata-eval98.5%
+-commutative98.5%
Applied egg-rr98.5%
if -6.79999999999999964e143 < im < -5.60000000000000037e102 or 2.80000000000000024e64 < im < 7.5000000000000006e144Initial 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 68.0%
if -5.60000000000000037e102 < im < -5.6000000000000003e24Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out64.7%
+-commutative64.7%
*-commutative64.7%
unpow264.7%
associate-*l*64.7%
Simplified64.7%
Applied egg-rr29.9%
Taylor expanded in re around inf 30.3%
*-commutative30.3%
unpow230.3%
associate-*l*30.3%
Simplified30.3%
if -5.6000000000000003e24 < im < 3.19999999999999973e30Initial program 15.9%
sub0-neg15.9%
Simplified15.9%
Taylor expanded in im around 0 92.6%
mul-1-neg92.6%
*-commutative92.6%
distribute-lft-neg-in92.6%
Simplified92.6%
if 3.19999999999999973e30 < im < 2.80000000000000024e64 or 7.5000000000000006e144 < im < 1.35000000000000003e154Initial 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 69.8%
neg-mul-169.8%
+-commutative69.8%
unsub-neg69.8%
*-commutative69.8%
*-commutative69.8%
associate-*l*69.8%
unpow269.8%
Simplified69.8%
Final simplification86.4%
(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 (* (* -0.5 (* re re)) t_0)))
(if (<= im -6.8e+143)
t_1
(if (<= im -3.05e+92)
t_0
(if (<= im -3e+20)
t_2
(if (<= im 5e+30)
(* im (- (cos re)))
(if (<= im 1.8e+96)
t_2
(if (<= im 7.5e+144)
t_0
(if (<= im 1.35e+154)
(- (* im (* 0.5 (* re re))) im)
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 = (-0.5 * (re * re)) * t_0;
double tmp;
if (im <= -6.8e+143) {
tmp = t_1;
} else if (im <= -3.05e+92) {
tmp = t_0;
} else if (im <= -3e+20) {
tmp = t_2;
} else if (im <= 5e+30) {
tmp = im * -cos(re);
} else if (im <= 1.8e+96) {
tmp = t_2;
} else if (im <= 7.5e+144) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = (im * (0.5 * (re * 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) :: t_2
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
t_1 = (cos(re) * (9.0d0 - (im * im))) / (im + (-3.0d0))
t_2 = ((-0.5d0) * (re * re)) * t_0
if (im <= (-6.8d+143)) then
tmp = t_1
else if (im <= (-3.05d+92)) then
tmp = t_0
else if (im <= (-3d+20)) then
tmp = t_2
else if (im <= 5d+30) then
tmp = im * -cos(re)
else if (im <= 1.8d+96) then
tmp = t_2
else if (im <= 7.5d+144) then
tmp = t_0
else if (im <= 1.35d+154) then
tmp = (im * (0.5d0 * (re * re))) - im
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 = (Math.cos(re) * (9.0 - (im * im))) / (im + -3.0);
double t_2 = (-0.5 * (re * re)) * t_0;
double tmp;
if (im <= -6.8e+143) {
tmp = t_1;
} else if (im <= -3.05e+92) {
tmp = t_0;
} else if (im <= -3e+20) {
tmp = t_2;
} else if (im <= 5e+30) {
tmp = im * -Math.cos(re);
} else if (im <= 1.8e+96) {
tmp = t_2;
} else if (im <= 7.5e+144) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = (im * (0.5 * (re * re))) - im;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im t_1 = (math.cos(re) * (9.0 - (im * im))) / (im + -3.0) t_2 = (-0.5 * (re * re)) * t_0 tmp = 0 if im <= -6.8e+143: tmp = t_1 elif im <= -3.05e+92: tmp = t_0 elif im <= -3e+20: tmp = t_2 elif im <= 5e+30: tmp = im * -math.cos(re) elif im <= 1.8e+96: tmp = t_2 elif im <= 7.5e+144: tmp = t_0 elif im <= 1.35e+154: tmp = (im * (0.5 * (re * re))) - im 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(-0.5 * Float64(re * re)) * t_0) tmp = 0.0 if (im <= -6.8e+143) tmp = t_1; elseif (im <= -3.05e+92) tmp = t_0; elseif (im <= -3e+20) tmp = t_2; elseif (im <= 5e+30) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.8e+96) tmp = t_2; elseif (im <= 7.5e+144) tmp = t_0; elseif (im <= 1.35e+154) tmp = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; t_1 = (cos(re) * (9.0 - (im * im))) / (im + -3.0); t_2 = (-0.5 * (re * re)) * t_0; tmp = 0.0; if (im <= -6.8e+143) tmp = t_1; elseif (im <= -3.05e+92) tmp = t_0; elseif (im <= -3e+20) tmp = t_2; elseif (im <= 5e+30) tmp = im * -cos(re); elseif (im <= 1.8e+96) tmp = t_2; elseif (im <= 7.5e+144) tmp = t_0; elseif (im <= 1.35e+154) tmp = (im * (0.5 * (re * re))) - im; 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[(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[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[im, -6.8e+143], t$95$1, If[LessEqual[im, -3.05e+92], t$95$0, If[LessEqual[im, -3e+20], t$95$2, If[LessEqual[im, 5e+30], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.8e+96], t$95$2, If[LessEqual[im, 7.5e+144], t$95$0, If[LessEqual[im, 1.35e+154], N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], 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(-0.5 \cdot \left(re \cdot re\right)\right) \cdot t_0\\
\mathbf{if}\;im \leq -6.8 \cdot 10^{+143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -3.05 \cdot 10^{+92}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -3 \cdot 10^{+20}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+30}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+96}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 7.5 \cdot 10^{+144}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -6.79999999999999964e143 or 1.35000000000000003e154 < 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--98.5%
associate-*l/98.5%
metadata-eval98.5%
+-commutative98.5%
Applied egg-rr98.5%
if -6.79999999999999964e143 < im < -3.04999999999999987e92 or 1.80000000000000007e96 < im < 7.5000000000000006e144Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 83.7%
mul-1-neg83.7%
unsub-neg83.7%
*-commutative83.7%
associate-*l*83.7%
distribute-lft-out--83.7%
Simplified83.7%
Taylor expanded in re around 0 74.6%
if -3.04999999999999987e92 < im < -3e20 or 4.9999999999999998e30 < im < 1.80000000000000007e96Initial 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%
Taylor expanded in re around 0 43.3%
associate--l+43.3%
associate-*r*43.3%
distribute-lft1-in43.3%
unpow243.3%
Simplified43.3%
Taylor expanded in re around inf 41.8%
fma-neg41.8%
associate-*r*41.8%
unpow241.8%
fma-neg41.8%
Simplified41.8%
if -3e20 < im < 4.9999999999999998e30Initial program 15.3%
sub0-neg15.3%
Simplified15.3%
Taylor expanded in im around 0 93.2%
mul-1-neg93.2%
*-commutative93.2%
distribute-lft-neg-in93.2%
Simplified93.2%
if 7.5000000000000006e144 < im < 1.35000000000000003e154Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.6%
mul-1-neg4.6%
*-commutative4.6%
distribute-lft-neg-in4.6%
Simplified4.6%
Taylor expanded in re around 0 76.1%
neg-mul-176.1%
+-commutative76.1%
unsub-neg76.1%
*-commutative76.1%
*-commutative76.1%
associate-*l*76.1%
unpow276.1%
Simplified76.1%
Final simplification86.8%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(+ (* -0.5 (* re re)) 1.0)
(- (* (pow im 3.0) -0.16666666666666666) im)))
(t_1 (/ (* (cos re) (- 9.0 (* im im))) (+ im -3.0))))
(if (<= im -8e+179)
t_1
(if (<= im -22.0)
t_0
(if (<= im 1.7e-7)
(* im (- (cos re)))
(if (<= im 1.35e+154) t_0 t_1))))))
double code(double re, double im) {
double t_0 = ((-0.5 * (re * re)) + 1.0) * ((pow(im, 3.0) * -0.16666666666666666) - im);
double t_1 = (cos(re) * (9.0 - (im * im))) / (im + -3.0);
double tmp;
if (im <= -8e+179) {
tmp = t_1;
} else if (im <= -22.0) {
tmp = t_0;
} else if (im <= 1.7e-7) {
tmp = im * -cos(re);
} else if (im <= 1.35e+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) * (re * re)) + 1.0d0) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
t_1 = (cos(re) * (9.0d0 - (im * im))) / (im + (-3.0d0))
if (im <= (-8d+179)) then
tmp = t_1
else if (im <= (-22.0d0)) then
tmp = t_0
else if (im <= 1.7d-7) then
tmp = im * -cos(re)
else if (im <= 1.35d+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 * (re * re)) + 1.0) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
double t_1 = (Math.cos(re) * (9.0 - (im * im))) / (im + -3.0);
double tmp;
if (im <= -8e+179) {
tmp = t_1;
} else if (im <= -22.0) {
tmp = t_0;
} else if (im <= 1.7e-7) {
tmp = im * -Math.cos(re);
} else if (im <= 1.35e+154) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = ((-0.5 * (re * re)) + 1.0) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) t_1 = (math.cos(re) * (9.0 - (im * im))) / (im + -3.0) tmp = 0 if im <= -8e+179: tmp = t_1 elif im <= -22.0: tmp = t_0 elif im <= 1.7e-7: tmp = im * -math.cos(re) elif im <= 1.35e+154: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(Float64(-0.5 * Float64(re * re)) + 1.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)) tmp = 0.0 if (im <= -8e+179) tmp = t_1; elseif (im <= -22.0) tmp = t_0; elseif (im <= 1.7e-7) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.35e+154) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = ((-0.5 * (re * re)) + 1.0) * (((im ^ 3.0) * -0.16666666666666666) - im); t_1 = (cos(re) * (9.0 - (im * im))) / (im + -3.0); tmp = 0.0; if (im <= -8e+179) tmp = t_1; elseif (im <= -22.0) tmp = t_0; elseif (im <= 1.7e-7) tmp = im * -cos(re); elseif (im <= 1.35e+154) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]}, 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, -8e+179], t$95$1, If[LessEqual[im, -22.0], t$95$0, If[LessEqual[im, 1.7e-7], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-0.5 \cdot \left(re \cdot re\right) + 1\right) \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
t_1 := \frac{\cos re \cdot \left(9 - im \cdot im\right)}{im + -3}\\
\mathbf{if}\;im \leq -8 \cdot 10^{+179}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -22:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{-7}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -7.99999999999999984e179 or 1.35000000000000003e154 < 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%
if -7.99999999999999984e179 < im < -22 or 1.69999999999999987e-7 < im < 1.35000000000000003e154Initial program 99.1%
sub0-neg99.1%
Simplified99.1%
Taylor expanded in im around 0 43.1%
mul-1-neg43.1%
unsub-neg43.1%
*-commutative43.1%
associate-*l*43.1%
distribute-lft-out--43.1%
Simplified43.1%
Taylor expanded in re around 0 22.4%
associate--l+22.4%
associate-*r*22.4%
distribute-lft1-in49.9%
unpow249.9%
Simplified49.9%
if -22 < im < 1.69999999999999987e-7Initial program 8.4%
sub0-neg8.4%
Simplified8.4%
Taylor expanded in im around 0 99.4%
mul-1-neg99.4%
*-commutative99.4%
distribute-lft-neg-in99.4%
Simplified99.4%
Final simplification86.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -1.55e+102)
t_0
(if (<= im -5.8e+26)
(* re (* re 0.75))
(if (<= im 3.3e+30)
(* im (- (cos re)))
(if (<= im 2.8e+64) (- (* im (* 0.5 (* re re))) im) t_0))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -1.55e+102) {
tmp = t_0;
} else if (im <= -5.8e+26) {
tmp = re * (re * 0.75);
} else if (im <= 3.3e+30) {
tmp = im * -cos(re);
} else if (im <= 2.8e+64) {
tmp = (im * (0.5 * (re * re))) - im;
} 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.55d+102)) then
tmp = t_0
else if (im <= (-5.8d+26)) then
tmp = re * (re * 0.75d0)
else if (im <= 3.3d+30) then
tmp = im * -cos(re)
else if (im <= 2.8d+64) then
tmp = (im * (0.5d0 * (re * re))) - im
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.55e+102) {
tmp = t_0;
} else if (im <= -5.8e+26) {
tmp = re * (re * 0.75);
} else if (im <= 3.3e+30) {
tmp = im * -Math.cos(re);
} else if (im <= 2.8e+64) {
tmp = (im * (0.5 * (re * re))) - im;
} 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.55e+102: tmp = t_0 elif im <= -5.8e+26: tmp = re * (re * 0.75) elif im <= 3.3e+30: tmp = im * -math.cos(re) elif im <= 2.8e+64: tmp = (im * (0.5 * (re * re))) - im 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.55e+102) tmp = t_0; elseif (im <= -5.8e+26) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 3.3e+30) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 2.8e+64) tmp = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im); 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.55e+102) tmp = t_0; elseif (im <= -5.8e+26) tmp = re * (re * 0.75); elseif (im <= 3.3e+30) tmp = im * -cos(re); elseif (im <= 2.8e+64) tmp = (im * (0.5 * (re * re))) - im; 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.55e+102], t$95$0, If[LessEqual[im, -5.8e+26], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.3e+30], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 2.8e+64], N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -1.55 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -5.8 \cdot 10^{+26}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 3.3 \cdot 10^{+30}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 2.8 \cdot 10^{+64}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.54999999999999993e102 or 2.80000000000000024e64 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 93.8%
mul-1-neg93.8%
unsub-neg93.8%
*-commutative93.8%
associate-*l*93.8%
distribute-lft-out--93.8%
Simplified93.8%
Taylor expanded in re around 0 72.9%
if -1.54999999999999993e102 < im < -5.8e26Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out64.7%
+-commutative64.7%
*-commutative64.7%
unpow264.7%
associate-*l*64.7%
Simplified64.7%
Applied egg-rr29.9%
Taylor expanded in re around inf 30.3%
*-commutative30.3%
unpow230.3%
associate-*l*30.3%
Simplified30.3%
if -5.8e26 < im < 3.30000000000000026e30Initial program 15.9%
sub0-neg15.9%
Simplified15.9%
Taylor expanded in im around 0 92.6%
mul-1-neg92.6%
*-commutative92.6%
distribute-lft-neg-in92.6%
Simplified92.6%
if 3.30000000000000026e30 < im < 2.80000000000000024e64Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.5%
mul-1-neg3.5%
*-commutative3.5%
distribute-lft-neg-in3.5%
Simplified3.5%
Taylor expanded in re around 0 67.0%
neg-mul-167.0%
+-commutative67.0%
unsub-neg67.0%
*-commutative67.0%
*-commutative67.0%
associate-*l*67.0%
unpow267.0%
Simplified67.0%
Final simplification80.6%
(FPCore (re im) :precision binary64 (if (<= im -5.6e+24) (* re (* re 0.75)) (if (<= im 3.7e+30) (* im (- (cos re))) (- (* im (* 0.5 (* re re))) im))))
double code(double re, double im) {
double tmp;
if (im <= -5.6e+24) {
tmp = re * (re * 0.75);
} else if (im <= 3.7e+30) {
tmp = im * -cos(re);
} 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 (im <= (-5.6d+24)) then
tmp = re * (re * 0.75d0)
else if (im <= 3.7d+30) then
tmp = im * -cos(re)
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 (im <= -5.6e+24) {
tmp = re * (re * 0.75);
} else if (im <= 3.7e+30) {
tmp = im * -Math.cos(re);
} else {
tmp = (im * (0.5 * (re * re))) - im;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -5.6e+24: tmp = re * (re * 0.75) elif im <= 3.7e+30: tmp = im * -math.cos(re) else: tmp = (im * (0.5 * (re * re))) - im return tmp
function code(re, im) tmp = 0.0 if (im <= -5.6e+24) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 3.7e+30) tmp = Float64(im * Float64(-cos(re))); 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 (im <= -5.6e+24) tmp = re * (re * 0.75); elseif (im <= 3.7e+30) tmp = im * -cos(re); else tmp = (im * (0.5 * (re * re))) - im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -5.6e+24], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.7e+30], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.6 \cdot 10^{+24}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 3.7 \cdot 10^{+30}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\end{array}
\end{array}
if im < -5.6000000000000003e24Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out68.9%
+-commutative68.9%
*-commutative68.9%
unpow268.9%
associate-*l*68.9%
Simplified68.9%
Applied egg-rr16.0%
Taylor expanded in re around inf 16.6%
*-commutative16.6%
unpow216.6%
associate-*l*16.6%
Simplified16.6%
if -5.6000000000000003e24 < im < 3.70000000000000016e30Initial program 15.9%
sub0-neg15.9%
Simplified15.9%
Taylor expanded in im around 0 92.6%
mul-1-neg92.6%
*-commutative92.6%
distribute-lft-neg-in92.6%
Simplified92.6%
if 3.70000000000000016e30 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.7%
mul-1-neg5.7%
*-commutative5.7%
distribute-lft-neg-in5.7%
Simplified5.7%
Taylor expanded in re around 0 30.0%
neg-mul-130.0%
+-commutative30.0%
unsub-neg30.0%
*-commutative30.0%
*-commutative30.0%
associate-*l*30.0%
unpow230.0%
Simplified30.0%
Final simplification60.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* re re) 0.75)))
(if (<= re 3.3e+77)
(- (* im (* 0.5 (* re re))) im)
(if (<= re 1.35e+154)
(/ (- 2.25 (* t_0 t_0)) (- -1.5 t_0))
(if (<= re 1.05e+229)
(* (+ 0.5 (* re (* re -0.25))) 27.0)
(* re (* re 0.75)))))))
double code(double re, double im) {
double t_0 = (re * re) * 0.75;
double tmp;
if (re <= 3.3e+77) {
tmp = (im * (0.5 * (re * re))) - im;
} else if (re <= 1.35e+154) {
tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
} else if (re <= 1.05e+229) {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
} 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) :: t_0
real(8) :: tmp
t_0 = (re * re) * 0.75d0
if (re <= 3.3d+77) then
tmp = (im * (0.5d0 * (re * re))) - im
else if (re <= 1.35d+154) then
tmp = (2.25d0 - (t_0 * t_0)) / ((-1.5d0) - t_0)
else if (re <= 1.05d+229) then
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * 27.0d0
else
tmp = re * (re * 0.75d0)
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 <= 3.3e+77) {
tmp = (im * (0.5 * (re * re))) - im;
} else if (re <= 1.35e+154) {
tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0);
} else if (re <= 1.05e+229) {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
} else {
tmp = re * (re * 0.75);
}
return tmp;
}
def code(re, im): t_0 = (re * re) * 0.75 tmp = 0 if re <= 3.3e+77: tmp = (im * (0.5 * (re * re))) - im elif re <= 1.35e+154: tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0) elif re <= 1.05e+229: tmp = (0.5 + (re * (re * -0.25))) * 27.0 else: tmp = re * (re * 0.75) return tmp
function code(re, im) t_0 = Float64(Float64(re * re) * 0.75) tmp = 0.0 if (re <= 3.3e+77) tmp = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im); elseif (re <= 1.35e+154) tmp = Float64(Float64(2.25 - Float64(t_0 * t_0)) / Float64(-1.5 - t_0)); elseif (re <= 1.05e+229) tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * 27.0); else tmp = Float64(re * Float64(re * 0.75)); end return tmp end
function tmp_2 = code(re, im) t_0 = (re * re) * 0.75; tmp = 0.0; if (re <= 3.3e+77) tmp = (im * (0.5 * (re * re))) - im; elseif (re <= 1.35e+154) tmp = (2.25 - (t_0 * t_0)) / (-1.5 - t_0); elseif (re <= 1.05e+229) tmp = (0.5 + (re * (re * -0.25))) * 27.0; else tmp = re * (re * 0.75); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]}, If[LessEqual[re, 3.3e+77], N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[re, 1.35e+154], N[(N[(2.25 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-1.5 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.05e+229], N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 27.0), $MachinePrecision], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot 0.75\\
\mathbf{if}\;re \leq 3.3 \cdot 10^{+77}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{elif}\;re \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{2.25 - t_0 \cdot t_0}{-1.5 - t_0}\\
\mathbf{elif}\;re \leq 1.05 \cdot 10^{+229}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\end{array}
\end{array}
if re < 3.2999999999999998e77Initial program 57.2%
sub0-neg57.2%
Simplified57.2%
Taylor expanded in im around 0 50.2%
mul-1-neg50.2%
*-commutative50.2%
distribute-lft-neg-in50.2%
Simplified50.2%
Taylor expanded in re around 0 35.7%
neg-mul-135.7%
+-commutative35.7%
unsub-neg35.7%
*-commutative35.7%
*-commutative35.7%
associate-*l*35.7%
unpow235.7%
Simplified35.7%
if 3.2999999999999998e77 < re < 1.35000000000000003e154Initial program 36.9%
sub0-neg36.9%
Simplified36.9%
Taylor expanded in re around 0 3.6%
*-commutative3.6%
associate-*r*3.6%
distribute-rgt-out3.6%
+-commutative3.6%
*-commutative3.6%
unpow23.6%
associate-*l*3.6%
Simplified3.6%
Applied egg-rr2.9%
distribute-lft-in2.9%
flip-+25.9%
metadata-eval25.9%
metadata-eval25.9%
metadata-eval25.9%
*-commutative25.9%
*-commutative25.9%
associate-*r*25.9%
associate-*l*25.9%
metadata-eval25.9%
associate-*r*25.9%
associate-*l*25.9%
metadata-eval25.9%
metadata-eval25.9%
*-commutative25.9%
associate-*r*25.9%
associate-*l*25.9%
metadata-eval25.9%
Applied egg-rr25.9%
if 1.35000000000000003e154 < re < 1.04999999999999994e229Initial program 43.4%
sub0-neg43.4%
Simplified43.4%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out24.0%
+-commutative24.0%
*-commutative24.0%
unpow224.0%
associate-*l*24.0%
Simplified24.0%
Applied egg-rr25.2%
if 1.04999999999999994e229 < re Initial program 49.7%
sub0-neg49.7%
Simplified49.7%
Taylor expanded in re around 0 0.2%
*-commutative0.2%
associate-*r*0.2%
distribute-rgt-out21.2%
+-commutative21.2%
*-commutative21.2%
unpow221.2%
associate-*l*21.2%
Simplified21.2%
Applied egg-rr22.0%
Taylor expanded in re around inf 22.0%
*-commutative22.0%
unpow222.0%
associate-*l*22.0%
Simplified22.0%
Final simplification33.2%
(FPCore (re im)
:precision binary64
(if (<= re 1.1e+155)
(- im)
(if (<= re 7.6e+228)
(* (+ 0.5 (* re (* re -0.25))) 27.0)
(* re (* re 0.75)))))
double code(double re, double im) {
double tmp;
if (re <= 1.1e+155) {
tmp = -im;
} else if (re <= 7.6e+228) {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
} 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.1d+155) then
tmp = -im
else if (re <= 7.6d+228) then
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * 27.0d0
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.1e+155) {
tmp = -im;
} else if (re <= 7.6e+228) {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
} else {
tmp = re * (re * 0.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.1e+155: tmp = -im elif re <= 7.6e+228: tmp = (0.5 + (re * (re * -0.25))) * 27.0 else: tmp = re * (re * 0.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.1e+155) tmp = Float64(-im); elseif (re <= 7.6e+228) tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * 27.0); else tmp = Float64(re * Float64(re * 0.75)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.1e+155) tmp = -im; elseif (re <= 7.6e+228) tmp = (0.5 + (re * (re * -0.25))) * 27.0; else tmp = re * (re * 0.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.1e+155], (-im), If[LessEqual[re, 7.6e+228], N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 27.0), $MachinePrecision], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.1 \cdot 10^{+155}:\\
\;\;\;\;-im\\
\mathbf{elif}\;re \leq 7.6 \cdot 10^{+228}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\end{array}
\end{array}
if re < 1.1000000000000001e155Initial program 56.0%
sub0-neg56.0%
Simplified56.0%
Taylor expanded in im around 0 51.2%
mul-1-neg51.2%
*-commutative51.2%
distribute-lft-neg-in51.2%
Simplified51.2%
Taylor expanded in re around 0 29.3%
neg-mul-129.3%
Simplified29.3%
if 1.1000000000000001e155 < re < 7.6000000000000004e228Initial program 43.4%
sub0-neg43.4%
Simplified43.4%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out24.0%
+-commutative24.0%
*-commutative24.0%
unpow224.0%
associate-*l*24.0%
Simplified24.0%
Applied egg-rr25.2%
if 7.6000000000000004e228 < re Initial program 49.7%
sub0-neg49.7%
Simplified49.7%
Taylor expanded in re around 0 0.2%
*-commutative0.2%
associate-*r*0.2%
distribute-rgt-out21.2%
+-commutative21.2%
*-commutative21.2%
unpow221.2%
associate-*l*21.2%
Simplified21.2%
Applied egg-rr22.0%
Taylor expanded in re around inf 22.0%
*-commutative22.0%
unpow222.0%
associate-*l*22.0%
Simplified22.0%
Final simplification28.4%
(FPCore (re im) :precision binary64 (if (<= im -5.6e+24) (* re (* re 0.75)) (if (<= im 3.2e+30) (- im) (- (* im (* 0.5 (* re re))) im))))
double code(double re, double im) {
double tmp;
if (im <= -5.6e+24) {
tmp = re * (re * 0.75);
} else if (im <= 3.2e+30) {
tmp = -im;
} 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 (im <= (-5.6d+24)) then
tmp = re * (re * 0.75d0)
else if (im <= 3.2d+30) then
tmp = -im
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 (im <= -5.6e+24) {
tmp = re * (re * 0.75);
} else if (im <= 3.2e+30) {
tmp = -im;
} else {
tmp = (im * (0.5 * (re * re))) - im;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -5.6e+24: tmp = re * (re * 0.75) elif im <= 3.2e+30: tmp = -im else: tmp = (im * (0.5 * (re * re))) - im return tmp
function code(re, im) tmp = 0.0 if (im <= -5.6e+24) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 3.2e+30) tmp = Float64(-im); 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 (im <= -5.6e+24) tmp = re * (re * 0.75); elseif (im <= 3.2e+30) tmp = -im; else tmp = (im * (0.5 * (re * re))) - im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -5.6e+24], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.2e+30], (-im), N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.6 \cdot 10^{+24}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 3.2 \cdot 10^{+30}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\end{array}
\end{array}
if im < -5.6000000000000003e24Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out68.9%
+-commutative68.9%
*-commutative68.9%
unpow268.9%
associate-*l*68.9%
Simplified68.9%
Applied egg-rr16.0%
Taylor expanded in re around inf 16.6%
*-commutative16.6%
unpow216.6%
associate-*l*16.6%
Simplified16.6%
if -5.6000000000000003e24 < im < 3.19999999999999973e30Initial program 15.9%
sub0-neg15.9%
Simplified15.9%
Taylor expanded in im around 0 92.6%
mul-1-neg92.6%
*-commutative92.6%
distribute-lft-neg-in92.6%
Simplified92.6%
Taylor expanded in re around 0 44.2%
neg-mul-144.2%
Simplified44.2%
if 3.19999999999999973e30 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.7%
mul-1-neg5.7%
*-commutative5.7%
distribute-lft-neg-in5.7%
Simplified5.7%
Taylor expanded in re around 0 30.0%
neg-mul-130.0%
+-commutative30.0%
unsub-neg30.0%
*-commutative30.0%
*-commutative30.0%
associate-*l*30.0%
unpow230.0%
Simplified30.0%
Final simplification34.5%
(FPCore (re im) :precision binary64 (if (<= re 2e+166) (- im) (* re (* re 0.75))))
double code(double re, double im) {
double tmp;
if (re <= 2e+166) {
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 <= 2d+166) 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 <= 2e+166) {
tmp = -im;
} else {
tmp = re * (re * 0.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2e+166: tmp = -im else: tmp = re * (re * 0.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 2e+166) 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 <= 2e+166) tmp = -im; else tmp = re * (re * 0.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2e+166], (-im), N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2 \cdot 10^{+166}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\end{array}
\end{array}
if re < 1.99999999999999988e166Initial program 56.3%
sub0-neg56.3%
Simplified56.3%
Taylor expanded in im around 0 50.8%
mul-1-neg50.8%
*-commutative50.8%
distribute-lft-neg-in50.8%
Simplified50.8%
Taylor expanded in re around 0 28.6%
neg-mul-128.6%
Simplified28.6%
if 1.99999999999999988e166 < re Initial program 42.0%
sub0-neg42.0%
Simplified42.0%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out16.8%
+-commutative16.8%
*-commutative16.8%
unpow216.8%
associate-*l*16.8%
Simplified16.8%
Applied egg-rr23.2%
Taylor expanded in re around inf 23.2%
*-commutative23.2%
unpow223.2%
associate-*l*23.2%
Simplified23.2%
Final simplification27.8%
(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 54.3%
sub0-neg54.3%
Simplified54.3%
Taylor expanded in im around 0 52.8%
mul-1-neg52.8%
*-commutative52.8%
distribute-lft-neg-in52.8%
Simplified52.8%
Taylor expanded in re around 0 25.9%
neg-mul-125.9%
Simplified25.9%
Final simplification25.9%
(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 54.3%
sub0-neg54.3%
Simplified54.3%
Taylor expanded in re around 0 4.2%
*-commutative4.2%
associate-*r*4.2%
distribute-rgt-out39.7%
+-commutative39.7%
*-commutative39.7%
unpow239.7%
associate-*l*39.7%
Simplified39.7%
Applied egg-rr9.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 2023230
(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))))