
(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 -1e+100) (not (<= t_0 5e-6)))
(* t_0 (* 0.5 (sin re)))
(- (* -0.16666666666666666 (* (sin re) (pow im 3.0))) (* im (sin re))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -1e+100) || !(t_0 <= 5e-6)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = (-0.16666666666666666 * (sin(re) * pow(im, 3.0))) - (im * sin(re));
}
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 <= (-1d+100)) .or. (.not. (t_0 <= 5d-6))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = ((-0.16666666666666666d0) * (sin(re) * (im ** 3.0d0))) - (im * sin(re))
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 <= -1e+100) || !(t_0 <= 5e-6)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = (-0.16666666666666666 * (Math.sin(re) * Math.pow(im, 3.0))) - (im * Math.sin(re));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -1e+100) or not (t_0 <= 5e-6): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = (-0.16666666666666666 * (math.sin(re) * math.pow(im, 3.0))) - (im * math.sin(re)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -1e+100) || !(t_0 <= 5e-6)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(Float64(-0.16666666666666666 * Float64(sin(re) * (im ^ 3.0))) - Float64(im * sin(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -1e+100) || ~((t_0 <= 5e-6))) tmp = t_0 * (0.5 * sin(re)); else tmp = (-0.16666666666666666 * (sin(re) * (im ^ 3.0))) - (im * sin(re)); 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, -1e+100], N[Not[LessEqual[t$95$0, 5e-6]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.16666666666666666 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(im * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+100} \lor \neg \left(t_0 \leq 5 \cdot 10^{-6}\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(\sin re \cdot {im}^{3}\right) - im \cdot \sin re\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -1.00000000000000002e100 or 5.00000000000000041e-6 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -1.00000000000000002e100 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 5.00000000000000041e-6Initial program 32.6%
Taylor expanded in im around 0 99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -1e+100) (not (<= t_0 5e-6)))
(* t_0 (* 0.5 (sin re)))
(* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -1e+100) || !(t_0 <= 5e-6)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - 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 <= (-1d+100)) .or. (.not. (t_0 <= 5d-6))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - 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 <= -1e+100) || !(t_0 <= 5e-6)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -1e+100) or not (t_0 <= 5e-6): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -1e+100) || !(t_0 <= 5e-6)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -1e+100) || ~((t_0 <= 5e-6))) tmp = t_0 * (0.5 * sin(re)); else tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - 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, -1e+100], N[Not[LessEqual[t$95$0, 5e-6]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+100} \lor \neg \left(t_0 \leq 5 \cdot 10^{-6}\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -1.00000000000000002e100 or 5.00000000000000041e-6 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -1.00000000000000002e100 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 5.00000000000000041e-6Initial program 32.6%
Taylor expanded in im around 0 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
associate-*r*99.8%
distribute-rgt-out--99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (- (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -2.8e+143)
t_1
(if (<= im -1.1e+23)
t_0
(if (<= im 0.06)
(* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(if (<= im 5.6e+102) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 * re);
double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -2.8e+143) {
tmp = t_1;
} else if (im <= -1.1e+23) {
tmp = t_0;
} else if (im <= 0.06) {
tmp = sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - 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 = (exp(-im) - exp(im)) * (0.5d0 * re)
t_1 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-2.8d+143)) then
tmp = t_1
else if (im <= (-1.1d+23)) then
tmp = t_0
else if (im <= 0.06d0) then
tmp = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - 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 = (Math.exp(-im) - Math.exp(im)) * (0.5 * re);
double t_1 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -2.8e+143) {
tmp = t_1;
} else if (im <= -1.1e+23) {
tmp = t_0;
} else if (im <= 0.06) {
tmp = Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) - math.exp(im)) * (0.5 * re) t_1 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -2.8e+143: tmp = t_1 elif im <= -1.1e+23: tmp = t_0 elif im <= 0.06: tmp = math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) elif im <= 5.6e+102: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 * re)) t_1 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -2.8e+143) tmp = t_1; elseif (im <= -1.1e+23) tmp = t_0; elseif (im <= 0.06) tmp = Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - 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 = (exp(-im) - exp(im)) * (0.5 * re); t_1 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -2.8e+143) tmp = t_1; elseif (im <= -1.1e+23) tmp = t_0; elseif (im <= 0.06) tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - 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[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * 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, -2.8e+143], t$95$1, If[LessEqual[im, -1.1e+23], t$95$0, If[LessEqual[im, 0.06], N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6e+102], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -2.8 \cdot 10^{+143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.1 \cdot 10^{+23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.06:\\
\;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.79999999999999998e143 or 5.60000000000000037e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -2.79999999999999998e143 < im < -1.10000000000000004e23 or 0.059999999999999998 < im < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in re around 0 74.3%
associate-*r*74.3%
*-commutative74.3%
Simplified74.3%
if -1.10000000000000004e23 < im < 0.059999999999999998Initial program 34.6%
Taylor expanded in im around 0 97.0%
+-commutative97.0%
mul-1-neg97.0%
unsub-neg97.0%
associate-*r*97.0%
distribute-rgt-out--96.9%
*-commutative96.9%
Simplified96.9%
Final simplification94.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -5.5e+76)
t_0
(if (<= im -390.0)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (<= im 3.2e+33)
(* im (- (sin re)))
(if (<= im 6.5e+95)
(* 0.027777777777777776 (pow (* im re) 3.0))
t_0))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.5e+76) {
tmp = t_0;
} else if (im <= -390.0) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if (im <= 3.2e+33) {
tmp = im * -sin(re);
} else if (im <= 6.5e+95) {
tmp = 0.027777777777777776 * pow((im * re), 3.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-5.5d+76)) then
tmp = t_0
else if (im <= (-390.0d0)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if (im <= 3.2d+33) then
tmp = im * -sin(re)
else if (im <= 6.5d+95) then
tmp = 0.027777777777777776d0 * ((im * re) ** 3.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.5e+76) {
tmp = t_0;
} else if (im <= -390.0) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if (im <= 3.2e+33) {
tmp = im * -Math.sin(re);
} else if (im <= 6.5e+95) {
tmp = 0.027777777777777776 * Math.pow((im * re), 3.0);
} 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 <= -5.5e+76: tmp = t_0 elif im <= -390.0: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif im <= 3.2e+33: tmp = im * -math.sin(re) elif im <= 6.5e+95: tmp = 0.027777777777777776 * math.pow((im * re), 3.0) 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 <= -5.5e+76) tmp = t_0; elseif (im <= -390.0) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif (im <= 3.2e+33) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 6.5e+95) tmp = Float64(0.027777777777777776 * (Float64(im * re) ^ 3.0)); 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 <= -5.5e+76) tmp = t_0; elseif (im <= -390.0) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif (im <= 3.2e+33) tmp = im * -sin(re); elseif (im <= 6.5e+95) tmp = 0.027777777777777776 * ((im * re) ^ 3.0); 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, -5.5e+76], t$95$0, If[LessEqual[im, -390.0], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.2e+33], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 6.5e+95], N[(0.027777777777777776 * N[Power[N[(im * re), $MachinePrecision], 3.0], $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 -5.5 \cdot 10^{+76}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -390:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq 3.2 \cdot 10^{+33}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+95}:\\
\;\;\;\;0.027777777777777776 \cdot {\left(im \cdot re\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.5000000000000001e76 or 6.5e95 < im Initial program 100.0%
Taylor expanded in im around 0 95.0%
+-commutative95.0%
mul-1-neg95.0%
unsub-neg95.0%
associate-*r*95.0%
distribute-rgt-out--95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in im around inf 95.0%
*-commutative95.0%
associate-*l*95.0%
Simplified95.0%
if -5.5000000000000001e76 < im < -390Initial program 100.0%
Taylor expanded in im around 0 3.2%
associate-*r*3.2%
neg-mul-13.2%
Simplified3.2%
Taylor expanded in re around 0 32.2%
+-commutative32.2%
mul-1-neg32.2%
unsub-neg32.2%
associate-*r*32.2%
*-commutative32.2%
associate-*l*32.2%
distribute-lft-out--47.5%
Simplified47.5%
if -390 < im < 3.20000000000000017e33Initial program 34.1%
Taylor expanded in im around 0 97.5%
associate-*r*97.5%
neg-mul-197.5%
Simplified97.5%
if 3.20000000000000017e33 < im < 6.5e95Initial program 100.0%
Taylor expanded in im around 0 4.4%
+-commutative4.4%
mul-1-neg4.4%
unsub-neg4.4%
associate-*r*4.4%
distribute-rgt-out--4.4%
*-commutative4.4%
Simplified4.4%
Taylor expanded in re around 0 16.8%
+-commutative16.8%
associate-*r*16.8%
distribute-rgt-out47.6%
*-commutative47.6%
Simplified47.6%
Taylor expanded in re around inf 46.8%
Taylor expanded in im around inf 46.8%
cube-prod46.8%
Simplified46.8%
Final simplification91.4%
(FPCore (re im) :precision binary64 (* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im)))
double code(double re, double im) {
return sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
end function
public static double code(double re, double im) {
return Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
def code(re, im): return math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im)
function code(re, im) return Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)) end
function tmp = code(re, im) tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)
\end{array}
Initial program 65.5%
Taylor expanded in im around 0 87.2%
+-commutative87.2%
mul-1-neg87.2%
unsub-neg87.2%
associate-*r*87.2%
distribute-rgt-out--87.2%
*-commutative87.2%
Simplified87.2%
Final simplification87.2%
(FPCore (re im)
:precision binary64
(if (<= im -2.85e+76)
(* -0.16666666666666666 (* re (pow im 3.0)))
(if (<= im -3200.0)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (<= im 3.2e+33)
(* im (- (sin re)))
(if (<= im 3.8e+113)
(* 0.027777777777777776 (pow (* im re) 3.0))
(* re (- (* -0.16666666666666666 (pow im 3.0)) im)))))))
double code(double re, double im) {
double tmp;
if (im <= -2.85e+76) {
tmp = -0.16666666666666666 * (re * pow(im, 3.0));
} else if (im <= -3200.0) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if (im <= 3.2e+33) {
tmp = im * -sin(re);
} else if (im <= 3.8e+113) {
tmp = 0.027777777777777776 * pow((im * re), 3.0);
} else {
tmp = re * ((-0.16666666666666666 * pow(im, 3.0)) - im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-2.85d+76)) then
tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
else if (im <= (-3200.0d0)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if (im <= 3.2d+33) then
tmp = im * -sin(re)
else if (im <= 3.8d+113) then
tmp = 0.027777777777777776d0 * ((im * re) ** 3.0d0)
else
tmp = re * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -2.85e+76) {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
} else if (im <= -3200.0) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if (im <= 3.2e+33) {
tmp = im * -Math.sin(re);
} else if (im <= 3.8e+113) {
tmp = 0.027777777777777776 * Math.pow((im * re), 3.0);
} else {
tmp = re * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -2.85e+76: tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) elif im <= -3200.0: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif im <= 3.2e+33: tmp = im * -math.sin(re) elif im <= 3.8e+113: tmp = 0.027777777777777776 * math.pow((im * re), 3.0) else: tmp = re * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) return tmp
function code(re, im) tmp = 0.0 if (im <= -2.85e+76) tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))); elseif (im <= -3200.0) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif (im <= 3.2e+33) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 3.8e+113) tmp = Float64(0.027777777777777776 * (Float64(im * re) ^ 3.0)); else tmp = Float64(re * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -2.85e+76) tmp = -0.16666666666666666 * (re * (im ^ 3.0)); elseif (im <= -3200.0) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif (im <= 3.2e+33) tmp = im * -sin(re); elseif (im <= 3.8e+113) tmp = 0.027777777777777776 * ((im * re) ^ 3.0); else tmp = re * ((-0.16666666666666666 * (im ^ 3.0)) - im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -2.85e+76], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -3200.0], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.2e+33], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 3.8e+113], N[(0.027777777777777776 * N[Power[N[(im * re), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], N[(re * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.85 \cdot 10^{+76}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{elif}\;im \leq -3200:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq 3.2 \cdot 10^{+33}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 3.8 \cdot 10^{+113}:\\
\;\;\;\;0.027777777777777776 \cdot {\left(im \cdot re\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if im < -2.85000000000000002e76Initial program 100.0%
Taylor expanded in im around 0 91.7%
+-commutative91.7%
mul-1-neg91.7%
unsub-neg91.7%
associate-*r*91.7%
distribute-rgt-out--91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in re around 0 69.8%
Taylor expanded in im around inf 69.8%
if -2.85000000000000002e76 < im < -3200Initial program 100.0%
Taylor expanded in im around 0 3.2%
associate-*r*3.2%
neg-mul-13.2%
Simplified3.2%
Taylor expanded in re around 0 32.2%
+-commutative32.2%
mul-1-neg32.2%
unsub-neg32.2%
associate-*r*32.2%
*-commutative32.2%
associate-*l*32.2%
distribute-lft-out--47.5%
Simplified47.5%
if -3200 < im < 3.20000000000000017e33Initial program 34.1%
Taylor expanded in im around 0 97.5%
associate-*r*97.5%
neg-mul-197.5%
Simplified97.5%
if 3.20000000000000017e33 < im < 3.8000000000000003e113Initial program 100.0%
Taylor expanded in im around 0 10.8%
+-commutative10.8%
mul-1-neg10.8%
unsub-neg10.8%
associate-*r*10.8%
distribute-rgt-out--10.8%
*-commutative10.8%
Simplified10.8%
Taylor expanded in re around 0 14.9%
+-commutative14.9%
associate-*r*14.9%
distribute-rgt-out48.2%
*-commutative48.2%
Simplified48.2%
Taylor expanded in re around inf 47.4%
Taylor expanded in im around inf 47.4%
cube-prod47.3%
Simplified47.3%
if 3.8000000000000003e113 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 70.8%
Final simplification82.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0))))
(t_1 (* 0.027777777777777776 (pow (* im re) 3.0))))
(if (<= im -2.6e+76)
t_0
(if (<= im -520.0)
t_1
(if (<= im 3.2e+33)
(* im (- (sin re)))
(if (<= im 7.8e+105) t_1 t_0))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
double t_1 = 0.027777777777777776 * pow((im * re), 3.0);
double tmp;
if (im <= -2.6e+76) {
tmp = t_0;
} else if (im <= -520.0) {
tmp = t_1;
} else if (im <= 3.2e+33) {
tmp = im * -sin(re);
} else if (im <= 7.8e+105) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
t_1 = 0.027777777777777776d0 * ((im * re) ** 3.0d0)
if (im <= (-2.6d+76)) then
tmp = t_0
else if (im <= (-520.0d0)) then
tmp = t_1
else if (im <= 3.2d+33) then
tmp = im * -sin(re)
else if (im <= 7.8d+105) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * Math.pow(im, 3.0));
double t_1 = 0.027777777777777776 * Math.pow((im * re), 3.0);
double tmp;
if (im <= -2.6e+76) {
tmp = t_0;
} else if (im <= -520.0) {
tmp = t_1;
} else if (im <= 3.2e+33) {
tmp = im * -Math.sin(re);
} else if (im <= 7.8e+105) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0)) t_1 = 0.027777777777777776 * math.pow((im * re), 3.0) tmp = 0 if im <= -2.6e+76: tmp = t_0 elif im <= -520.0: tmp = t_1 elif im <= 3.2e+33: tmp = im * -math.sin(re) elif im <= 7.8e+105: tmp = t_1 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))) t_1 = Float64(0.027777777777777776 * (Float64(im * re) ^ 3.0)) tmp = 0.0 if (im <= -2.6e+76) tmp = t_0; elseif (im <= -520.0) tmp = t_1; elseif (im <= 3.2e+33) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 7.8e+105) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (re * (im ^ 3.0)); t_1 = 0.027777777777777776 * ((im * re) ^ 3.0); tmp = 0.0; if (im <= -2.6e+76) tmp = t_0; elseif (im <= -520.0) tmp = t_1; elseif (im <= 3.2e+33) tmp = im * -sin(re); elseif (im <= 7.8e+105) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.027777777777777776 * N[Power[N[(im * re), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.6e+76], t$95$0, If[LessEqual[im, -520.0], t$95$1, If[LessEqual[im, 3.2e+33], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 7.8e+105], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
t_1 := 0.027777777777777776 \cdot {\left(im \cdot re\right)}^{3}\\
\mathbf{if}\;im \leq -2.6 \cdot 10^{+76}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -520:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 3.2 \cdot 10^{+33}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 7.8 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.5999999999999999e76 or 7.79999999999999957e105 < im Initial program 100.0%
Taylor expanded in im around 0 95.9%
+-commutative95.9%
mul-1-neg95.9%
unsub-neg95.9%
associate-*r*95.9%
distribute-rgt-out--95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in re around 0 70.3%
Taylor expanded in im around inf 70.3%
if -2.5999999999999999e76 < im < -520 or 3.20000000000000017e33 < im < 7.79999999999999957e105Initial program 100.0%
Taylor expanded in im around 0 7.6%
+-commutative7.6%
mul-1-neg7.6%
unsub-neg7.6%
associate-*r*7.6%
distribute-rgt-out--7.6%
*-commutative7.6%
Simplified7.6%
Taylor expanded in re around 0 15.9%
+-commutative15.9%
associate-*r*15.9%
distribute-rgt-out48.0%
*-commutative48.0%
Simplified48.0%
Taylor expanded in re around inf 47.1%
Taylor expanded in im around inf 47.1%
cube-prod47.1%
Simplified47.1%
if -520 < im < 3.20000000000000017e33Initial program 34.1%
Taylor expanded in im around 0 97.5%
associate-*r*97.5%
neg-mul-197.5%
Simplified97.5%
Final simplification82.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0)))))
(if (<= im -4.7e+76)
t_0
(if (<= im -600.0)
(* 0.16666666666666666 (* im (pow re 3.0)))
(if (<= im 3.2e+33)
(* im (- (sin re)))
(if (<= im 7.8e+105)
(* 0.027777777777777776 (pow (* im re) 3.0))
t_0))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
double tmp;
if (im <= -4.7e+76) {
tmp = t_0;
} else if (im <= -600.0) {
tmp = 0.16666666666666666 * (im * pow(re, 3.0));
} else if (im <= 3.2e+33) {
tmp = im * -sin(re);
} else if (im <= 7.8e+105) {
tmp = 0.027777777777777776 * pow((im * re), 3.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
if (im <= (-4.7d+76)) then
tmp = t_0
else if (im <= (-600.0d0)) then
tmp = 0.16666666666666666d0 * (im * (re ** 3.0d0))
else if (im <= 3.2d+33) then
tmp = im * -sin(re)
else if (im <= 7.8d+105) then
tmp = 0.027777777777777776d0 * ((im * re) ** 3.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * Math.pow(im, 3.0));
double tmp;
if (im <= -4.7e+76) {
tmp = t_0;
} else if (im <= -600.0) {
tmp = 0.16666666666666666 * (im * Math.pow(re, 3.0));
} else if (im <= 3.2e+33) {
tmp = im * -Math.sin(re);
} else if (im <= 7.8e+105) {
tmp = 0.027777777777777776 * Math.pow((im * re), 3.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0)) tmp = 0 if im <= -4.7e+76: tmp = t_0 elif im <= -600.0: tmp = 0.16666666666666666 * (im * math.pow(re, 3.0)) elif im <= 3.2e+33: tmp = im * -math.sin(re) elif im <= 7.8e+105: tmp = 0.027777777777777776 * math.pow((im * re), 3.0) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))) tmp = 0.0 if (im <= -4.7e+76) tmp = t_0; elseif (im <= -600.0) tmp = Float64(0.16666666666666666 * Float64(im * (re ^ 3.0))); elseif (im <= 3.2e+33) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 7.8e+105) tmp = Float64(0.027777777777777776 * (Float64(im * re) ^ 3.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (re * (im ^ 3.0)); tmp = 0.0; if (im <= -4.7e+76) tmp = t_0; elseif (im <= -600.0) tmp = 0.16666666666666666 * (im * (re ^ 3.0)); elseif (im <= 3.2e+33) tmp = im * -sin(re); elseif (im <= 7.8e+105) tmp = 0.027777777777777776 * ((im * re) ^ 3.0); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.7e+76], t$95$0, If[LessEqual[im, -600.0], N[(0.16666666666666666 * N[(im * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.2e+33], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 7.8e+105], N[(0.027777777777777776 * N[Power[N[(im * re), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{if}\;im \leq -4.7 \cdot 10^{+76}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -600:\\
\;\;\;\;0.16666666666666666 \cdot \left(im \cdot {re}^{3}\right)\\
\mathbf{elif}\;im \leq 3.2 \cdot 10^{+33}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 7.8 \cdot 10^{+105}:\\
\;\;\;\;0.027777777777777776 \cdot {\left(im \cdot re\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.7000000000000003e76 or 7.79999999999999957e105 < im Initial program 100.0%
Taylor expanded in im around 0 95.9%
+-commutative95.9%
mul-1-neg95.9%
unsub-neg95.9%
associate-*r*95.9%
distribute-rgt-out--95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in re around 0 70.3%
Taylor expanded in im around inf 70.3%
if -4.7000000000000003e76 < im < -600Initial program 100.0%
Taylor expanded in im around 0 3.2%
associate-*r*3.2%
neg-mul-13.2%
Simplified3.2%
Taylor expanded in re around 0 32.2%
Taylor expanded in re around inf 46.9%
if -600 < im < 3.20000000000000017e33Initial program 34.1%
Taylor expanded in im around 0 97.5%
associate-*r*97.5%
neg-mul-197.5%
Simplified97.5%
if 3.20000000000000017e33 < im < 7.79999999999999957e105Initial program 100.0%
Taylor expanded in im around 0 10.8%
+-commutative10.8%
mul-1-neg10.8%
unsub-neg10.8%
associate-*r*10.8%
distribute-rgt-out--10.8%
*-commutative10.8%
Simplified10.8%
Taylor expanded in re around 0 14.9%
+-commutative14.9%
associate-*r*14.9%
distribute-rgt-out48.2%
*-commutative48.2%
Simplified48.2%
Taylor expanded in re around inf 47.4%
Taylor expanded in im around inf 47.4%
cube-prod47.3%
Simplified47.3%
Final simplification82.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0)))))
(if (<= im -2.65e+76)
t_0
(if (<= im -850.0)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (<= im 3.2e+33)
(* im (- (sin re)))
(if (<= im 7.8e+105)
(* 0.027777777777777776 (pow (* im re) 3.0))
t_0))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
double tmp;
if (im <= -2.65e+76) {
tmp = t_0;
} else if (im <= -850.0) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if (im <= 3.2e+33) {
tmp = im * -sin(re);
} else if (im <= 7.8e+105) {
tmp = 0.027777777777777776 * pow((im * re), 3.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
if (im <= (-2.65d+76)) then
tmp = t_0
else if (im <= (-850.0d0)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if (im <= 3.2d+33) then
tmp = im * -sin(re)
else if (im <= 7.8d+105) then
tmp = 0.027777777777777776d0 * ((im * re) ** 3.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * Math.pow(im, 3.0));
double tmp;
if (im <= -2.65e+76) {
tmp = t_0;
} else if (im <= -850.0) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if (im <= 3.2e+33) {
tmp = im * -Math.sin(re);
} else if (im <= 7.8e+105) {
tmp = 0.027777777777777776 * Math.pow((im * re), 3.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0)) tmp = 0 if im <= -2.65e+76: tmp = t_0 elif im <= -850.0: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif im <= 3.2e+33: tmp = im * -math.sin(re) elif im <= 7.8e+105: tmp = 0.027777777777777776 * math.pow((im * re), 3.0) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))) tmp = 0.0 if (im <= -2.65e+76) tmp = t_0; elseif (im <= -850.0) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif (im <= 3.2e+33) tmp = Float64(im * Float64(-sin(re))); elseif (im <= 7.8e+105) tmp = Float64(0.027777777777777776 * (Float64(im * re) ^ 3.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (re * (im ^ 3.0)); tmp = 0.0; if (im <= -2.65e+76) tmp = t_0; elseif (im <= -850.0) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif (im <= 3.2e+33) tmp = im * -sin(re); elseif (im <= 7.8e+105) tmp = 0.027777777777777776 * ((im * re) ^ 3.0); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.65e+76], t$95$0, If[LessEqual[im, -850.0], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.2e+33], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 7.8e+105], N[(0.027777777777777776 * N[Power[N[(im * re), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{if}\;im \leq -2.65 \cdot 10^{+76}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -850:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq 3.2 \cdot 10^{+33}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{elif}\;im \leq 7.8 \cdot 10^{+105}:\\
\;\;\;\;0.027777777777777776 \cdot {\left(im \cdot re\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.65000000000000008e76 or 7.79999999999999957e105 < im Initial program 100.0%
Taylor expanded in im around 0 95.9%
+-commutative95.9%
mul-1-neg95.9%
unsub-neg95.9%
associate-*r*95.9%
distribute-rgt-out--95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in re around 0 70.3%
Taylor expanded in im around inf 70.3%
if -2.65000000000000008e76 < im < -850Initial program 100.0%
Taylor expanded in im around 0 3.2%
associate-*r*3.2%
neg-mul-13.2%
Simplified3.2%
Taylor expanded in re around 0 32.2%
+-commutative32.2%
mul-1-neg32.2%
unsub-neg32.2%
associate-*r*32.2%
*-commutative32.2%
associate-*l*32.2%
distribute-lft-out--47.5%
Simplified47.5%
if -850 < im < 3.20000000000000017e33Initial program 34.1%
Taylor expanded in im around 0 97.5%
associate-*r*97.5%
neg-mul-197.5%
Simplified97.5%
if 3.20000000000000017e33 < im < 7.79999999999999957e105Initial program 100.0%
Taylor expanded in im around 0 10.8%
+-commutative10.8%
mul-1-neg10.8%
unsub-neg10.8%
associate-*r*10.8%
distribute-rgt-out--10.8%
*-commutative10.8%
Simplified10.8%
Taylor expanded in re around 0 14.9%
+-commutative14.9%
associate-*r*14.9%
distribute-rgt-out48.2%
*-commutative48.2%
Simplified48.2%
Taylor expanded in re around inf 47.4%
Taylor expanded in im around inf 47.4%
cube-prod47.3%
Simplified47.3%
Final simplification82.0%
(FPCore (re im) :precision binary64 (if (or (<= im -8.6e+74) (not (<= im 7.8e+105))) (* -0.16666666666666666 (* re (pow im 3.0))) (* im (- (sin re)))))
double code(double re, double im) {
double tmp;
if ((im <= -8.6e+74) || !(im <= 7.8e+105)) {
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 <= (-8.6d+74)) .or. (.not. (im <= 7.8d+105))) 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 <= -8.6e+74) || !(im <= 7.8e+105)) {
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 <= -8.6e+74) or not (im <= 7.8e+105): 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 <= -8.6e+74) || !(im <= 7.8e+105)) 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 <= -8.6e+74) || ~((im <= 7.8e+105))) tmp = -0.16666666666666666 * (re * (im ^ 3.0)); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -8.6e+74], N[Not[LessEqual[im, 7.8e+105]], $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 -8.6 \cdot 10^{+74} \lor \neg \left(im \leq 7.8 \cdot 10^{+105}\right):\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -8.60000000000000001e74 or 7.79999999999999957e105 < im Initial program 100.0%
Taylor expanded in im around 0 95.9%
+-commutative95.9%
mul-1-neg95.9%
unsub-neg95.9%
associate-*r*95.9%
distribute-rgt-out--95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in re around 0 70.3%
Taylor expanded in im around inf 70.3%
if -8.60000000000000001e74 < im < 7.79999999999999957e105Initial program 45.5%
Taylor expanded in im around 0 81.2%
associate-*r*81.2%
neg-mul-181.2%
Simplified81.2%
Final simplification77.2%
(FPCore (re im) :precision binary64 (* im (- (sin re))))
double code(double re, double im) {
return im * -sin(re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im * -sin(re)
end function
public static double code(double re, double im) {
return im * -Math.sin(re);
}
def code(re, im): return im * -math.sin(re)
function code(re, im) return Float64(im * Float64(-sin(re))) end
function tmp = code(re, im) tmp = im * -sin(re); end
code[re_, im_] := N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
im \cdot \left(-\sin re\right)
\end{array}
Initial program 65.5%
Taylor expanded in im around 0 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Final simplification53.2%
(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 65.5%
Taylor expanded in im around 0 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Taylor expanded in re around 0 32.3%
associate-*r*32.3%
neg-mul-132.3%
Simplified32.3%
Final simplification32.3%
(FPCore (re im) :precision binary64 -1.0)
double code(double re, double im) {
return -1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -1.0d0
end function
public static double code(double re, double im) {
return -1.0;
}
def code(re, im): return -1.0
function code(re, im) return -1.0 end
function tmp = code(re, im) tmp = -1.0; end
code[re_, im_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 65.5%
Taylor expanded in im around 0 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Applied egg-rr2.8%
Final simplification2.8%
(FPCore (re im) :precision binary64 -9.92290301275212e-8)
double code(double re, double im) {
return -9.92290301275212e-8;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -9.92290301275212d-8
end function
public static double code(double re, double im) {
return -9.92290301275212e-8;
}
def code(re, im): return -9.92290301275212e-8
function code(re, im) return -9.92290301275212e-8 end
function tmp = code(re, im) tmp = -9.92290301275212e-8; end
code[re_, im_] := -9.92290301275212e-8
\begin{array}{l}
\\
-9.92290301275212 \cdot 10^{-8}
\end{array}
Initial program 65.5%
Taylor expanded in im around 0 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Applied egg-rr2.8%
Final simplification2.8%
(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 65.5%
Taylor expanded in im around 0 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Applied egg-rr16.1%
Final simplification16.1%
(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 2023290
(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))))