
(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 14 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(0.5 * Float64(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[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(\sin re \cdot \left(e^{-im} + e^{im}\right)\right)
\end{array}
Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im) :precision binary64 (if (<= im 0.00058) (* 0.5 (* (sin re) 2.0)) (* 0.5 (* re (+ (exp (- im)) (exp im))))))
double code(double re, double im) {
double tmp;
if (im <= 0.00058) {
tmp = 0.5 * (sin(re) * 2.0);
} else {
tmp = 0.5 * (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 (im <= 0.00058d0) then
tmp = 0.5d0 * (sin(re) * 2.0d0)
else
tmp = 0.5d0 * (re * (exp(-im) + exp(im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.00058) {
tmp = 0.5 * (Math.sin(re) * 2.0);
} else {
tmp = 0.5 * (re * (Math.exp(-im) + Math.exp(im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.00058: tmp = 0.5 * (math.sin(re) * 2.0) else: tmp = 0.5 * (re * (math.exp(-im) + math.exp(im))) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.00058) tmp = Float64(0.5 * Float64(sin(re) * 2.0)); else tmp = Float64(0.5 * Float64(re * Float64(exp(Float64(-im)) + exp(im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.00058) tmp = 0.5 * (sin(re) * 2.0); else tmp = 0.5 * (re * (exp(-im) + exp(im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.00058], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.00058:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(e^{-im} + e^{im}\right)\right)\\
\end{array}
\end{array}
if im < 5.8e-4Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around 0 69.7%
Simplified69.7%
if 5.8e-4 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 76.0%
Final simplification71.5%
(FPCore (re im)
:precision binary64
(if (<= im 720.0)
(* 0.5 (* (sin re) 2.0))
(if (<= im 8.5e+68)
(* 0.5 (pow re -512.0))
(* 0.5 (+ (* 0.08333333333333333 (* re (pow im 4.0))) (* re 2.0))))))
double code(double re, double im) {
double tmp;
if (im <= 720.0) {
tmp = 0.5 * (sin(re) * 2.0);
} else if (im <= 8.5e+68) {
tmp = 0.5 * pow(re, -512.0);
} else {
tmp = 0.5 * ((0.08333333333333333 * (re * pow(im, 4.0))) + (re * 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 <= 720.0d0) then
tmp = 0.5d0 * (sin(re) * 2.0d0)
else if (im <= 8.5d+68) then
tmp = 0.5d0 * (re ** (-512.0d0))
else
tmp = 0.5d0 * ((0.08333333333333333d0 * (re * (im ** 4.0d0))) + (re * 2.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 720.0) {
tmp = 0.5 * (Math.sin(re) * 2.0);
} else if (im <= 8.5e+68) {
tmp = 0.5 * Math.pow(re, -512.0);
} else {
tmp = 0.5 * ((0.08333333333333333 * (re * Math.pow(im, 4.0))) + (re * 2.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 720.0: tmp = 0.5 * (math.sin(re) * 2.0) elif im <= 8.5e+68: tmp = 0.5 * math.pow(re, -512.0) else: tmp = 0.5 * ((0.08333333333333333 * (re * math.pow(im, 4.0))) + (re * 2.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 720.0) tmp = Float64(0.5 * Float64(sin(re) * 2.0)); elseif (im <= 8.5e+68) tmp = Float64(0.5 * (re ^ -512.0)); else tmp = Float64(0.5 * Float64(Float64(0.08333333333333333 * Float64(re * (im ^ 4.0))) + Float64(re * 2.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 720.0) tmp = 0.5 * (sin(re) * 2.0); elseif (im <= 8.5e+68) tmp = 0.5 * (re ^ -512.0); else tmp = 0.5 * ((0.08333333333333333 * (re * (im ^ 4.0))) + (re * 2.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 720.0], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.5e+68], N[(0.5 * N[Power[re, -512.0], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(0.08333333333333333 * N[(re * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(re * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 720:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot 2\right)\\
\mathbf{elif}\;im \leq 8.5 \cdot 10^{+68}:\\
\;\;\;\;0.5 \cdot {re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(0.08333333333333333 \cdot \left(re \cdot {im}^{4}\right) + re \cdot 2\right)\\
\end{array}
\end{array}
if im < 720Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around 0 69.5%
Simplified69.5%
if 720 < im < 8.49999999999999966e68Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 75.0%
Applied egg-rr56.7%
if 8.49999999999999966e68 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 75.9%
Taylor expanded in im around 0 72.5%
+-commutative72.5%
associate-+l+72.5%
*-commutative72.5%
distribute-lft-in72.5%
+-commutative72.5%
unpow272.5%
fma-def72.5%
Simplified72.5%
Taylor expanded in im around 0 72.5%
Final simplification69.4%
(FPCore (re im)
:precision binary64
(if (<= im 920.0)
(* 0.5 (* (sin re) 2.0))
(if (<= im 2.9e+69)
(* 0.5 (pow re -512.0))
(* 0.5 (* re (* 0.08333333333333333 (pow im 4.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 920.0) {
tmp = 0.5 * (sin(re) * 2.0);
} else if (im <= 2.9e+69) {
tmp = 0.5 * pow(re, -512.0);
} else {
tmp = 0.5 * (re * (0.08333333333333333 * 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 <= 920.0d0) then
tmp = 0.5d0 * (sin(re) * 2.0d0)
else if (im <= 2.9d+69) then
tmp = 0.5d0 * (re ** (-512.0d0))
else
tmp = 0.5d0 * (re * (0.08333333333333333d0 * (im ** 4.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 920.0) {
tmp = 0.5 * (Math.sin(re) * 2.0);
} else if (im <= 2.9e+69) {
tmp = 0.5 * Math.pow(re, -512.0);
} else {
tmp = 0.5 * (re * (0.08333333333333333 * Math.pow(im, 4.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 920.0: tmp = 0.5 * (math.sin(re) * 2.0) elif im <= 2.9e+69: tmp = 0.5 * math.pow(re, -512.0) else: tmp = 0.5 * (re * (0.08333333333333333 * math.pow(im, 4.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 920.0) tmp = Float64(0.5 * Float64(sin(re) * 2.0)); elseif (im <= 2.9e+69) tmp = Float64(0.5 * (re ^ -512.0)); else tmp = Float64(0.5 * Float64(re * Float64(0.08333333333333333 * (im ^ 4.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 920.0) tmp = 0.5 * (sin(re) * 2.0); elseif (im <= 2.9e+69) tmp = 0.5 * (re ^ -512.0); else tmp = 0.5 * (re * (0.08333333333333333 * (im ^ 4.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 920.0], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.9e+69], N[(0.5 * N[Power[re, -512.0], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(0.08333333333333333 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 920:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot 2\right)\\
\mathbf{elif}\;im \leq 2.9 \cdot 10^{+69}:\\
\;\;\;\;0.5 \cdot {re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(0.08333333333333333 \cdot {im}^{4}\right)\right)\\
\end{array}
\end{array}
if im < 920Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around 0 69.5%
Simplified69.5%
if 920 < im < 2.8999999999999998e69Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 75.0%
Applied egg-rr56.7%
if 2.8999999999999998e69 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 75.9%
Taylor expanded in im around 0 72.5%
+-commutative72.5%
associate-+l+72.5%
*-commutative72.5%
distribute-lft-in72.5%
+-commutative72.5%
unpow272.5%
fma-def72.5%
Simplified72.5%
Taylor expanded in im around inf 72.5%
associate-*r*72.5%
*-commutative72.5%
associate-*r*72.5%
Simplified72.5%
Final simplification69.4%
(FPCore (re im) :precision binary64 (if (or (<= im 800.0) (not (<= im 4.8e+95))) (* 0.5 (+ (* re 2.0) (* re (* im im)))) (* 0.5 (pow re -512.0))))
double code(double re, double im) {
double tmp;
if ((im <= 800.0) || !(im <= 4.8e+95)) {
tmp = 0.5 * ((re * 2.0) + (re * (im * im)));
} else {
tmp = 0.5 * pow(re, -512.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= 800.0d0) .or. (.not. (im <= 4.8d+95))) then
tmp = 0.5d0 * ((re * 2.0d0) + (re * (im * im)))
else
tmp = 0.5d0 * (re ** (-512.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 800.0) || !(im <= 4.8e+95)) {
tmp = 0.5 * ((re * 2.0) + (re * (im * im)));
} else {
tmp = 0.5 * Math.pow(re, -512.0);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 800.0) or not (im <= 4.8e+95): tmp = 0.5 * ((re * 2.0) + (re * (im * im))) else: tmp = 0.5 * math.pow(re, -512.0) return tmp
function code(re, im) tmp = 0.0 if ((im <= 800.0) || !(im <= 4.8e+95)) tmp = Float64(0.5 * Float64(Float64(re * 2.0) + Float64(re * Float64(im * im)))); else tmp = Float64(0.5 * (re ^ -512.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 800.0) || ~((im <= 4.8e+95))) tmp = 0.5 * ((re * 2.0) + (re * (im * im))); else tmp = 0.5 * (re ^ -512.0); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 800.0], N[Not[LessEqual[im, 4.8e+95]], $MachinePrecision]], N[(0.5 * N[(N[(re * 2.0), $MachinePrecision] + N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[re, -512.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 800 \lor \neg \left(im \leq 4.8 \cdot 10^{+95}\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot 2 + re \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {re}^{-512}\\
\end{array}
\end{array}
if im < 800 or 4.8000000000000001e95 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 59.5%
Taylor expanded in im around 0 48.8%
*-commutative48.8%
distribute-rgt-in48.8%
unpow248.8%
fma-def48.8%
Simplified48.8%
fma-udef48.8%
distribute-rgt-in48.8%
Applied egg-rr48.8%
if 800 < im < 4.8000000000000001e95Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 83.3%
Applied egg-rr50.4%
Final simplification48.9%
(FPCore (re im)
:precision binary64
(if (<= im 950.0)
(* 0.5 (* (sin re) 2.0))
(if (<= im 1.95e+95)
(* 0.5 (pow re -512.0))
(* 0.5 (+ (* re 2.0) (* re (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= 950.0) {
tmp = 0.5 * (sin(re) * 2.0);
} else if (im <= 1.95e+95) {
tmp = 0.5 * pow(re, -512.0);
} else {
tmp = 0.5 * ((re * 2.0) + (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 <= 950.0d0) then
tmp = 0.5d0 * (sin(re) * 2.0d0)
else if (im <= 1.95d+95) then
tmp = 0.5d0 * (re ** (-512.0d0))
else
tmp = 0.5d0 * ((re * 2.0d0) + (re * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 950.0) {
tmp = 0.5 * (Math.sin(re) * 2.0);
} else if (im <= 1.95e+95) {
tmp = 0.5 * Math.pow(re, -512.0);
} else {
tmp = 0.5 * ((re * 2.0) + (re * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 950.0: tmp = 0.5 * (math.sin(re) * 2.0) elif im <= 1.95e+95: tmp = 0.5 * math.pow(re, -512.0) else: tmp = 0.5 * ((re * 2.0) + (re * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= 950.0) tmp = Float64(0.5 * Float64(sin(re) * 2.0)); elseif (im <= 1.95e+95) tmp = Float64(0.5 * (re ^ -512.0)); else tmp = Float64(0.5 * Float64(Float64(re * 2.0) + Float64(re * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 950.0) tmp = 0.5 * (sin(re) * 2.0); elseif (im <= 1.95e+95) tmp = 0.5 * (re ^ -512.0); else tmp = 0.5 * ((re * 2.0) + (re * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 950.0], N[(0.5 * N[(N[Sin[re], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.95e+95], N[(0.5 * N[Power[re, -512.0], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(re * 2.0), $MachinePrecision] + N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 950:\\
\;\;\;\;0.5 \cdot \left(\sin re \cdot 2\right)\\
\mathbf{elif}\;im \leq 1.95 \cdot 10^{+95}:\\
\;\;\;\;0.5 \cdot {re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot 2 + re \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 950Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around 0 69.5%
Simplified69.5%
if 950 < im < 1.9499999999999999e95Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 83.3%
Applied egg-rr50.4%
if 1.9499999999999999e95 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 72.0%
Taylor expanded in im around 0 60.5%
*-commutative60.5%
distribute-rgt-in60.5%
unpow260.5%
fma-def60.5%
Simplified60.5%
fma-udef60.5%
distribute-rgt-in60.5%
Applied egg-rr60.5%
Final simplification66.0%
(FPCore (re im)
:precision binary64
(if (or (<= im 5.6e+19) (not (<= im 1.55e+149)))
(* 0.5 (+ (* re 2.0) (* re (* im im))))
(*
0.5
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))))
double code(double re, double im) {
double tmp;
if ((im <= 5.6e+19) || !(im <= 1.55e+149)) {
tmp = 0.5 * ((re * 2.0) + (re * (im * im)));
} else {
tmp = 0.5 * (0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= 5.6d+19) .or. (.not. (im <= 1.55d+149))) then
tmp = 0.5d0 * ((re * 2.0d0) + (re * (im * im)))
else
tmp = 0.5d0 * (0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 5.6e+19) || !(im <= 1.55e+149)) {
tmp = 0.5 * ((re * 2.0) + (re * (im * im)));
} else {
tmp = 0.5 * (0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 5.6e+19) or not (im <= 1.55e+149): tmp = 0.5 * ((re * 2.0) + (re * (im * im))) else: tmp = 0.5 * (0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))) return tmp
function code(re, im) tmp = 0.0 if ((im <= 5.6e+19) || !(im <= 1.55e+149)) tmp = Float64(0.5 * Float64(Float64(re * 2.0) + Float64(re * Float64(im * im)))); else tmp = Float64(0.5 * Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 5.6e+19) || ~((im <= 1.55e+149))) tmp = 0.5 * ((re * 2.0) + (re * (im * im))); else tmp = 0.5 * (0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 5.6e+19], N[Not[LessEqual[im, 1.55e+149]], $MachinePrecision]], N[(0.5 * N[(N[(re * 2.0), $MachinePrecision] + N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5.6 \cdot 10^{+19} \lor \neg \left(im \leq 1.55 \cdot 10^{+149}\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot 2 + re \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\right)\\
\end{array}
\end{array}
if im < 5.6e19 or 1.54999999999999993e149 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 59.9%
Taylor expanded in im around 0 50.7%
*-commutative50.7%
distribute-rgt-in50.7%
unpow250.7%
fma-def50.7%
Simplified50.7%
fma-udef50.7%
distribute-rgt-in50.7%
Applied egg-rr50.7%
if 5.6e19 < im < 1.54999999999999993e149Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr25.9%
Taylor expanded in re around 0 36.5%
associate-*r/36.5%
metadata-eval36.5%
unpow236.5%
unpow236.5%
Simplified36.5%
Final simplification48.6%
(FPCore (re im) :precision binary64 (if (or (<= im 5.6e+19) (not (<= im 1.15e+69))) (* 0.5 (+ (* re 2.0) (* re (* im im)))) (* 0.5 (+ 0.08333333333333333 (/ 0.25 (* re re))))))
double code(double re, double im) {
double tmp;
if ((im <= 5.6e+19) || !(im <= 1.15e+69)) {
tmp = 0.5 * ((re * 2.0) + (re * (im * im)));
} else {
tmp = 0.5 * (0.08333333333333333 + (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 <= 5.6d+19) .or. (.not. (im <= 1.15d+69))) then
tmp = 0.5d0 * ((re * 2.0d0) + (re * (im * im)))
else
tmp = 0.5d0 * (0.08333333333333333d0 + (0.25d0 / (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 5.6e+19) || !(im <= 1.15e+69)) {
tmp = 0.5 * ((re * 2.0) + (re * (im * im)));
} else {
tmp = 0.5 * (0.08333333333333333 + (0.25 / (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 5.6e+19) or not (im <= 1.15e+69): tmp = 0.5 * ((re * 2.0) + (re * (im * im))) else: tmp = 0.5 * (0.08333333333333333 + (0.25 / (re * re))) return tmp
function code(re, im) tmp = 0.0 if ((im <= 5.6e+19) || !(im <= 1.15e+69)) tmp = Float64(0.5 * Float64(Float64(re * 2.0) + Float64(re * Float64(im * im)))); else tmp = Float64(0.5 * Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 5.6e+19) || ~((im <= 1.15e+69))) tmp = 0.5 * ((re * 2.0) + (re * (im * im))); else tmp = 0.5 * (0.08333333333333333 + (0.25 / (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 5.6e+19], N[Not[LessEqual[im, 1.15e+69]], $MachinePrecision]], N[(0.5 * N[(N[(re * 2.0), $MachinePrecision] + N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5.6 \cdot 10^{+19} \lor \neg \left(im \leq 1.15 \cdot 10^{+69}\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot 2 + re \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(0.08333333333333333 + \frac{0.25}{re \cdot re}\right)\\
\end{array}
\end{array}
if im < 5.6e19 or 1.15000000000000008e69 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 60.8%
Taylor expanded in im around 0 47.3%
*-commutative47.3%
distribute-rgt-in47.3%
unpow247.3%
fma-def47.3%
Simplified47.3%
fma-udef47.3%
distribute-rgt-in47.3%
Applied egg-rr47.3%
if 5.6e19 < im < 1.15000000000000008e69Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr44.6%
Taylor expanded in re around 0 44.6%
associate-*r/44.6%
metadata-eval44.6%
unpow244.6%
Simplified44.6%
Final simplification47.1%
(FPCore (re im)
:precision binary64
(if (<= im 5.6e+19)
(* 0.5 (+ re re))
(if (<= im 8.5e+69)
(* 0.5 (+ 0.08333333333333333 (/ 0.25 (* re re))))
(* 0.5 (* im (* re im))))))
double code(double re, double im) {
double tmp;
if (im <= 5.6e+19) {
tmp = 0.5 * (re + re);
} else if (im <= 8.5e+69) {
tmp = 0.5 * (0.08333333333333333 + (0.25 / (re * re)));
} else {
tmp = 0.5 * (im * (re * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 5.6d+19) then
tmp = 0.5d0 * (re + re)
else if (im <= 8.5d+69) then
tmp = 0.5d0 * (0.08333333333333333d0 + (0.25d0 / (re * re)))
else
tmp = 0.5d0 * (im * (re * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 5.6e+19) {
tmp = 0.5 * (re + re);
} else if (im <= 8.5e+69) {
tmp = 0.5 * (0.08333333333333333 + (0.25 / (re * re)));
} else {
tmp = 0.5 * (im * (re * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 5.6e+19: tmp = 0.5 * (re + re) elif im <= 8.5e+69: tmp = 0.5 * (0.08333333333333333 + (0.25 / (re * re))) else: tmp = 0.5 * (im * (re * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 5.6e+19) tmp = Float64(0.5 * Float64(re + re)); elseif (im <= 8.5e+69) tmp = Float64(0.5 * Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re)))); else tmp = Float64(0.5 * Float64(im * Float64(re * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 5.6e+19) tmp = 0.5 * (re + re); elseif (im <= 8.5e+69) tmp = 0.5 * (0.08333333333333333 + (0.25 / (re * re))); else tmp = 0.5 * (im * (re * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 5.6e+19], N[(0.5 * N[(re + re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.5e+69], N[(0.5 * N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 5.6 \cdot 10^{+19}:\\
\;\;\;\;0.5 \cdot \left(re + re\right)\\
\mathbf{elif}\;im \leq 8.5 \cdot 10^{+69}:\\
\;\;\;\;0.5 \cdot \left(0.08333333333333333 + \frac{0.25}{re \cdot re}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 5.6e19Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 56.0%
Taylor expanded in im around 0 32.7%
count-232.7%
Simplified32.7%
if 5.6e19 < im < 8.5000000000000002e69Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr44.6%
Taylor expanded in re around 0 44.6%
associate-*r/44.6%
metadata-eval44.6%
unpow244.6%
Simplified44.6%
if 8.5000000000000002e69 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 75.9%
Taylor expanded in im around 0 54.3%
*-commutative54.3%
distribute-rgt-in54.3%
unpow254.3%
fma-def54.3%
Simplified54.3%
Taylor expanded in im around inf 54.3%
unpow254.3%
*-commutative54.3%
associate-*l*41.4%
Simplified41.4%
Final simplification35.3%
(FPCore (re im) :precision binary64 (if (<= im 4500000.0) (* 0.5 (+ re re)) (if (<= im 7.2e+68) (* 0.5 (/ 0.25 (* re re))) (* 0.5 (* im (* re im))))))
double code(double re, double im) {
double tmp;
if (im <= 4500000.0) {
tmp = 0.5 * (re + re);
} else if (im <= 7.2e+68) {
tmp = 0.5 * (0.25 / (re * re));
} else {
tmp = 0.5 * (im * (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 <= 4500000.0d0) then
tmp = 0.5d0 * (re + re)
else if (im <= 7.2d+68) then
tmp = 0.5d0 * (0.25d0 / (re * re))
else
tmp = 0.5d0 * (im * (re * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4500000.0) {
tmp = 0.5 * (re + re);
} else if (im <= 7.2e+68) {
tmp = 0.5 * (0.25 / (re * re));
} else {
tmp = 0.5 * (im * (re * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4500000.0: tmp = 0.5 * (re + re) elif im <= 7.2e+68: tmp = 0.5 * (0.25 / (re * re)) else: tmp = 0.5 * (im * (re * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 4500000.0) tmp = Float64(0.5 * Float64(re + re)); elseif (im <= 7.2e+68) tmp = Float64(0.5 * Float64(0.25 / Float64(re * re))); else tmp = Float64(0.5 * Float64(im * Float64(re * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4500000.0) tmp = 0.5 * (re + re); elseif (im <= 7.2e+68) tmp = 0.5 * (0.25 / (re * re)); else tmp = 0.5 * (im * (re * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4500000.0], N[(0.5 * N[(re + re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.2e+68], N[(0.5 * N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4500000:\\
\;\;\;\;0.5 \cdot \left(re + re\right)\\
\mathbf{elif}\;im \leq 7.2 \cdot 10^{+68}:\\
\;\;\;\;0.5 \cdot \frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 4.5e6Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 56.3%
Taylor expanded in im around 0 32.9%
count-232.9%
Simplified32.9%
if 4.5e6 < im < 7.1999999999999998e68Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr41.6%
Taylor expanded in re around 0 41.6%
unpow241.6%
Simplified41.6%
if 7.1999999999999998e68 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 75.9%
Taylor expanded in im around 0 54.3%
*-commutative54.3%
distribute-rgt-in54.3%
unpow254.3%
fma-def54.3%
Simplified54.3%
Taylor expanded in im around inf 54.3%
unpow254.3%
*-commutative54.3%
associate-*l*41.4%
Simplified41.4%
Final simplification35.3%
(FPCore (re im) :precision binary64 (if (<= im 1.4) (* 0.5 (+ re re)) (* 0.5 (* im (* re im)))))
double code(double re, double im) {
double tmp;
if (im <= 1.4) {
tmp = 0.5 * (re + re);
} else {
tmp = 0.5 * (im * (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 <= 1.4d0) then
tmp = 0.5d0 * (re + re)
else
tmp = 0.5d0 * (im * (re * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.4) {
tmp = 0.5 * (re + re);
} else {
tmp = 0.5 * (im * (re * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.4: tmp = 0.5 * (re + re) else: tmp = 0.5 * (im * (re * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.4) tmp = Float64(0.5 * Float64(re + re)); else tmp = Float64(0.5 * Float64(im * Float64(re * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.4) tmp = 0.5 * (re + re); else tmp = 0.5 * (im * (re * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.4], N[(0.5 * N[(re + re), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.4:\\
\;\;\;\;0.5 \cdot \left(re + re\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 1.3999999999999999Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 56.1%
Taylor expanded in im around 0 33.0%
count-233.0%
Simplified33.0%
if 1.3999999999999999 < im Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 75.7%
Taylor expanded in im around 0 44.3%
*-commutative44.3%
distribute-rgt-in44.3%
unpow244.3%
fma-def44.3%
Simplified44.3%
Taylor expanded in im around inf 44.3%
unpow244.3%
*-commutative44.3%
associate-*l*34.2%
Simplified34.2%
Final simplification33.4%
(FPCore (re im) :precision binary64 (* 0.5 (+ re re)))
double code(double re, double im) {
return 0.5 * (re + re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * (re + re)
end function
public static double code(double re, double im) {
return 0.5 * (re + re);
}
def code(re, im): return 0.5 * (re + re)
function code(re, im) return Float64(0.5 * Float64(re + re)) end
function tmp = code(re, im) tmp = 0.5 * (re + re); end
code[re_, im_] := N[(0.5 * N[(re + re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(re + re\right)
\end{array}
Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 61.8%
Taylor expanded in im around 0 24.2%
count-224.2%
Simplified24.2%
Final simplification24.2%
(FPCore (re im) :precision binary64 (* 0.5 re))
double code(double re, double im) {
return 0.5 * re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * re
end function
public static double code(double re, double im) {
return 0.5 * re;
}
def code(re, im): return 0.5 * re
function code(re, im) return Float64(0.5 * re) end
function tmp = code(re, im) tmp = 0.5 * re; end
code[re_, im_] := N[(0.5 * re), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot re
\end{array}
Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 61.8%
Applied egg-rr4.5%
unpow14.5%
sqr-pow3.1%
fabs-sqr3.1%
sqr-pow6.4%
unpow16.4%
Simplified6.4%
Final simplification6.4%
(FPCore (re im) :precision binary64 0.041666666666666664)
double code(double re, double im) {
return 0.041666666666666664;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.041666666666666664d0
end function
public static double code(double re, double im) {
return 0.041666666666666664;
}
def code(re, im): return 0.041666666666666664
function code(re, im) return 0.041666666666666664 end
function tmp = code(re, im) tmp = 0.041666666666666664; end
code[re_, im_] := 0.041666666666666664
\begin{array}{l}
\\
0.041666666666666664
\end{array}
Initial program 100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
sin-neg100.0%
*-commutative100.0%
*-commutative100.0%
sin-neg100.0%
cancel-sign-sub100.0%
+-commutative100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr12.4%
Taylor expanded in re around 0 12.2%
associate-*r/12.2%
metadata-eval12.2%
unpow212.2%
Simplified12.2%
Taylor expanded in re around inf 4.2%
Final simplification4.2%
herbie shell --seed 2023264
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))