
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
(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}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= im 170000000.0)
(*
(* 0.5 (sin re))
(+ (+ 2.0 (* im im)) (* (pow im 4.0) 0.08333333333333333)))
(if (<= im 8.6e+74)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(* 0.041666666666666664 (* (sin re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = (0.5 * sin(re)) * ((2.0 + (im * im)) + (pow(im, 4.0) * 0.08333333333333333));
} else if (im <= 8.6e+74) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 170000000.0d0) then
tmp = (0.5d0 * sin(re)) * ((2.0d0 + (im * im)) + ((im ** 4.0d0) * 0.08333333333333333d0))
else if (im <= 8.6d+74) then
tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
else
tmp = 0.041666666666666664d0 * (sin(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = (0.5 * Math.sin(re)) * ((2.0 + (im * im)) + (Math.pow(im, 4.0) * 0.08333333333333333));
} else if (im <= 8.6e+74) {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
} else {
tmp = 0.041666666666666664 * (Math.sin(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 170000000.0: tmp = (0.5 * math.sin(re)) * ((2.0 + (im * im)) + (math.pow(im, 4.0) * 0.08333333333333333)) elif im <= 8.6e+74: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) else: tmp = 0.041666666666666664 * (math.sin(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 170000000.0) tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(2.0 + Float64(im * im)) + Float64((im ^ 4.0) * 0.08333333333333333))); elseif (im <= 8.6e+74) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 170000000.0) tmp = (0.5 * sin(re)) * ((2.0 + (im * im)) + ((im ^ 4.0) * 0.08333333333333333)); elseif (im <= 8.6e+74) tmp = (exp(-im) + exp(im)) * (0.5 * re); else tmp = 0.041666666666666664 * (sin(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 170000000.0], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.6e+74], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 170000000:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right)\\
\mathbf{elif}\;im \leq 8.6 \cdot 10^{+74}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 1.7e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 92.6%
Simplified92.6%
if 1.7e8 < im < 8.60000000000000001e74Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 85.7%
if 8.60000000000000001e74 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.2%
Simplified98.2%
Taylor expanded in im around inf 98.2%
*-commutative98.2%
Simplified98.2%
Final simplification93.3%
(FPCore (re im)
:precision binary64
(if (<= im 170000000.0)
(* (* 0.5 (sin re)) (+ 2.0 (* im im)))
(if (<= im 8.6e+74)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(* 0.041666666666666664 (* (sin re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = (0.5 * sin(re)) * (2.0 + (im * im));
} else if (im <= 8.6e+74) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 170000000.0d0) then
tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
else if (im <= 8.6d+74) then
tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
else
tmp = 0.041666666666666664d0 * (sin(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
} else if (im <= 8.6e+74) {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
} else {
tmp = 0.041666666666666664 * (Math.sin(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 170000000.0: tmp = (0.5 * math.sin(re)) * (2.0 + (im * im)) elif im <= 8.6e+74: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) else: tmp = 0.041666666666666664 * (math.sin(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 170000000.0) tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))); elseif (im <= 8.6e+74) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 170000000.0) tmp = (0.5 * sin(re)) * (2.0 + (im * im)); elseif (im <= 8.6e+74) tmp = (exp(-im) + exp(im)) * (0.5 * re); else tmp = 0.041666666666666664 * (sin(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 170000000.0], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.6e+74], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 170000000:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 8.6 \cdot 10^{+74}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 1.7e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.2%
Simplified84.2%
if 1.7e8 < im < 8.60000000000000001e74Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 85.7%
if 8.60000000000000001e74 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.2%
Simplified98.2%
Taylor expanded in im around inf 98.2%
*-commutative98.2%
Simplified98.2%
Final simplification86.9%
(FPCore (re im)
:precision binary64
(if (<= im 580.0)
(* (* 0.5 (sin re)) (+ 2.0 (* im im)))
(if (<= im 1.16e+77)
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
(* 0.041666666666666664 (* (sin re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 580.0) {
tmp = (0.5 * sin(re)) * (2.0 + (im * im));
} else if (im <= 1.16e+77) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else {
tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 580.0d0) then
tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
else if (im <= 1.16d+77) then
tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
else
tmp = 0.041666666666666664d0 * (sin(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 580.0) {
tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
} else if (im <= 1.16e+77) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else {
tmp = 0.041666666666666664 * (Math.sin(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 580.0: tmp = (0.5 * math.sin(re)) * (2.0 + (im * im)) elif im <= 1.16e+77: tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) else: tmp = 0.041666666666666664 * (math.sin(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 580.0) tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.16e+77) tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))); else tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 580.0) tmp = (0.5 * sin(re)) * (2.0 + (im * im)); elseif (im <= 1.16e+77) tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); else tmp = 0.041666666666666664 * (sin(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 580.0], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.16e+77], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 580:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.16 \cdot 10^{+77}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 580Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.6%
Simplified84.6%
if 580 < im < 1.1600000000000001e77Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr14.5%
Taylor expanded in re around 0 38.8%
associate-*r/38.8%
metadata-eval38.8%
unpow238.8%
*-commutative38.8%
unpow238.8%
Simplified38.8%
if 1.1600000000000001e77 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification84.6%
(FPCore (re im)
:precision binary64
(if (<= im 120.0)
(* (* 0.5 (sin re)) (+ 2.0 (* im im)))
(if (<= im 1.16e+77)
(* 0.5 (+ (exp (- im)) (exp im)))
(* 0.041666666666666664 (* (sin re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 120.0) {
tmp = (0.5 * sin(re)) * (2.0 + (im * im));
} else if (im <= 1.16e+77) {
tmp = 0.5 * (exp(-im) + exp(im));
} else {
tmp = 0.041666666666666664 * (sin(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 120.0d0) then
tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
else if (im <= 1.16d+77) then
tmp = 0.5d0 * (exp(-im) + exp(im))
else
tmp = 0.041666666666666664d0 * (sin(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 120.0) {
tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
} else if (im <= 1.16e+77) {
tmp = 0.5 * (Math.exp(-im) + Math.exp(im));
} else {
tmp = 0.041666666666666664 * (Math.sin(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 120.0: tmp = (0.5 * math.sin(re)) * (2.0 + (im * im)) elif im <= 1.16e+77: tmp = 0.5 * (math.exp(-im) + math.exp(im)) else: tmp = 0.041666666666666664 * (math.sin(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 120.0) tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.16e+77) tmp = Float64(0.5 * Float64(exp(Float64(-im)) + exp(im))); else tmp = Float64(0.041666666666666664 * Float64(sin(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 120.0) tmp = (0.5 * sin(re)) * (2.0 + (im * im)); elseif (im <= 1.16e+77) tmp = 0.5 * (exp(-im) + exp(im)); else tmp = 0.041666666666666664 * (sin(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 120.0], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.16e+77], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 120:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.16 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\sin re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 120Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.6%
Simplified84.6%
if 120 < im < 1.1600000000000001e77Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr56.3%
+-inverses56.3%
+-rgt-identity56.3%
*-inverses56.3%
Simplified56.3%
if 1.1600000000000001e77 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification85.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))) (t_1 (+ 2.0 (* im im))))
(if (<= im 170000000.0)
(* t_0 t_1)
(if (<= im 4.3e+58)
(pow re -512.0)
(if (<= im 2.1e+153)
(* (+ t_1 (* (pow im 4.0) 0.08333333333333333)) (* 0.5 re))
(* t_0 (* im im)))))))
double code(double re, double im) {
double t_0 = 0.5 * sin(re);
double t_1 = 2.0 + (im * im);
double tmp;
if (im <= 170000000.0) {
tmp = t_0 * t_1;
} else if (im <= 4.3e+58) {
tmp = pow(re, -512.0);
} else if (im <= 2.1e+153) {
tmp = (t_1 + (pow(im, 4.0) * 0.08333333333333333)) * (0.5 * re);
} else {
tmp = t_0 * (im * 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) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * sin(re)
t_1 = 2.0d0 + (im * im)
if (im <= 170000000.0d0) then
tmp = t_0 * t_1
else if (im <= 4.3d+58) then
tmp = re ** (-512.0d0)
else if (im <= 2.1d+153) then
tmp = (t_1 + ((im ** 4.0d0) * 0.08333333333333333d0)) * (0.5d0 * re)
else
tmp = t_0 * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.sin(re);
double t_1 = 2.0 + (im * im);
double tmp;
if (im <= 170000000.0) {
tmp = t_0 * t_1;
} else if (im <= 4.3e+58) {
tmp = Math.pow(re, -512.0);
} else if (im <= 2.1e+153) {
tmp = (t_1 + (Math.pow(im, 4.0) * 0.08333333333333333)) * (0.5 * re);
} else {
tmp = t_0 * (im * im);
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.sin(re) t_1 = 2.0 + (im * im) tmp = 0 if im <= 170000000.0: tmp = t_0 * t_1 elif im <= 4.3e+58: tmp = math.pow(re, -512.0) elif im <= 2.1e+153: tmp = (t_1 + (math.pow(im, 4.0) * 0.08333333333333333)) * (0.5 * re) else: tmp = t_0 * (im * im) return tmp
function code(re, im) t_0 = Float64(0.5 * sin(re)) t_1 = Float64(2.0 + Float64(im * im)) tmp = 0.0 if (im <= 170000000.0) tmp = Float64(t_0 * t_1); elseif (im <= 4.3e+58) tmp = re ^ -512.0; elseif (im <= 2.1e+153) tmp = Float64(Float64(t_1 + Float64((im ^ 4.0) * 0.08333333333333333)) * Float64(0.5 * re)); else tmp = Float64(t_0 * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * sin(re); t_1 = 2.0 + (im * im); tmp = 0.0; if (im <= 170000000.0) tmp = t_0 * t_1; elseif (im <= 4.3e+58) tmp = re ^ -512.0; elseif (im <= 2.1e+153) tmp = (t_1 + ((im ^ 4.0) * 0.08333333333333333)) * (0.5 * re); else tmp = t_0 * (im * im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 170000000.0], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[im, 4.3e+58], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 2.1e+153], N[(N[(t$95$1 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
t_1 := 2 + im \cdot im\\
\mathbf{if}\;im \leq 170000000:\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{elif}\;im \leq 4.3 \cdot 10^{+58}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+153}:\\
\;\;\;\;\left(t_1 + {im}^{4} \cdot 0.08333333333333333\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 1.7e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.2%
Simplified84.2%
if 1.7e8 < im < 4.29999999999999991e58Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 84.6%
Applied egg-rr31.3%
if 4.29999999999999991e58 < im < 2.10000000000000017e153Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 63.6%
Taylor expanded in im around 0 55.1%
Simplified55.1%
if 2.10000000000000017e153 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification82.7%
(FPCore (re im)
:precision binary64
(if (<= im 540000000.0)
(sin re)
(if (<= im 2.95e+57)
(pow re -512.0)
(if (<= im 4e+222)
(* 0.041666666666666664 (* re (pow im 4.0)))
(* 0.5 (* im (* (sin re) im)))))))
double code(double re, double im) {
double tmp;
if (im <= 540000000.0) {
tmp = sin(re);
} else if (im <= 2.95e+57) {
tmp = pow(re, -512.0);
} else if (im <= 4e+222) {
tmp = 0.041666666666666664 * (re * pow(im, 4.0));
} else {
tmp = 0.5 * (im * (sin(re) * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 540000000.0d0) then
tmp = sin(re)
else if (im <= 2.95d+57) then
tmp = re ** (-512.0d0)
else if (im <= 4d+222) then
tmp = 0.041666666666666664d0 * (re * (im ** 4.0d0))
else
tmp = 0.5d0 * (im * (sin(re) * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 540000000.0) {
tmp = Math.sin(re);
} else if (im <= 2.95e+57) {
tmp = Math.pow(re, -512.0);
} else if (im <= 4e+222) {
tmp = 0.041666666666666664 * (re * Math.pow(im, 4.0));
} else {
tmp = 0.5 * (im * (Math.sin(re) * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 540000000.0: tmp = math.sin(re) elif im <= 2.95e+57: tmp = math.pow(re, -512.0) elif im <= 4e+222: tmp = 0.041666666666666664 * (re * math.pow(im, 4.0)) else: tmp = 0.5 * (im * (math.sin(re) * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 540000000.0) tmp = sin(re); elseif (im <= 2.95e+57) tmp = re ^ -512.0; elseif (im <= 4e+222) tmp = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))); else tmp = Float64(0.5 * Float64(im * Float64(sin(re) * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 540000000.0) tmp = sin(re); elseif (im <= 2.95e+57) tmp = re ^ -512.0; elseif (im <= 4e+222) tmp = 0.041666666666666664 * (re * (im ^ 4.0)); else tmp = 0.5 * (im * (sin(re) * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 540000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.95e+57], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 4e+222], N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 540000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 2.95 \cdot 10^{+57}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 4 \cdot 10^{+222}:\\
\;\;\;\;0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(\sin re \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 5.4e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 69.6%
if 5.4e8 < im < 2.95000000000000006e57Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 84.6%
Applied egg-rr31.3%
if 2.95000000000000006e57 < im < 4.0000000000000002e222Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 70.0%
Taylor expanded in im around 0 66.9%
Simplified66.9%
Taylor expanded in im around inf 66.9%
if 4.0000000000000002e222 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification69.7%
(FPCore (re im)
:precision binary64
(if (<= im 170000000.0)
(sin re)
(if (<= im 5.7e+56)
(pow re -512.0)
(if (<= im 2.1e+153)
(* 0.041666666666666664 (* re (pow im 4.0)))
(* (* 0.5 (sin re)) (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = sin(re);
} else if (im <= 5.7e+56) {
tmp = pow(re, -512.0);
} else if (im <= 2.1e+153) {
tmp = 0.041666666666666664 * (re * pow(im, 4.0));
} else {
tmp = (0.5 * sin(re)) * (im * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 170000000.0d0) then
tmp = sin(re)
else if (im <= 5.7d+56) then
tmp = re ** (-512.0d0)
else if (im <= 2.1d+153) then
tmp = 0.041666666666666664d0 * (re * (im ** 4.0d0))
else
tmp = (0.5d0 * sin(re)) * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = Math.sin(re);
} else if (im <= 5.7e+56) {
tmp = Math.pow(re, -512.0);
} else if (im <= 2.1e+153) {
tmp = 0.041666666666666664 * (re * Math.pow(im, 4.0));
} else {
tmp = (0.5 * Math.sin(re)) * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 170000000.0: tmp = math.sin(re) elif im <= 5.7e+56: tmp = math.pow(re, -512.0) elif im <= 2.1e+153: tmp = 0.041666666666666664 * (re * math.pow(im, 4.0)) else: tmp = (0.5 * math.sin(re)) * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 170000000.0) tmp = sin(re); elseif (im <= 5.7e+56) tmp = re ^ -512.0; elseif (im <= 2.1e+153) tmp = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 170000000.0) tmp = sin(re); elseif (im <= 5.7e+56) tmp = re ^ -512.0; elseif (im <= 2.1e+153) tmp = 0.041666666666666664 * (re * (im ^ 4.0)); else tmp = (0.5 * sin(re)) * (im * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 170000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 5.7e+56], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 2.1e+153], N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 170000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 5.7 \cdot 10^{+56}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+153}:\\
\;\;\;\;0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 1.7e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 69.6%
if 1.7e8 < im < 5.7000000000000002e56Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 84.6%
Applied egg-rr31.3%
if 5.7000000000000002e56 < im < 2.10000000000000017e153Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 63.6%
Taylor expanded in im around 0 55.1%
Simplified55.1%
Taylor expanded in im around inf 55.1%
if 2.10000000000000017e153 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification71.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))))
(if (<= im 170000000.0)
(* t_0 (+ 2.0 (* im im)))
(if (<= im 1.15e+55)
(pow re -512.0)
(if (<= im 2.1e+153)
(* 0.041666666666666664 (* re (pow im 4.0)))
(* t_0 (* im im)))))))
double code(double re, double im) {
double t_0 = 0.5 * sin(re);
double tmp;
if (im <= 170000000.0) {
tmp = t_0 * (2.0 + (im * im));
} else if (im <= 1.15e+55) {
tmp = pow(re, -512.0);
} else if (im <= 2.1e+153) {
tmp = 0.041666666666666664 * (re * pow(im, 4.0));
} else {
tmp = t_0 * (im * 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 = 0.5d0 * sin(re)
if (im <= 170000000.0d0) then
tmp = t_0 * (2.0d0 + (im * im))
else if (im <= 1.15d+55) then
tmp = re ** (-512.0d0)
else if (im <= 2.1d+153) then
tmp = 0.041666666666666664d0 * (re * (im ** 4.0d0))
else
tmp = t_0 * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.sin(re);
double tmp;
if (im <= 170000000.0) {
tmp = t_0 * (2.0 + (im * im));
} else if (im <= 1.15e+55) {
tmp = Math.pow(re, -512.0);
} else if (im <= 2.1e+153) {
tmp = 0.041666666666666664 * (re * Math.pow(im, 4.0));
} else {
tmp = t_0 * (im * im);
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.sin(re) tmp = 0 if im <= 170000000.0: tmp = t_0 * (2.0 + (im * im)) elif im <= 1.15e+55: tmp = math.pow(re, -512.0) elif im <= 2.1e+153: tmp = 0.041666666666666664 * (re * math.pow(im, 4.0)) else: tmp = t_0 * (im * im) return tmp
function code(re, im) t_0 = Float64(0.5 * sin(re)) tmp = 0.0 if (im <= 170000000.0) tmp = Float64(t_0 * Float64(2.0 + Float64(im * im))); elseif (im <= 1.15e+55) tmp = re ^ -512.0; elseif (im <= 2.1e+153) tmp = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))); else tmp = Float64(t_0 * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * sin(re); tmp = 0.0; if (im <= 170000000.0) tmp = t_0 * (2.0 + (im * im)); elseif (im <= 1.15e+55) tmp = re ^ -512.0; elseif (im <= 2.1e+153) tmp = 0.041666666666666664 * (re * (im ^ 4.0)); else tmp = t_0 * (im * im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 170000000.0], N[(t$95$0 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+55], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 2.1e+153], N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
\mathbf{if}\;im \leq 170000000:\\
\;\;\;\;t_0 \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+55}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+153}:\\
\;\;\;\;0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 1.7e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.2%
Simplified84.2%
if 1.7e8 < im < 1.14999999999999994e55Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 84.6%
Applied egg-rr31.3%
if 1.14999999999999994e55 < im < 2.10000000000000017e153Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 63.6%
Taylor expanded in im around 0 55.1%
Simplified55.1%
Taylor expanded in im around inf 55.1%
if 2.10000000000000017e153 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification82.7%
(FPCore (re im)
:precision binary64
(if (<= im 170000000.0)
(sin re)
(if (<= im 9.8e+58)
(pow re -512.0)
(* 0.041666666666666664 (* re (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = sin(re);
} else if (im <= 9.8e+58) {
tmp = pow(re, -512.0);
} else {
tmp = 0.041666666666666664 * (re * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 170000000.0d0) then
tmp = sin(re)
else if (im <= 9.8d+58) then
tmp = re ** (-512.0d0)
else
tmp = 0.041666666666666664d0 * (re * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = Math.sin(re);
} else if (im <= 9.8e+58) {
tmp = Math.pow(re, -512.0);
} else {
tmp = 0.041666666666666664 * (re * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 170000000.0: tmp = math.sin(re) elif im <= 9.8e+58: tmp = math.pow(re, -512.0) else: tmp = 0.041666666666666664 * (re * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 170000000.0) tmp = sin(re); elseif (im <= 9.8e+58) tmp = re ^ -512.0; else tmp = Float64(0.041666666666666664 * Float64(re * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 170000000.0) tmp = sin(re); elseif (im <= 9.8e+58) tmp = re ^ -512.0; else tmp = 0.041666666666666664 * (re * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 170000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 9.8e+58], N[Power[re, -512.0], $MachinePrecision], N[(0.041666666666666664 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 170000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 9.8 \cdot 10^{+58}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 1.7e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 69.6%
if 1.7e8 < im < 9.80000000000000037e58Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 84.6%
Applied egg-rr31.3%
if 9.80000000000000037e58 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 68.0%
Taylor expanded in im around 0 66.1%
Simplified66.1%
Taylor expanded in im around inf 66.1%
Final simplification67.0%
(FPCore (re im)
:precision binary64
(if (<= im 760.0)
(sin re)
(if (<= im 6.5e+148)
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
(* (+ 2.0 (* im im)) (* 0.5 re)))))
double code(double re, double im) {
double tmp;
if (im <= 760.0) {
tmp = sin(re);
} else if (im <= 6.5e+148) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else {
tmp = (2.0 + (im * im)) * (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 <= 760.0d0) then
tmp = sin(re)
else if (im <= 6.5d+148) then
tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
else
tmp = (2.0d0 + (im * im)) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 760.0) {
tmp = Math.sin(re);
} else if (im <= 6.5e+148) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else {
tmp = (2.0 + (im * im)) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 760.0: tmp = math.sin(re) elif im <= 6.5e+148: tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) else: tmp = (2.0 + (im * im)) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 760.0) tmp = sin(re); elseif (im <= 6.5e+148) tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))); else tmp = Float64(Float64(2.0 + Float64(im * im)) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 760.0) tmp = sin(re); elseif (im <= 6.5e+148) tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); else tmp = (2.0 + (im * im)) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 760.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 6.5e+148], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 760:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+148}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\left(2 + im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < 760Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 70.0%
if 760 < im < 6.49999999999999947e148Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr10.2%
Taylor expanded in re around 0 29.7%
associate-*r/29.7%
metadata-eval29.7%
unpow229.7%
*-commutative29.7%
unpow229.7%
Simplified29.7%
if 6.49999999999999947e148 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in re around 0 69.2%
Final simplification65.9%
(FPCore (re im)
:precision binary64
(if (<= im 400.0)
re
(if (<= im 2.25e+105)
(+ 0.08333333333333333 (* re (* re 0.016666666666666666)))
(* (* im im) (* 0.5 re)))))
double code(double re, double im) {
double tmp;
if (im <= 400.0) {
tmp = re;
} else if (im <= 2.25e+105) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else {
tmp = (im * im) * (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 <= 400.0d0) then
tmp = re
else if (im <= 2.25d+105) then
tmp = 0.08333333333333333d0 + (re * (re * 0.016666666666666666d0))
else
tmp = (im * im) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 400.0) {
tmp = re;
} else if (im <= 2.25e+105) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else {
tmp = (im * im) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 400.0: tmp = re elif im <= 2.25e+105: tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)) else: tmp = (im * im) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 400.0) tmp = re; elseif (im <= 2.25e+105) tmp = Float64(0.08333333333333333 + Float64(re * Float64(re * 0.016666666666666666))); else tmp = Float64(Float64(im * im) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 400.0) tmp = re; elseif (im <= 2.25e+105) tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)); else tmp = (im * im) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 400.0], re, If[LessEqual[im, 2.25e+105], N[(0.08333333333333333 + N[(re * N[(re * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 400:\\
\;\;\;\;re\\
\mathbf{elif}\;im \leq 2.25 \cdot 10^{+105}:\\
\;\;\;\;0.08333333333333333 + re \cdot \left(re \cdot 0.016666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < 400Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 70.0%
Taylor expanded in re around 0 38.7%
if 400 < im < 2.2500000000000001e105Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr12.5%
Taylor expanded in re around 0 36.8%
associate-*r/36.8%
metadata-eval36.8%
unpow236.8%
*-commutative36.8%
unpow236.8%
Simplified36.8%
Taylor expanded in re around inf 26.5%
unpow226.5%
*-commutative26.5%
associate-*r*26.5%
Simplified26.5%
if 2.2500000000000001e105 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 89.3%
Simplified89.3%
Taylor expanded in im around inf 89.3%
associate-*r*89.3%
*-commutative89.3%
unpow289.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in re around 0 63.8%
Final simplification42.0%
(FPCore (re im) :precision binary64 (if (<= re -3.45e+159) (+ 0.08333333333333333 (* re (* re 0.016666666666666666))) (* (+ 2.0 (* im im)) (* 0.5 re))))
double code(double re, double im) {
double tmp;
if (re <= -3.45e+159) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else {
tmp = (2.0 + (im * im)) * (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 (re <= (-3.45d+159)) then
tmp = 0.08333333333333333d0 + (re * (re * 0.016666666666666666d0))
else
tmp = (2.0d0 + (im * im)) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -3.45e+159) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else {
tmp = (2.0 + (im * im)) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3.45e+159: tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)) else: tmp = (2.0 + (im * im)) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if (re <= -3.45e+159) tmp = Float64(0.08333333333333333 + Float64(re * Float64(re * 0.016666666666666666))); else tmp = Float64(Float64(2.0 + Float64(im * im)) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -3.45e+159) tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)); else tmp = (2.0 + (im * im)) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3.45e+159], N[(0.08333333333333333 + N[(re * N[(re * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -3.45 \cdot 10^{+159}:\\
\;\;\;\;0.08333333333333333 + re \cdot \left(re \cdot 0.016666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\left(2 + im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if re < -3.4500000000000001e159Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Applied egg-rr7.9%
Taylor expanded in re around 0 33.5%
associate-*r/33.5%
metadata-eval33.5%
unpow233.5%
*-commutative33.5%
unpow233.5%
Simplified33.5%
Taylor expanded in re around inf 33.5%
unpow233.5%
*-commutative33.5%
associate-*r*33.5%
Simplified33.5%
if -3.4500000000000001e159 < re Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 79.6%
Simplified79.6%
Taylor expanded in re around 0 56.3%
Final simplification53.6%
(FPCore (re im) :precision binary64 (if (<= im 170000000.0) re (* (* im im) (* 0.5 re))))
double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = re;
} else {
tmp = (im * im) * (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 <= 170000000.0d0) then
tmp = re
else
tmp = (im * im) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 170000000.0) {
tmp = re;
} else {
tmp = (im * im) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 170000000.0: tmp = re else: tmp = (im * im) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 170000000.0) tmp = re; else tmp = Float64(Float64(im * im) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 170000000.0) tmp = re; else tmp = (im * im) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 170000000.0], re, N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 170000000:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < 1.7e8Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 69.6%
Taylor expanded in re around 0 38.5%
if 1.7e8 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 63.4%
Simplified63.4%
Taylor expanded in im around inf 63.4%
associate-*r*63.4%
*-commutative63.4%
unpow263.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in re around 0 45.4%
Final simplification40.2%
(FPCore (re im) :precision binary64 (if (<= im 980.0) re (/ 0.25 (* re re))))
double code(double re, double im) {
double tmp;
if (im <= 980.0) {
tmp = re;
} else {
tmp = 0.25 / (re * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 980.0d0) then
tmp = re
else
tmp = 0.25d0 / (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 980.0) {
tmp = re;
} else {
tmp = 0.25 / (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 980.0: tmp = re else: tmp = 0.25 / (re * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 980.0) tmp = re; else tmp = Float64(0.25 / Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 980.0) tmp = re; else tmp = 0.25 / (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 980.0], re, N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 980:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\end{array}
\end{array}
if im < 980Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 70.0%
Taylor expanded in re around 0 38.7%
if 980 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr12.7%
Taylor expanded in re around 0 12.5%
unpow212.5%
Simplified12.5%
Final simplification32.1%
(FPCore (re im) :precision binary64 re)
double code(double re, double im) {
return re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re
end function
public static double code(double re, double im) {
return re;
}
def code(re, im): return re
function code(re, im) return re end
function tmp = code(re, im) tmp = re; end
code[re_, im_] := re
\begin{array}{l}
\\
re
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 53.2%
Taylor expanded in re around 0 29.6%
Final simplification29.6%
herbie shell --seed 2023188
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))