
(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 23 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
(*
(* 0.5 (sin re))
(*
im
(-
(*
(pow im 2.0)
(- (* (pow im 2.0) -0.016666666666666666) 0.3333333333333333))
2.0))))
double code(double re, double im) {
return (0.5 * sin(re)) * (im * ((pow(im, 2.0) * ((pow(im, 2.0) * -0.016666666666666666) - 0.3333333333333333)) - 2.0));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (im * (((im ** 2.0d0) * (((im ** 2.0d0) * (-0.016666666666666666d0)) - 0.3333333333333333d0)) - 2.0d0))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (im * ((Math.pow(im, 2.0) * ((Math.pow(im, 2.0) * -0.016666666666666666) - 0.3333333333333333)) - 2.0));
}
def code(re, im): return (0.5 * math.sin(re)) * (im * ((math.pow(im, 2.0) * ((math.pow(im, 2.0) * -0.016666666666666666) - 0.3333333333333333)) - 2.0))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(im * Float64(Float64((im ^ 2.0) * Float64(Float64((im ^ 2.0) * -0.016666666666666666) - 0.3333333333333333)) - 2.0))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (im * (((im ^ 2.0) * (((im ^ 2.0) * -0.016666666666666666) - 0.3333333333333333)) - 2.0)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * N[(N[(N[Power[im, 2.0], $MachinePrecision] * N[(N[(N[Power[im, 2.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot -0.016666666666666666 - 0.3333333333333333\right) - 2\right)\right)
\end{array}
Initial program 61.1%
Taylor expanded in im around 0 90.3%
Final simplification90.3%
(FPCore (re im) :precision binary64 (if (<= im 3.3) (* (sin re) (- im)) (* (sin re) (* -0.008333333333333333 (pow im 5.0)))))
double code(double re, double im) {
double tmp;
if (im <= 3.3) {
tmp = sin(re) * -im;
} else {
tmp = sin(re) * (-0.008333333333333333 * pow(im, 5.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.3d0) then
tmp = sin(re) * -im
else
tmp = sin(re) * ((-0.008333333333333333d0) * (im ** 5.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 3.3) {
tmp = Math.sin(re) * -im;
} else {
tmp = Math.sin(re) * (-0.008333333333333333 * Math.pow(im, 5.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 3.3: tmp = math.sin(re) * -im else: tmp = math.sin(re) * (-0.008333333333333333 * math.pow(im, 5.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 3.3) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(sin(re) * Float64(-0.008333333333333333 * (im ^ 5.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 3.3) tmp = sin(re) * -im; else tmp = sin(re) * (-0.008333333333333333 * (im ^ 5.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 3.3], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(-0.008333333333333333 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.3:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(-0.008333333333333333 \cdot {im}^{5}\right)\\
\end{array}
\end{array}
if im < 3.2999999999999998Initial program 50.7%
Taylor expanded in im around 0 69.6%
associate-*r*69.6%
neg-mul-169.6%
Simplified69.6%
if 3.2999999999999998 < im Initial program 100.0%
Taylor expanded in im around 0 82.5%
Taylor expanded in im around inf 82.4%
associate-*r*82.4%
*-commutative82.4%
Simplified82.4%
Final simplification72.3%
(FPCore (re im) :precision binary64 (if (<= im 3.3) (* (sin re) (- im)) (* (pow im 5.0) (* (sin re) -0.008333333333333333))))
double code(double re, double im) {
double tmp;
if (im <= 3.3) {
tmp = sin(re) * -im;
} else {
tmp = pow(im, 5.0) * (sin(re) * -0.008333333333333333);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 3.3d0) then
tmp = sin(re) * -im
else
tmp = (im ** 5.0d0) * (sin(re) * (-0.008333333333333333d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 3.3) {
tmp = Math.sin(re) * -im;
} else {
tmp = Math.pow(im, 5.0) * (Math.sin(re) * -0.008333333333333333);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 3.3: tmp = math.sin(re) * -im else: tmp = math.pow(im, 5.0) * (math.sin(re) * -0.008333333333333333) return tmp
function code(re, im) tmp = 0.0 if (im <= 3.3) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64((im ^ 5.0) * Float64(sin(re) * -0.008333333333333333)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 3.3) tmp = sin(re) * -im; else tmp = (im ^ 5.0) * (sin(re) * -0.008333333333333333); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 3.3], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(N[Power[im, 5.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.3:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;{im}^{5} \cdot \left(\sin re \cdot -0.008333333333333333\right)\\
\end{array}
\end{array}
if im < 3.2999999999999998Initial program 50.7%
Taylor expanded in im around 0 69.6%
associate-*r*69.6%
neg-mul-169.6%
Simplified69.6%
if 3.2999999999999998 < im Initial program 100.0%
Taylor expanded in im around 0 82.5%
Taylor expanded in im around inf 82.5%
Taylor expanded in im around inf 82.4%
*-commutative82.4%
associate-*r*82.4%
Simplified82.4%
Final simplification72.3%
(FPCore (re im) :precision binary64 (* (sin re) (* im (+ -1.0 (* (pow im 4.0) -0.008333333333333333)))))
double code(double re, double im) {
return sin(re) * (im * (-1.0 + (pow(im, 4.0) * -0.008333333333333333)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (im * ((-1.0d0) + ((im ** 4.0d0) * (-0.008333333333333333d0))))
end function
public static double code(double re, double im) {
return Math.sin(re) * (im * (-1.0 + (Math.pow(im, 4.0) * -0.008333333333333333)));
}
def code(re, im): return math.sin(re) * (im * (-1.0 + (math.pow(im, 4.0) * -0.008333333333333333)))
function code(re, im) return Float64(sin(re) * Float64(im * Float64(-1.0 + Float64((im ^ 4.0) * -0.008333333333333333)))) end
function tmp = code(re, im) tmp = sin(re) * (im * (-1.0 + ((im ^ 4.0) * -0.008333333333333333))); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(im * N[(-1.0 + N[(N[Power[im, 4.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left(im \cdot \left(-1 + {im}^{4} \cdot -0.008333333333333333\right)\right)
\end{array}
Initial program 61.1%
Taylor expanded in im around 0 90.3%
Taylor expanded in im around inf 89.9%
Taylor expanded in re around inf 89.1%
associate-*r*89.1%
*-commutative89.1%
associate-*r*89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
sub-neg89.9%
metadata-eval89.9%
+-commutative89.9%
distribute-rgt-in89.9%
metadata-eval89.9%
*-commutative89.9%
associate-*l*89.9%
metadata-eval89.9%
Simplified89.9%
Final simplification89.9%
(FPCore (re im) :precision binary64 (* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im)))
double code(double re, double im) {
return sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end function
public static double code(double re, double im) {
return Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
def code(re, im): return math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
function code(re, im) return Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)) end
function tmp = code(re, im) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)
\end{array}
Initial program 61.1%
Taylor expanded in im around 0 80.6%
+-commutative80.6%
mul-1-neg80.6%
unsub-neg80.6%
*-commutative80.6%
associate-*r*80.6%
distribute-lft-out--80.6%
associate-*r*80.6%
*-commutative80.6%
associate-*r*80.6%
associate-*r*83.6%
distribute-rgt-out--83.6%
unsub-neg83.6%
unsub-neg83.6%
Simplified83.6%
Final simplification83.6%
(FPCore (re im) :precision binary64 (if (<= im 1.35e+14) (* (sin re) (- im)) (* 0.5 (* im (* re (- (* -0.016666666666666666 (pow im 4.0)) 2.0))))))
double code(double re, double im) {
double tmp;
if (im <= 1.35e+14) {
tmp = sin(re) * -im;
} else {
tmp = 0.5 * (im * (re * ((-0.016666666666666666 * pow(im, 4.0)) - 2.0)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.35d+14) then
tmp = sin(re) * -im
else
tmp = 0.5d0 * (im * (re * (((-0.016666666666666666d0) * (im ** 4.0d0)) - 2.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.35e+14) {
tmp = Math.sin(re) * -im;
} else {
tmp = 0.5 * (im * (re * ((-0.016666666666666666 * Math.pow(im, 4.0)) - 2.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.35e+14: tmp = math.sin(re) * -im else: tmp = 0.5 * (im * (re * ((-0.016666666666666666 * math.pow(im, 4.0)) - 2.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.35e+14) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(0.5 * Float64(im * Float64(re * Float64(Float64(-0.016666666666666666 * (im ^ 4.0)) - 2.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.35e+14) tmp = sin(re) * -im; else tmp = 0.5 * (im * (re * ((-0.016666666666666666 * (im ^ 4.0)) - 2.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.35e+14], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(0.5 * N[(im * N[(re * N[(N[(-0.016666666666666666 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.35 \cdot 10^{+14}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot \left(-0.016666666666666666 \cdot {im}^{4} - 2\right)\right)\right)\\
\end{array}
\end{array}
if im < 1.35e14Initial program 51.4%
Taylor expanded in im around 0 68.7%
associate-*r*68.7%
neg-mul-168.7%
Simplified68.7%
if 1.35e14 < im Initial program 100.0%
Taylor expanded in im around 0 86.8%
Taylor expanded in im around inf 86.8%
Taylor expanded in re around 0 65.2%
Final simplification68.0%
(FPCore (re im) :precision binary64 (if (<= im 5.5e-7) (* (sin re) (- im)) (* (* im (- (* (pow im 2.0) -0.3333333333333333) 2.0)) (* 0.5 re))))
double code(double re, double im) {
double tmp;
if (im <= 5.5e-7) {
tmp = sin(re) * -im;
} else {
tmp = (im * ((pow(im, 2.0) * -0.3333333333333333) - 2.0)) * (0.5 * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 5.5d-7) then
tmp = sin(re) * -im
else
tmp = (im * (((im ** 2.0d0) * (-0.3333333333333333d0)) - 2.0d0)) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 5.5e-7) {
tmp = Math.sin(re) * -im;
} else {
tmp = (im * ((Math.pow(im, 2.0) * -0.3333333333333333) - 2.0)) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 5.5e-7: tmp = math.sin(re) * -im else: tmp = (im * ((math.pow(im, 2.0) * -0.3333333333333333) - 2.0)) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 5.5e-7) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(Float64(im * Float64(Float64((im ^ 2.0) * -0.3333333333333333) - 2.0)) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 5.5e-7) tmp = sin(re) * -im; else tmp = (im * (((im ^ 2.0) * -0.3333333333333333) - 2.0)) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 5.5e-7], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(N[(im * N[(N[(N[Power[im, 2.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot \left({im}^{2} \cdot -0.3333333333333333 - 2\right)\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < 5.5000000000000003e-7Initial program 50.4%
Taylor expanded in im around 0 69.8%
associate-*r*69.8%
neg-mul-169.8%
Simplified69.8%
if 5.5000000000000003e-7 < im Initial program 99.4%
Taylor expanded in re around 0 76.2%
associate-*r*76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in im around 0 56.8%
Final simplification66.9%
(FPCore (re im) :precision binary64 (if (<= im 5.5e-7) (* (sin re) (- im)) (* im (* re (+ -1.0 (* (pow im 2.0) -0.16666666666666666))))))
double code(double re, double im) {
double tmp;
if (im <= 5.5e-7) {
tmp = sin(re) * -im;
} else {
tmp = im * (re * (-1.0 + (pow(im, 2.0) * -0.16666666666666666)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 5.5d-7) then
tmp = sin(re) * -im
else
tmp = im * (re * ((-1.0d0) + ((im ** 2.0d0) * (-0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 5.5e-7) {
tmp = Math.sin(re) * -im;
} else {
tmp = im * (re * (-1.0 + (Math.pow(im, 2.0) * -0.16666666666666666)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 5.5e-7: tmp = math.sin(re) * -im else: tmp = im * (re * (-1.0 + (math.pow(im, 2.0) * -0.16666666666666666))) return tmp
function code(re, im) tmp = 0.0 if (im <= 5.5e-7) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(im * Float64(re * Float64(-1.0 + Float64((im ^ 2.0) * -0.16666666666666666)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 5.5e-7) tmp = sin(re) * -im; else tmp = im * (re * (-1.0 + ((im ^ 2.0) * -0.16666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 5.5e-7], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(im * N[(re * N[(-1.0 + N[(N[Power[im, 2.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(re \cdot \left(-1 + {im}^{2} \cdot -0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if im < 5.5000000000000003e-7Initial program 50.4%
Taylor expanded in im around 0 69.8%
associate-*r*69.8%
neg-mul-169.8%
Simplified69.8%
if 5.5000000000000003e-7 < im Initial program 99.4%
Taylor expanded in im around 0 56.4%
associate-*r*56.4%
distribute-rgt-out56.4%
*-commutative56.4%
Simplified56.4%
Taylor expanded in re around 0 51.7%
Final simplification65.8%
(FPCore (re im) :precision binary64 (if (<= im 4.3e+14) (* (sin re) (- im)) (* im (* re (+ -1.0 (* (pow im 4.0) -0.008333333333333333))))))
double code(double re, double im) {
double tmp;
if (im <= 4.3e+14) {
tmp = sin(re) * -im;
} else {
tmp = im * (re * (-1.0 + (pow(im, 4.0) * -0.008333333333333333)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 4.3d+14) then
tmp = sin(re) * -im
else
tmp = im * (re * ((-1.0d0) + ((im ** 4.0d0) * (-0.008333333333333333d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4.3e+14) {
tmp = Math.sin(re) * -im;
} else {
tmp = im * (re * (-1.0 + (Math.pow(im, 4.0) * -0.008333333333333333)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.3e+14: tmp = math.sin(re) * -im else: tmp = im * (re * (-1.0 + (math.pow(im, 4.0) * -0.008333333333333333))) return tmp
function code(re, im) tmp = 0.0 if (im <= 4.3e+14) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(im * Float64(re * Float64(-1.0 + Float64((im ^ 4.0) * -0.008333333333333333)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4.3e+14) tmp = sin(re) * -im; else tmp = im * (re * (-1.0 + ((im ^ 4.0) * -0.008333333333333333))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.3e+14], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(im * N[(re * N[(-1.0 + N[(N[Power[im, 4.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.3 \cdot 10^{+14}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(re \cdot \left(-1 + {im}^{4} \cdot -0.008333333333333333\right)\right)\\
\end{array}
\end{array}
if im < 4.3e14Initial program 51.4%
Taylor expanded in im around 0 68.7%
associate-*r*68.7%
neg-mul-168.7%
Simplified68.7%
if 4.3e14 < im Initial program 100.0%
Taylor expanded in im around 0 86.8%
Taylor expanded in im around inf 86.8%
Taylor expanded in re around inf 84.9%
associate-*r*84.9%
*-commutative84.9%
associate-*r*86.8%
associate-*r*86.8%
*-commutative86.8%
associate-*r*86.8%
sub-neg86.8%
metadata-eval86.8%
+-commutative86.8%
distribute-rgt-in86.8%
metadata-eval86.8%
*-commutative86.8%
associate-*l*86.8%
metadata-eval86.8%
Simplified86.8%
Taylor expanded in re around 0 65.2%
Final simplification68.0%
(FPCore (re im) :precision binary64 (if (<= im 1.75e+15) (* (sin re) (- im)) (* re (* im (+ -1.0 (* (pow im 4.0) -0.008333333333333333))))))
double code(double re, double im) {
double tmp;
if (im <= 1.75e+15) {
tmp = sin(re) * -im;
} else {
tmp = re * (im * (-1.0 + (pow(im, 4.0) * -0.008333333333333333)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.75d+15) then
tmp = sin(re) * -im
else
tmp = re * (im * ((-1.0d0) + ((im ** 4.0d0) * (-0.008333333333333333d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.75e+15) {
tmp = Math.sin(re) * -im;
} else {
tmp = re * (im * (-1.0 + (Math.pow(im, 4.0) * -0.008333333333333333)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.75e+15: tmp = math.sin(re) * -im else: tmp = re * (im * (-1.0 + (math.pow(im, 4.0) * -0.008333333333333333))) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.75e+15) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(re * Float64(im * Float64(-1.0 + Float64((im ^ 4.0) * -0.008333333333333333)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.75e+15) tmp = sin(re) * -im; else tmp = re * (im * (-1.0 + ((im ^ 4.0) * -0.008333333333333333))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.75e+15], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(re * N[(im * N[(-1.0 + N[(N[Power[im, 4.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.75 \cdot 10^{+15}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(im \cdot \left(-1 + {im}^{4} \cdot -0.008333333333333333\right)\right)\\
\end{array}
\end{array}
if im < 1.75e15Initial program 51.4%
Taylor expanded in im around 0 68.7%
associate-*r*68.7%
neg-mul-168.7%
Simplified68.7%
if 1.75e15 < im Initial program 100.0%
Taylor expanded in im around 0 86.8%
Taylor expanded in im around inf 86.8%
Taylor expanded in re around 0 65.2%
associate-*r*65.2%
*-commutative65.2%
associate-*r*67.1%
associate-*r*67.1%
*-commutative67.1%
*-commutative67.1%
associate-*r*67.1%
sub-neg67.1%
metadata-eval67.1%
+-commutative67.1%
distribute-rgt-in67.1%
metadata-eval67.1%
*-commutative67.1%
associate-*l*67.1%
metadata-eval67.1%
Simplified67.1%
Final simplification68.4%
(FPCore (re im) :precision binary64 (if (<= im 5800.0) (* (sin re) (- im)) (* re (- (* im (* 0.16666666666666666 (pow re 2.0))) im))))
double code(double re, double im) {
double tmp;
if (im <= 5800.0) {
tmp = sin(re) * -im;
} else {
tmp = re * ((im * (0.16666666666666666 * pow(re, 2.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 <= 5800.0d0) then
tmp = sin(re) * -im
else
tmp = re * ((im * (0.16666666666666666d0 * (re ** 2.0d0))) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 5800.0) {
tmp = Math.sin(re) * -im;
} else {
tmp = re * ((im * (0.16666666666666666 * Math.pow(re, 2.0))) - im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 5800.0: tmp = math.sin(re) * -im else: tmp = re * ((im * (0.16666666666666666 * math.pow(re, 2.0))) - im) return tmp
function code(re, im) tmp = 0.0 if (im <= 5800.0) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(re * Float64(Float64(im * Float64(0.16666666666666666 * (re ^ 2.0))) - im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 5800.0) tmp = sin(re) * -im; else tmp = re * ((im * (0.16666666666666666 * (re ^ 2.0))) - im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 5800.0], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(re * N[(N[(im * N[(0.16666666666666666 * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5800:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(im \cdot \left(0.16666666666666666 \cdot {re}^{2}\right) - im\right)\\
\end{array}
\end{array}
if im < 5800Initial program 50.9%
Taylor expanded in im around 0 69.3%
associate-*r*69.3%
neg-mul-169.3%
Simplified69.3%
if 5800 < im Initial program 100.0%
Taylor expanded in im around 0 4.1%
associate-*r*4.1%
neg-mul-14.1%
Simplified4.1%
Taylor expanded in re around 0 21.3%
neg-mul-121.3%
+-commutative21.3%
unsub-neg21.3%
associate-*r*21.3%
*-commutative21.3%
associate-*l*21.3%
Simplified21.3%
Final simplification59.4%
(FPCore (re im) :precision binary64 (if (<= im 5.5e-7) (* (sin re) (- im)) (* im (- (* -0.16666666666666666 (* re (pow im 2.0))) re))))
double code(double re, double im) {
double tmp;
if (im <= 5.5e-7) {
tmp = sin(re) * -im;
} else {
tmp = im * ((-0.16666666666666666 * (re * pow(im, 2.0))) - re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 5.5d-7) then
tmp = sin(re) * -im
else
tmp = im * (((-0.16666666666666666d0) * (re * (im ** 2.0d0))) - re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 5.5e-7) {
tmp = Math.sin(re) * -im;
} else {
tmp = im * ((-0.16666666666666666 * (re * Math.pow(im, 2.0))) - re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 5.5e-7: tmp = math.sin(re) * -im else: tmp = im * ((-0.16666666666666666 * (re * math.pow(im, 2.0))) - re) return tmp
function code(re, im) tmp = 0.0 if (im <= 5.5e-7) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(im * Float64(Float64(-0.16666666666666666 * Float64(re * (im ^ 2.0))) - re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 5.5e-7) tmp = sin(re) * -im; else tmp = im * ((-0.16666666666666666 * (re * (im ^ 2.0))) - re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 5.5e-7], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(im * N[(N[(-0.16666666666666666 * N[(re * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-0.16666666666666666 \cdot \left(re \cdot {im}^{2}\right) - re\right)\\
\end{array}
\end{array}
if im < 5.5000000000000003e-7Initial program 50.4%
Taylor expanded in im around 0 69.8%
associate-*r*69.8%
neg-mul-169.8%
Simplified69.8%
if 5.5000000000000003e-7 < im Initial program 99.4%
Taylor expanded in re around 0 76.2%
associate-*r*76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in im around 0 51.7%
Final simplification65.8%
(FPCore (re im) :precision binary64 (if (<= im 5800.0) (* (sin re) (- im)) (* re (- (* 0.16666666666666666 (* im (pow re 2.0))) im))))
double code(double re, double im) {
double tmp;
if (im <= 5800.0) {
tmp = sin(re) * -im;
} else {
tmp = re * ((0.16666666666666666 * (im * pow(re, 2.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 <= 5800.0d0) then
tmp = sin(re) * -im
else
tmp = re * ((0.16666666666666666d0 * (im * (re ** 2.0d0))) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 5800.0) {
tmp = Math.sin(re) * -im;
} else {
tmp = re * ((0.16666666666666666 * (im * Math.pow(re, 2.0))) - im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 5800.0: tmp = math.sin(re) * -im else: tmp = re * ((0.16666666666666666 * (im * math.pow(re, 2.0))) - im) return tmp
function code(re, im) tmp = 0.0 if (im <= 5800.0) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(re * Float64(Float64(0.16666666666666666 * Float64(im * (re ^ 2.0))) - im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 5800.0) tmp = sin(re) * -im; else tmp = re * ((0.16666666666666666 * (im * (re ^ 2.0))) - im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 5800.0], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(re * N[(N[(0.16666666666666666 * N[(im * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5800:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(im \cdot {re}^{2}\right) - im\right)\\
\end{array}
\end{array}
if im < 5800Initial program 50.9%
Taylor expanded in im around 0 69.3%
associate-*r*69.3%
neg-mul-169.3%
Simplified69.3%
if 5800 < im Initial program 100.0%
Taylor expanded in im around 0 4.1%
associate-*r*4.1%
neg-mul-14.1%
Simplified4.1%
Taylor expanded in re around 0 21.3%
Final simplification59.4%
(FPCore (re im) :precision binary64 (if (<= im 9.5e+14) (* (sin re) (- im)) (* im (* -0.16666666666666666 (* re (pow im 2.0))))))
double code(double re, double im) {
double tmp;
if (im <= 9.5e+14) {
tmp = sin(re) * -im;
} else {
tmp = im * (-0.16666666666666666 * (re * pow(im, 2.0)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 9.5d+14) then
tmp = sin(re) * -im
else
tmp = im * ((-0.16666666666666666d0) * (re * (im ** 2.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9.5e+14) {
tmp = Math.sin(re) * -im;
} else {
tmp = im * (-0.16666666666666666 * (re * Math.pow(im, 2.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9.5e+14: tmp = math.sin(re) * -im else: tmp = im * (-0.16666666666666666 * (re * math.pow(im, 2.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 9.5e+14) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(im * Float64(-0.16666666666666666 * Float64(re * (im ^ 2.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9.5e+14) tmp = sin(re) * -im; else tmp = im * (-0.16666666666666666 * (re * (im ^ 2.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9.5e+14], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(im * N[(-0.16666666666666666 * N[(re * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9.5 \cdot 10^{+14}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-0.16666666666666666 \cdot \left(re \cdot {im}^{2}\right)\right)\\
\end{array}
\end{array}
if im < 9.5e14Initial program 51.4%
Taylor expanded in im around 0 68.7%
associate-*r*68.7%
neg-mul-168.7%
Simplified68.7%
if 9.5e14 < im Initial program 100.0%
Taylor expanded in im around 0 59.1%
associate-*r*59.1%
distribute-rgt-out59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in re around 0 54.0%
Taylor expanded in im around inf 54.0%
Final simplification65.8%
(FPCore (re im) :precision binary64 (if (<= im 5.5e-7) (* (sin re) (- im)) (* re (- (* (pow im 3.0) -0.16666666666666666) im))))
double code(double re, double im) {
double tmp;
if (im <= 5.5e-7) {
tmp = sin(re) * -im;
} 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 <= 5.5d-7) then
tmp = sin(re) * -im
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 <= 5.5e-7) {
tmp = Math.sin(re) * -im;
} else {
tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 5.5e-7: tmp = math.sin(re) * -im else: tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) tmp = 0.0 if (im <= 5.5e-7) tmp = Float64(sin(re) * Float64(-im)); 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 <= 5.5e-7) tmp = sin(re) * -im; else tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 5.5e-7], N[(N[Sin[re], $MachinePrecision] * (-im)), $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 5.5 \cdot 10^{-7}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if im < 5.5000000000000003e-7Initial program 50.4%
Taylor expanded in im around 0 69.8%
associate-*r*69.8%
neg-mul-169.8%
Simplified69.8%
if 5.5000000000000003e-7 < im Initial program 99.4%
Taylor expanded in im around 0 56.4%
+-commutative56.4%
mul-1-neg56.4%
unsub-neg56.4%
*-commutative56.4%
associate-*r*56.4%
distribute-lft-out--56.4%
associate-*r*56.4%
*-commutative56.4%
associate-*r*56.4%
associate-*r*61.4%
distribute-rgt-out--61.5%
unsub-neg61.5%
unsub-neg61.5%
Simplified61.5%
Taylor expanded in re around 0 56.8%
Final simplification66.9%
(FPCore (re im) :precision binary64 (if (<= im 1.15e+16) (* (sin re) (- im)) (* -0.16666666666666666 (* re (pow im 3.0)))))
double code(double re, double im) {
double tmp;
if (im <= 1.15e+16) {
tmp = sin(re) * -im;
} 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 <= 1.15d+16) then
tmp = sin(re) * -im
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 <= 1.15e+16) {
tmp = Math.sin(re) * -im;
} else {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.15e+16: tmp = math.sin(re) * -im else: tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.15e+16) tmp = Float64(sin(re) * Float64(-im)); 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 <= 1.15e+16) tmp = sin(re) * -im; else tmp = -0.16666666666666666 * (re * (im ^ 3.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.15e+16], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.15 \cdot 10^{+16}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\end{array}
\end{array}
if im < 1.15e16Initial program 51.4%
Taylor expanded in im around 0 68.7%
associate-*r*68.7%
neg-mul-168.7%
Simplified68.7%
if 1.15e16 < im Initial program 100.0%
Taylor expanded in im around 0 59.1%
associate-*r*59.1%
distribute-rgt-out59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in re around 0 54.0%
Taylor expanded in im around inf 59.5%
Final simplification66.9%
(FPCore (re im) :precision binary64 (if (<= im 9.8e+14) (* (sin re) (- im)) (* re (* (pow im 3.0) -0.16666666666666666))))
double code(double re, double im) {
double tmp;
if (im <= 9.8e+14) {
tmp = sin(re) * -im;
} else {
tmp = re * (pow(im, 3.0) * -0.16666666666666666);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 9.8d+14) then
tmp = sin(re) * -im
else
tmp = re * ((im ** 3.0d0) * (-0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9.8e+14) {
tmp = Math.sin(re) * -im;
} else {
tmp = re * (Math.pow(im, 3.0) * -0.16666666666666666);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9.8e+14: tmp = math.sin(re) * -im else: tmp = re * (math.pow(im, 3.0) * -0.16666666666666666) return tmp
function code(re, im) tmp = 0.0 if (im <= 9.8e+14) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(re * Float64((im ^ 3.0) * -0.16666666666666666)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9.8e+14) tmp = sin(re) * -im; else tmp = re * ((im ^ 3.0) * -0.16666666666666666); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9.8e+14], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(re * N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9.8 \cdot 10^{+14}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)\\
\end{array}
\end{array}
if im < 9.8e14Initial program 51.4%
Taylor expanded in im around 0 68.7%
associate-*r*68.7%
neg-mul-168.7%
Simplified68.7%
if 9.8e14 < im Initial program 100.0%
Taylor expanded in im around 0 59.1%
associate-*r*59.1%
distribute-rgt-out59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in re around 0 54.0%
Taylor expanded in im around inf 59.5%
associate-*r*59.5%
Simplified59.5%
Final simplification66.9%
(FPCore (re im) :precision binary64 (if (<= im 5800.0) (* (sin re) (- im)) (* (pow re 3.0) (* im 0.16666666666666666))))
double code(double re, double im) {
double tmp;
if (im <= 5800.0) {
tmp = sin(re) * -im;
} else {
tmp = pow(re, 3.0) * (im * 0.16666666666666666);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 5800.0d0) then
tmp = sin(re) * -im
else
tmp = (re ** 3.0d0) * (im * 0.16666666666666666d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 5800.0) {
tmp = Math.sin(re) * -im;
} else {
tmp = Math.pow(re, 3.0) * (im * 0.16666666666666666);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 5800.0: tmp = math.sin(re) * -im else: tmp = math.pow(re, 3.0) * (im * 0.16666666666666666) return tmp
function code(re, im) tmp = 0.0 if (im <= 5800.0) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64((re ^ 3.0) * Float64(im * 0.16666666666666666)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 5800.0) tmp = sin(re) * -im; else tmp = (re ^ 3.0) * (im * 0.16666666666666666); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 5800.0], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(N[Power[re, 3.0], $MachinePrecision] * N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5800:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;{re}^{3} \cdot \left(im \cdot 0.16666666666666666\right)\\
\end{array}
\end{array}
if im < 5800Initial program 50.9%
Taylor expanded in im around 0 69.3%
associate-*r*69.3%
neg-mul-169.3%
Simplified69.3%
if 5800 < im Initial program 100.0%
Taylor expanded in im around 0 4.1%
associate-*r*4.1%
neg-mul-14.1%
Simplified4.1%
Taylor expanded in re around 0 21.3%
neg-mul-121.3%
+-commutative21.3%
unsub-neg21.3%
associate-*r*21.3%
*-commutative21.3%
associate-*l*21.3%
Simplified21.3%
Taylor expanded in re around inf 19.9%
*-commutative19.9%
*-commutative19.9%
associate-*r*19.9%
Simplified19.9%
Final simplification59.1%
(FPCore (re im) :precision binary64 (* (sin re) (- im)))
double code(double re, double im) {
return sin(re) * -im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * -im
end function
public static double code(double re, double im) {
return Math.sin(re) * -im;
}
def code(re, im): return math.sin(re) * -im
function code(re, im) return Float64(sin(re) * Float64(-im)) end
function tmp = code(re, im) tmp = sin(re) * -im; end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left(-im\right)
\end{array}
Initial program 61.1%
Taylor expanded in im around 0 55.8%
associate-*r*55.8%
neg-mul-155.8%
Simplified55.8%
Final simplification55.8%
(FPCore (re im) :precision binary64 (* re (- im)))
double code(double re, double im) {
return re * -im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re * -im
end function
public static double code(double re, double im) {
return re * -im;
}
def code(re, im): return re * -im
function code(re, im) return Float64(re * Float64(-im)) end
function tmp = code(re, im) tmp = re * -im; end
code[re_, im_] := N[(re * (-im)), $MachinePrecision]
\begin{array}{l}
\\
re \cdot \left(-im\right)
\end{array}
Initial program 61.1%
Taylor expanded in im around 0 55.8%
associate-*r*55.8%
neg-mul-155.8%
Simplified55.8%
Taylor expanded in re around 0 36.8%
associate-*r*36.8%
neg-mul-136.8%
Simplified36.8%
Final simplification36.8%
(FPCore (re im) :precision binary64 -512.0)
double code(double re, double im) {
return -512.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -512.0d0
end function
public static double code(double re, double im) {
return -512.0;
}
def code(re, im): return -512.0
function code(re, im) return -512.0 end
function tmp = code(re, im) tmp = -512.0; end
code[re_, im_] := -512.0
\begin{array}{l}
\\
-512
\end{array}
Initial program 61.1%
Taylor expanded in im around 0 90.3%
Applied egg-rr2.7%
Final simplification2.7%
(FPCore (re im) :precision binary64 -4.6296296296296296e-6)
double code(double re, double im) {
return -4.6296296296296296e-6;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -4.6296296296296296d-6
end function
public static double code(double re, double im) {
return -4.6296296296296296e-6;
}
def code(re, im): return -4.6296296296296296e-6
function code(re, im) return -4.6296296296296296e-6 end
function tmp = code(re, im) tmp = -4.6296296296296296e-6; end
code[re_, im_] := -4.6296296296296296e-6
\begin{array}{l}
\\
-4.6296296296296296 \cdot 10^{-6}
\end{array}
Initial program 61.1%
Taylor expanded in im around 0 90.3%
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 61.1%
Taylor expanded in im around 0 90.3%
Applied egg-rr14.5%
Final simplification14.5%
(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 2024066
(FPCore (re im)
:name "math.cos on complex, imaginary part"
:precision binary64
:alt
(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))))