
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-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 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-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)))
(* t_0 (* 0.5 (sin re)))
(* (sin 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 = t_0 * (0.5 * sin(re));
} else {
tmp = sin(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 = t_0 * (0.5d0 * sin(re))
else
tmp = sin(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 = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(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 = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(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(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(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 = t_0 * (0.5 * sin(re)); else tmp = sin(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[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[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):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -0.20000000000000001 or 5.0000000000000001e-4 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 5.0000000000000001e-4Initial program 23.6%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (sqrt (* (* re re) (* 0.027777777777777776 (pow im 6.0)))))
(t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -5.6e+102)
t_1
(if (<= im -6.2e+18)
t_0
(if (<= im 3.05e+19)
(* im (- (sin re)))
(if (<= im 5.6e+102) t_0 t_1))))))
double code(double re, double im) {
double t_0 = sqrt(((re * re) * (0.027777777777777776 * pow(im, 6.0))));
double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.6e+102) {
tmp = t_1;
} else if (im <= -6.2e+18) {
tmp = t_0;
} else if (im <= 3.05e+19) {
tmp = im * -sin(re);
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((re * re) * (0.027777777777777776d0 * (im ** 6.0d0))))
t_1 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-5.6d+102)) then
tmp = t_1
else if (im <= (-6.2d+18)) then
tmp = t_0
else if (im <= 3.05d+19) then
tmp = im * -sin(re)
else if (im <= 5.6d+102) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.sqrt(((re * re) * (0.027777777777777776 * Math.pow(im, 6.0))));
double t_1 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.6e+102) {
tmp = t_1;
} else if (im <= -6.2e+18) {
tmp = t_0;
} else if (im <= 3.05e+19) {
tmp = im * -Math.sin(re);
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = math.sqrt(((re * re) * (0.027777777777777776 * math.pow(im, 6.0)))) t_1 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -5.6e+102: tmp = t_1 elif im <= -6.2e+18: tmp = t_0 elif im <= 3.05e+19: tmp = im * -math.sin(re) elif im <= 5.6e+102: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = sqrt(Float64(Float64(re * re) * Float64(0.027777777777777776 * (im ^ 6.0)))) t_1 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -5.6e+102) tmp = t_1; elseif (im <= -6.2e+18) tmp = t_0; elseif (im <= 3.05e+19) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = sqrt(((re * re) * (0.027777777777777776 * (im ^ 6.0)))); t_1 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -5.6e+102) tmp = t_1; elseif (im <= -6.2e+18) tmp = t_0; elseif (im <= 3.05e+19) tmp = im * -sin(re); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[Sqrt[N[(N[(re * re), $MachinePrecision] * N[(0.027777777777777776 * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.6e+102], t$95$1, If[LessEqual[im, -6.2e+18], t$95$0, If[LessEqual[im, 3.05e+19], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 5.6e+102], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\left(re \cdot re\right) \cdot \left(0.027777777777777776 \cdot {im}^{6}\right)}\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -5.6 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -6.2 \cdot 10^{+18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 3.05 \cdot 10^{+19}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -5.60000000000000037e102 or 5.60000000000000037e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -5.60000000000000037e102 < im < -6.2e18 or 3.05e19 < im < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in im around 0 4.8%
mul-1-neg4.8%
unsub-neg4.8%
*-commutative4.8%
associate-*l*4.8%
distribute-lft-out--4.8%
Simplified4.8%
Taylor expanded in re around 0 27.3%
*-commutative27.3%
Simplified27.3%
Taylor expanded in im around inf 27.3%
add-sqr-sqrt18.0%
sqrt-unprod46.4%
swap-sqr46.4%
metadata-eval46.4%
*-commutative46.4%
*-commutative46.4%
swap-sqr48.7%
pow-prod-up48.7%
metadata-eval48.7%
Applied egg-rr48.7%
metadata-eval48.7%
pow-sqr48.7%
associate-*r*48.7%
*-commutative48.7%
pow-sqr48.7%
metadata-eval48.7%
Simplified48.7%
if -6.2e18 < im < 3.05e19Initial program 27.6%
Taylor expanded in im around 0 94.6%
mul-1-neg94.6%
*-commutative94.6%
distribute-rgt-neg-in94.6%
Simplified94.6%
Final simplification90.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (- (exp (- im)) (exp im)) re)))
(t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -5.2e+103)
t_1
(if (<= im -0.0146)
t_0
(if (<= im 0.0048)
(* im (- (sin re)))
(if (<= im 5.6e+102) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * ((exp(-im) - exp(im)) * re);
double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.2e+103) {
tmp = t_1;
} else if (im <= -0.0146) {
tmp = t_0;
} else if (im <= 0.0048) {
tmp = im * -sin(re);
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * ((exp(-im) - exp(im)) * re)
t_1 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-5.2d+103)) then
tmp = t_1
else if (im <= (-0.0146d0)) then
tmp = t_0
else if (im <= 0.0048d0) then
tmp = im * -sin(re)
else if (im <= 5.6d+102) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * ((Math.exp(-im) - Math.exp(im)) * re);
double t_1 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.2e+103) {
tmp = t_1;
} else if (im <= -0.0146) {
tmp = t_0;
} else if (im <= 0.0048) {
tmp = im * -Math.sin(re);
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * ((math.exp(-im) - math.exp(im)) * re) t_1 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -5.2e+103: tmp = t_1 elif im <= -0.0146: tmp = t_0 elif im <= 0.0048: tmp = im * -math.sin(re) elif im <= 5.6e+102: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(Float64(exp(Float64(-im)) - exp(im)) * re)) t_1 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -5.2e+103) tmp = t_1; elseif (im <= -0.0146) tmp = t_0; elseif (im <= 0.0048) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * ((exp(-im) - exp(im)) * re); t_1 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -5.2e+103) tmp = t_1; elseif (im <= -0.0146) tmp = t_0; elseif (im <= 0.0048) tmp = im * -sin(re); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.2e+103], t$95$1, If[LessEqual[im, -0.0146], t$95$0, If[LessEqual[im, 0.0048], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 5.6e+102], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -5.2 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0146:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0048:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -5.2000000000000003e103 or 5.60000000000000037e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -5.2000000000000003e103 < im < -0.0146000000000000001 or 0.00479999999999999958 < im < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in re around 0 69.7%
if -0.0146000000000000001 < im < 0.00479999999999999958Initial program 23.6%
Taylor expanded in im around 0 99.3%
mul-1-neg99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
Simplified99.3%
Final simplification94.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (- (exp (- im)) (exp im)) re)))
(t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -5.2e+103)
t_1
(if (<= im -0.054)
t_0
(if (<= im 0.17)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 5.6e+102) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * ((exp(-im) - exp(im)) * re);
double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.2e+103) {
tmp = t_1;
} else if (im <= -0.054) {
tmp = t_0;
} else if (im <= 0.17) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * ((exp(-im) - exp(im)) * re)
t_1 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-5.2d+103)) then
tmp = t_1
else if (im <= (-0.054d0)) then
tmp = t_0
else if (im <= 0.17d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 5.6d+102) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * ((Math.exp(-im) - Math.exp(im)) * re);
double t_1 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.2e+103) {
tmp = t_1;
} else if (im <= -0.054) {
tmp = t_0;
} else if (im <= 0.17) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * ((math.exp(-im) - math.exp(im)) * re) t_1 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -5.2e+103: tmp = t_1 elif im <= -0.054: tmp = t_0 elif im <= 0.17: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 5.6e+102: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(Float64(exp(Float64(-im)) - exp(im)) * re)) t_1 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -5.2e+103) tmp = t_1; elseif (im <= -0.054) tmp = t_0; elseif (im <= 0.17) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * ((exp(-im) - exp(im)) * re); t_1 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -5.2e+103) tmp = t_1; elseif (im <= -0.054) tmp = t_0; elseif (im <= 0.17) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.2e+103], t$95$1, If[LessEqual[im, -0.054], t$95$0, If[LessEqual[im, 0.17], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6e+102], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -5.2 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.054:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.17:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -5.2000000000000003e103 or 5.60000000000000037e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -5.2000000000000003e103 < im < -0.0539999999999999994 or 0.170000000000000012 < im < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in re around 0 69.7%
if -0.0539999999999999994 < im < 0.170000000000000012Initial program 23.6%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification94.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -1.02e+104)
t_0
(if (<= im -4e+51)
(fabs (* -0.16666666666666666 (* re (pow im 3.0))))
(if (<= im 70000.0)
(* im (- (sin re)))
(if (<= im 1.5e+64)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
t_0))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -1.02e+104) {
tmp = t_0;
} else if (im <= -4e+51) {
tmp = fabs((-0.16666666666666666 * (re * pow(im, 3.0))));
} else if (im <= 70000.0) {
tmp = im * -sin(re);
} else if (im <= 1.5e+64) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-1.02d+104)) then
tmp = t_0
else if (im <= (-4d+51)) then
tmp = abs(((-0.16666666666666666d0) * (re * (im ** 3.0d0))))
else if (im <= 70000.0d0) then
tmp = im * -sin(re)
else if (im <= 1.5d+64) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -1.02e+104) {
tmp = t_0;
} else if (im <= -4e+51) {
tmp = Math.abs((-0.16666666666666666 * (re * Math.pow(im, 3.0))));
} else if (im <= 70000.0) {
tmp = im * -Math.sin(re);
} else if (im <= 1.5e+64) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -1.02e+104: tmp = t_0 elif im <= -4e+51: tmp = math.fabs((-0.16666666666666666 * (re * math.pow(im, 3.0)))) elif im <= 70000.0: tmp = im * -math.sin(re) elif im <= 1.5e+64: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -1.02e+104) tmp = t_0; elseif (im <= -4e+51) tmp = abs(Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0)))); elseif (im <= 70000.0) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 1.5e+64) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -1.02e+104) tmp = t_0; elseif (im <= -4e+51) tmp = abs((-0.16666666666666666 * (re * (im ^ 3.0)))); elseif (im <= 70000.0) tmp = im * -sin(re); elseif (im <= 1.5e+64) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.02e+104], t$95$0, If[LessEqual[im, -4e+51], N[Abs[N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 70000.0], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.5e+64], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -1.02 \cdot 10^{+104}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -4 \cdot 10^{+51}:\\
\;\;\;\;\left|-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\right|\\
\mathbf{elif}\;im \leq 70000:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+64}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.02e104 or 1.5000000000000001e64 < im Initial program 100.0%
Taylor expanded in im around 0 93.6%
mul-1-neg93.6%
unsub-neg93.6%
*-commutative93.6%
associate-*l*93.6%
distribute-lft-out--93.6%
Simplified93.6%
Taylor expanded in im around inf 93.6%
*-commutative93.6%
*-commutative93.6%
associate-*l*93.6%
Simplified93.6%
if -1.02e104 < im < -4e51Initial program 100.0%
Taylor expanded in im around 0 20.3%
mul-1-neg20.3%
unsub-neg20.3%
*-commutative20.3%
associate-*l*20.3%
distribute-lft-out--20.3%
Simplified20.3%
Taylor expanded in re around 0 32.0%
*-commutative32.0%
Simplified32.0%
Taylor expanded in im around inf 32.0%
add-sqr-sqrt31.7%
sqrt-unprod62.6%
swap-sqr62.6%
metadata-eval62.6%
*-commutative62.6%
*-commutative62.6%
swap-sqr53.8%
pow-prod-up53.8%
metadata-eval53.8%
Applied egg-rr53.8%
metadata-eval53.8%
pow-sqr53.8%
associate-*r*53.8%
*-commutative53.8%
*-commutative53.8%
metadata-eval53.8%
swap-sqr53.8%
swap-sqr62.6%
rem-sqrt-square48.9%
associate-*r*55.3%
*-commutative55.3%
*-commutative55.3%
Simplified55.3%
if -4e51 < im < 7e4Initial program 30.6%
Taylor expanded in im around 0 90.8%
mul-1-neg90.8%
*-commutative90.8%
distribute-rgt-neg-in90.8%
Simplified90.8%
if 7e4 < im < 1.5000000000000001e64Initial program 100.0%
Taylor expanded in im around 0 3.3%
mul-1-neg3.3%
*-commutative3.3%
distribute-rgt-neg-in3.3%
Simplified3.3%
Taylor expanded in re around 0 58.8%
associate-*r*58.8%
associate-*r*58.8%
distribute-rgt-out58.8%
mul-1-neg58.8%
Simplified58.8%
Final simplification88.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (- (* 0.16666666666666666 (pow re 3.0)) re))))
(if (<= im -5.2e+263)
(* -0.16666666666666666 (* re (pow im 3.0)))
(if (<= im -4.3e+225)
t_0
(if (<= im -3.1e+47)
(* (pow im 3.0) (* re -0.16666666666666666))
(if (<= im 59000.0)
(* im (- (sin re)))
(if (<= im 3e+43)
t_0
(* re (- (* (pow im 3.0) -0.16666666666666666) im)))))))))
double code(double re, double im) {
double t_0 = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
double tmp;
if (im <= -5.2e+263) {
tmp = -0.16666666666666666 * (re * pow(im, 3.0));
} else if (im <= -4.3e+225) {
tmp = t_0;
} else if (im <= -3.1e+47) {
tmp = pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= 59000.0) {
tmp = im * -sin(re);
} else if (im <= 3e+43) {
tmp = t_0;
} else {
tmp = 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 = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
if (im <= (-5.2d+263)) then
tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
else if (im <= (-4.3d+225)) then
tmp = t_0
else if (im <= (-3.1d+47)) then
tmp = (im ** 3.0d0) * (re * (-0.16666666666666666d0))
else if (im <= 59000.0d0) then
tmp = im * -sin(re)
else if (im <= 3d+43) then
tmp = t_0
else
tmp = re * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
double tmp;
if (im <= -5.2e+263) {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
} else if (im <= -4.3e+225) {
tmp = t_0;
} else if (im <= -3.1e+47) {
tmp = Math.pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= 59000.0) {
tmp = im * -Math.sin(re);
} else if (im <= 3e+43) {
tmp = t_0;
} else {
tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): t_0 = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) tmp = 0 if im <= -5.2e+263: tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) elif im <= -4.3e+225: tmp = t_0 elif im <= -3.1e+47: tmp = math.pow(im, 3.0) * (re * -0.16666666666666666) elif im <= 59000.0: tmp = im * -math.sin(re) elif im <= 3e+43: tmp = t_0 else: tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) t_0 = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)) tmp = 0.0 if (im <= -5.2e+263) tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))); elseif (im <= -4.3e+225) tmp = t_0; elseif (im <= -3.1e+47) tmp = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)); elseif (im <= 59000.0) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 3e+43) tmp = t_0; else tmp = Float64(re * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = im * ((0.16666666666666666 * (re ^ 3.0)) - re); tmp = 0.0; if (im <= -5.2e+263) tmp = -0.16666666666666666 * (re * (im ^ 3.0)); elseif (im <= -4.3e+225) tmp = t_0; elseif (im <= -3.1e+47) tmp = (im ^ 3.0) * (re * -0.16666666666666666); elseif (im <= 59000.0) tmp = im * -sin(re); elseif (im <= 3e+43) tmp = t_0; else tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.2e+263], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -4.3e+225], t$95$0, If[LessEqual[im, -3.1e+47], N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 59000.0], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 3e+43], t$95$0, N[(re * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{if}\;im \leq -5.2 \cdot 10^{+263}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{elif}\;im \leq -4.3 \cdot 10^{+225}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -3.1 \cdot 10^{+47}:\\
\;\;\;\;{im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;im \leq 59000:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 3 \cdot 10^{+43}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if im < -5.2000000000000004e263Initial program 100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -5.2000000000000004e263 < im < -4.3000000000000001e225 or 59000 < im < 3.00000000000000017e43Initial program 100.0%
Taylor expanded in im around 0 4.8%
mul-1-neg4.8%
*-commutative4.8%
distribute-rgt-neg-in4.8%
Simplified4.8%
Taylor expanded in re around 0 53.9%
associate-*r*53.9%
associate-*r*53.9%
distribute-rgt-out80.5%
mul-1-neg80.5%
Simplified80.5%
if -4.3000000000000001e225 < im < -3.1000000000000001e47Initial program 100.0%
Taylor expanded in im around 0 70.0%
mul-1-neg70.0%
unsub-neg70.0%
*-commutative70.0%
associate-*l*70.0%
distribute-lft-out--70.0%
Simplified70.0%
Taylor expanded in re around 0 56.6%
*-commutative56.6%
Simplified56.6%
Taylor expanded in im around inf 56.6%
*-commutative56.6%
*-commutative56.6%
associate-*l*56.6%
Simplified56.6%
if -3.1000000000000001e47 < im < 59000Initial program 29.6%
Taylor expanded in im around 0 92.0%
mul-1-neg92.0%
*-commutative92.0%
distribute-rgt-neg-in92.0%
Simplified92.0%
if 3.00000000000000017e43 < im Initial program 100.0%
Taylor expanded in im around 0 79.9%
mul-1-neg79.9%
unsub-neg79.9%
*-commutative79.9%
associate-*l*79.9%
distribute-lft-out--79.9%
Simplified79.9%
Taylor expanded in re around 0 69.6%
*-commutative69.6%
Simplified69.6%
Final simplification81.4%
(FPCore (re im)
:precision binary64
(if (<= im -3.4e+47)
(* (pow im 3.0) (* re -0.16666666666666666))
(if (<= im 1.7e-7)
(* im (- (sin re)))
(* re (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
double tmp;
if (im <= -3.4e+47) {
tmp = pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= 1.7e-7) {
tmp = im * -sin(re);
} else {
tmp = 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) :: tmp
if (im <= (-3.4d+47)) then
tmp = (im ** 3.0d0) * (re * (-0.16666666666666666d0))
else if (im <= 1.7d-7) then
tmp = im * -sin(re)
else
tmp = re * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.4e+47) {
tmp = Math.pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= 1.7e-7) {
tmp = im * -Math.sin(re);
} else {
tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.4e+47: tmp = math.pow(im, 3.0) * (re * -0.16666666666666666) elif im <= 1.7e-7: tmp = im * -math.sin(re) else: tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) tmp = 0.0 if (im <= -3.4e+47) tmp = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)); elseif (im <= 1.7e-7) tmp = Float64(im * Float64(-sin(re))); else tmp = Float64(re * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.4e+47) tmp = (im ^ 3.0) * (re * -0.16666666666666666); elseif (im <= 1.7e-7) tmp = im * -sin(re); else tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.4e+47], N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.7e-7], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], N[(re * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.4 \cdot 10^{+47}:\\
\;\;\;\;{im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{-7}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if im < -3.3999999999999998e47Initial program 100.0%
Taylor expanded in im around 0 78.4%
mul-1-neg78.4%
unsub-neg78.4%
*-commutative78.4%
associate-*l*78.4%
distribute-lft-out--78.4%
Simplified78.4%
Taylor expanded in re around 0 56.5%
*-commutative56.5%
Simplified56.5%
Taylor expanded in im around inf 56.5%
*-commutative56.5%
*-commutative56.5%
associate-*l*56.5%
Simplified56.5%
if -3.3999999999999998e47 < im < 1.69999999999999987e-7Initial program 27.5%
Taylor expanded in im around 0 93.9%
mul-1-neg93.9%
*-commutative93.9%
distribute-rgt-neg-in93.9%
Simplified93.9%
if 1.69999999999999987e-7 < im Initial program 99.0%
Taylor expanded in im around 0 69.2%
mul-1-neg69.2%
unsub-neg69.2%
*-commutative69.2%
associate-*l*69.2%
distribute-lft-out--69.2%
Simplified69.2%
Taylor expanded in re around 0 60.6%
*-commutative60.6%
Simplified60.6%
Final simplification77.2%
(FPCore (re im) :precision binary64 (if (or (<= im -4.6e+47) (not (<= im 1.5e+40))) (* -0.16666666666666666 (* re (pow im 3.0))) (* im (- (sin re)))))
double code(double re, double im) {
double tmp;
if ((im <= -4.6e+47) || !(im <= 1.5e+40)) {
tmp = -0.16666666666666666 * (re * pow(im, 3.0));
} else {
tmp = im * -sin(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-4.6d+47)) .or. (.not. (im <= 1.5d+40))) then
tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
else
tmp = im * -sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -4.6e+47) || !(im <= 1.5e+40)) {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -4.6e+47) or not (im <= 1.5e+40): tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -4.6e+47) || !(im <= 1.5e+40)) tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -4.6e+47) || ~((im <= 1.5e+40))) tmp = -0.16666666666666666 * (re * (im ^ 3.0)); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -4.6e+47], N[Not[LessEqual[im, 1.5e+40]], $MachinePrecision]], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -4.6 \cdot 10^{+47} \lor \neg \left(im \leq 1.5 \cdot 10^{+40}\right):\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -4.5999999999999997e47 or 1.5000000000000001e40 < im Initial program 100.0%
Taylor expanded in im around 0 79.1%
mul-1-neg79.1%
unsub-neg79.1%
*-commutative79.1%
associate-*l*79.1%
distribute-lft-out--79.1%
Simplified79.1%
Taylor expanded in re around 0 62.7%
*-commutative62.7%
Simplified62.7%
Taylor expanded in im around inf 62.7%
if -4.5999999999999997e47 < im < 1.5000000000000001e40Initial program 33.0%
Taylor expanded in im around 0 87.8%
mul-1-neg87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
Simplified87.8%
Final simplification77.1%
(FPCore (re im)
:precision binary64
(if (<= im -3.1e+47)
(* (pow im 3.0) (* re -0.16666666666666666))
(if (<= im 2e+38)
(* im (- (sin re)))
(* -0.16666666666666666 (* re (pow im 3.0))))))
double code(double re, double im) {
double tmp;
if (im <= -3.1e+47) {
tmp = pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= 2e+38) {
tmp = im * -sin(re);
} else {
tmp = -0.16666666666666666 * (re * pow(im, 3.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-3.1d+47)) then
tmp = (im ** 3.0d0) * (re * (-0.16666666666666666d0))
else if (im <= 2d+38) then
tmp = im * -sin(re)
else
tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.1e+47) {
tmp = Math.pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= 2e+38) {
tmp = im * -Math.sin(re);
} else {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.1e+47: tmp = math.pow(im, 3.0) * (re * -0.16666666666666666) elif im <= 2e+38: tmp = im * -math.sin(re) else: tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= -3.1e+47) tmp = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)); elseif (im <= 2e+38) tmp = Float64(im * Float64(-sin(re))); else tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.1e+47) tmp = (im ^ 3.0) * (re * -0.16666666666666666); elseif (im <= 2e+38) tmp = im * -sin(re); else tmp = -0.16666666666666666 * (re * (im ^ 3.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.1e+47], N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2e+38], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.1 \cdot 10^{+47}:\\
\;\;\;\;{im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+38}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\end{array}
\end{array}
if im < -3.1000000000000001e47Initial program 100.0%
Taylor expanded in im around 0 78.4%
mul-1-neg78.4%
unsub-neg78.4%
*-commutative78.4%
associate-*l*78.4%
distribute-lft-out--78.4%
Simplified78.4%
Taylor expanded in re around 0 56.5%
*-commutative56.5%
Simplified56.5%
Taylor expanded in im around inf 56.5%
*-commutative56.5%
*-commutative56.5%
associate-*l*56.5%
Simplified56.5%
if -3.1000000000000001e47 < im < 1.99999999999999995e38Initial program 33.0%
Taylor expanded in im around 0 87.8%
mul-1-neg87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
Simplified87.8%
if 1.99999999999999995e38 < im Initial program 100.0%
Taylor expanded in im around 0 79.9%
mul-1-neg79.9%
unsub-neg79.9%
*-commutative79.9%
associate-*l*79.9%
distribute-lft-out--79.9%
Simplified79.9%
Taylor expanded in re around 0 69.6%
*-commutative69.6%
Simplified69.6%
Taylor expanded in im around inf 69.6%
Final simplification77.1%
(FPCore (re im) :precision binary64 (if (<= im 4.8e+41) (* im (- (sin re))) (* (- im) re)))
double code(double re, double im) {
double tmp;
if (im <= 4.8e+41) {
tmp = im * -sin(re);
} else {
tmp = -im * re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 4.8d+41) then
tmp = im * -sin(re)
else
tmp = -im * re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4.8e+41) {
tmp = im * -Math.sin(re);
} else {
tmp = -im * re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.8e+41: tmp = im * -math.sin(re) else: tmp = -im * re return tmp
function code(re, im) tmp = 0.0 if (im <= 4.8e+41) tmp = Float64(im * Float64(-sin(re))); else tmp = Float64(Float64(-im) * re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4.8e+41) tmp = im * -sin(re); else tmp = -im * re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.8e+41], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], N[((-im) * re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.8 \cdot 10^{+41}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot re\\
\end{array}
\end{array}
if im < 4.8000000000000003e41Initial program 51.7%
Taylor expanded in im around 0 64.5%
mul-1-neg64.5%
*-commutative64.5%
distribute-rgt-neg-in64.5%
Simplified64.5%
if 4.8000000000000003e41 < im Initial program 100.0%
Taylor expanded in im around 0 4.8%
mul-1-neg4.8%
*-commutative4.8%
distribute-rgt-neg-in4.8%
Simplified4.8%
Taylor expanded in re around 0 19.8%
mul-1-neg19.8%
distribute-rgt-neg-in19.8%
Simplified19.8%
Final simplification55.4%
(FPCore (re im) :precision binary64 (* (- im) re))
double code(double re, double im) {
return -im * re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -im * re
end function
public static double code(double re, double im) {
return -im * re;
}
def code(re, im): return -im * re
function code(re, im) return Float64(Float64(-im) * re) end
function tmp = code(re, im) tmp = -im * re; end
code[re_, im_] := N[((-im) * re), $MachinePrecision]
\begin{array}{l}
\\
\left(-im\right) \cdot re
\end{array}
Initial program 61.5%
Taylor expanded in im around 0 52.3%
mul-1-neg52.3%
*-commutative52.3%
distribute-rgt-neg-in52.3%
Simplified52.3%
Taylor expanded in re around 0 27.4%
mul-1-neg27.4%
distribute-rgt-neg-in27.4%
Simplified27.4%
Final simplification27.4%
(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 61.5%
Taylor expanded in re around 0 45.4%
Applied egg-rr2.8%
Final simplification2.8%
(FPCore (re im) :precision binary64 -0.0023148148148148147)
double code(double re, double im) {
return -0.0023148148148148147;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -0.0023148148148148147d0
end function
public static double code(double re, double im) {
return -0.0023148148148148147;
}
def code(re, im): return -0.0023148148148148147
function code(re, im) return -0.0023148148148148147 end
function tmp = code(re, im) tmp = -0.0023148148148148147; end
code[re_, im_] := -0.0023148148148148147
\begin{array}{l}
\\
-0.0023148148148148147
\end{array}
Initial program 61.5%
Taylor expanded in re around 0 45.4%
Applied egg-rr2.9%
Final simplification2.9%
(FPCore (re im) :precision binary64 -4.96145150637606e-8)
double code(double re, double im) {
return -4.96145150637606e-8;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -4.96145150637606d-8
end function
public static double code(double re, double im) {
return -4.96145150637606e-8;
}
def code(re, im): return -4.96145150637606e-8
function code(re, im) return -4.96145150637606e-8 end
function tmp = code(re, im) tmp = -4.96145150637606e-8; end
code[re_, im_] := -4.96145150637606e-8
\begin{array}{l}
\\
-4.96145150637606 \cdot 10^{-8}
\end{array}
Initial program 61.5%
Taylor expanded in re around 0 45.4%
Applied egg-rr2.9%
Final simplification2.9%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 61.5%
Taylor expanded in re around 0 45.4%
Applied egg-rr10.9%
Final simplification10.9%
(FPCore (re im)
:precision binary64
(if (< (fabs im) 1.0)
(-
(*
(sin re)
(+
(+ im (* (* (* 0.16666666666666666 im) im) im))
(* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if (fabs(im) < 1.0) {
tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * sin(re)) * (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 (abs(im) < 1.0d0) then
tmp = -(sin(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
else
tmp = (0.5d0 * sin(re)) * (exp(-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.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if math.fabs(im) < 1.0: tmp = -(math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))) else: tmp = (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (abs(im) < 1.0) tmp = Float64(-Float64(sin(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 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (abs(im) < 1.0) tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))); else tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Sin[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[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\sin 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 \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\end{array}
herbie shell --seed 2023230
(FPCore (re im)
:name "math.cos on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1.0) (- (* (sin re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))