
(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 15 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%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im) :precision binary64 (if (or (<= im 0.06) (not (<= im 1.35e+154))) (* (* 0.5 (sin re)) (+ (* im im) 2.0)) (* (+ (exp (- im)) (exp im)) (* 0.5 re))))
double code(double re, double im) {
double tmp;
if ((im <= 0.06) || !(im <= 1.35e+154)) {
tmp = (0.5 * sin(re)) * ((im * im) + 2.0);
} else {
tmp = (exp(-im) + exp(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 <= 0.06d0) .or. (.not. (im <= 1.35d+154))) then
tmp = (0.5d0 * sin(re)) * ((im * im) + 2.0d0)
else
tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 0.06) || !(im <= 1.35e+154)) {
tmp = (0.5 * Math.sin(re)) * ((im * im) + 2.0);
} else {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 0.06) or not (im <= 1.35e+154): tmp = (0.5 * math.sin(re)) * ((im * im) + 2.0) else: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if ((im <= 0.06) || !(im <= 1.35e+154)) tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(im * im) + 2.0)); else tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 0.06) || ~((im <= 1.35e+154))) tmp = (0.5 * sin(re)) * ((im * im) + 2.0); else tmp = (exp(-im) + exp(im)) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 0.06], N[Not[LessEqual[im, 1.35e+154]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.06 \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im + 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < 0.059999999999999998 or 1.35000000000000003e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.8%
Simplified84.8%
if 0.059999999999999998 < im < 1.35000000000000003e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 74.3%
Simplified74.3%
Final simplification83.4%
(FPCore (re im)
:precision binary64
(if (<= im 0.036)
(+ (sin re) (* (sin re) (* 0.5 (* im im))))
(if (<= im 1.35e+154)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(* (* 0.5 (sin re)) (+ (* im im) 2.0)))))
double code(double re, double im) {
double tmp;
if (im <= 0.036) {
tmp = sin(re) + (sin(re) * (0.5 * (im * im)));
} else if (im <= 1.35e+154) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = (0.5 * sin(re)) * ((im * 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 <= 0.036d0) then
tmp = sin(re) + (sin(re) * (0.5d0 * (im * im)))
else if (im <= 1.35d+154) then
tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
else
tmp = (0.5d0 * sin(re)) * ((im * im) + 2.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.036) {
tmp = Math.sin(re) + (Math.sin(re) * (0.5 * (im * im)));
} else if (im <= 1.35e+154) {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
} else {
tmp = (0.5 * Math.sin(re)) * ((im * im) + 2.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.036: tmp = math.sin(re) + (math.sin(re) * (0.5 * (im * im))) elif im <= 1.35e+154: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) else: tmp = (0.5 * math.sin(re)) * ((im * im) + 2.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.036) tmp = Float64(sin(re) + Float64(sin(re) * Float64(0.5 * Float64(im * im)))); elseif (im <= 1.35e+154) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(im * im) + 2.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.036) tmp = sin(re) + (sin(re) * (0.5 * (im * im))); elseif (im <= 1.35e+154) tmp = (exp(-im) + exp(im)) * (0.5 * re); else tmp = (0.5 * sin(re)) * ((im * im) + 2.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.036], N[(N[Sin[re], $MachinePrecision] + N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.036:\\
\;\;\;\;\sin re + \sin re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im + 2\right)\\
\end{array}
\end{array}
if im < 0.0359999999999999973Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 83.0%
Simplified83.0%
if 0.0359999999999999973 < im < 1.35000000000000003e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 74.3%
Simplified74.3%
if 1.35000000000000003e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Final simplification83.4%
(FPCore (re im) :precision binary64 (if (or (<= im 0.0145) (not (<= im 1.35e+154))) (* (* 0.5 (sin re)) (+ (* im im) 2.0)) (+ re (* re (+ (* 0.5 (* im im)) (* 0.041666666666666664 (pow im 4.0)))))))
double code(double re, double im) {
double tmp;
if ((im <= 0.0145) || !(im <= 1.35e+154)) {
tmp = (0.5 * sin(re)) * ((im * im) + 2.0);
} else {
tmp = re + (re * ((0.5 * (im * im)) + (0.041666666666666664 * 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 <= 0.0145d0) .or. (.not. (im <= 1.35d+154))) then
tmp = (0.5d0 * sin(re)) * ((im * im) + 2.0d0)
else
tmp = re + (re * ((0.5d0 * (im * im)) + (0.041666666666666664d0 * (im ** 4.0d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 0.0145) || !(im <= 1.35e+154)) {
tmp = (0.5 * Math.sin(re)) * ((im * im) + 2.0);
} else {
tmp = re + (re * ((0.5 * (im * im)) + (0.041666666666666664 * Math.pow(im, 4.0))));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 0.0145) or not (im <= 1.35e+154): tmp = (0.5 * math.sin(re)) * ((im * im) + 2.0) else: tmp = re + (re * ((0.5 * (im * im)) + (0.041666666666666664 * math.pow(im, 4.0)))) return tmp
function code(re, im) tmp = 0.0 if ((im <= 0.0145) || !(im <= 1.35e+154)) tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(im * im) + 2.0)); else tmp = Float64(re + Float64(re * Float64(Float64(0.5 * Float64(im * im)) + Float64(0.041666666666666664 * (im ^ 4.0))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 0.0145) || ~((im <= 1.35e+154))) tmp = (0.5 * sin(re)) * ((im * im) + 2.0); else tmp = re + (re * ((0.5 * (im * im)) + (0.041666666666666664 * (im ^ 4.0)))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 0.0145], N[Not[LessEqual[im, 1.35e+154]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(re + N[(re * N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.0145 \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im + 2\right)\\
\mathbf{else}:\\
\;\;\;\;re + re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 0.041666666666666664 \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 0.0145000000000000007 or 1.35000000000000003e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.8%
Simplified84.8%
if 0.0145000000000000007 < im < 1.35000000000000003e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 74.3%
Simplified74.3%
Taylor expanded in im around 0 43.7%
associate-*r*43.7%
associate-*r*43.7%
distribute-rgt-out43.7%
+-commutative43.7%
unpow243.7%
Simplified43.7%
Final simplification79.2%
(FPCore (re im) :precision binary64 (if (or (<= im 4.6e+33) (not (<= im 1.35e+154))) (* (* 0.5 (sin re)) (+ (* im im) 2.0)) (+ re (* re (* 0.041666666666666664 (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if ((im <= 4.6e+33) || !(im <= 1.35e+154)) {
tmp = (0.5 * sin(re)) * ((im * im) + 2.0);
} else {
tmp = re + (re * (0.041666666666666664 * 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 <= 4.6d+33) .or. (.not. (im <= 1.35d+154))) then
tmp = (0.5d0 * sin(re)) * ((im * im) + 2.0d0)
else
tmp = re + (re * (0.041666666666666664d0 * (im ** 4.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 4.6e+33) || !(im <= 1.35e+154)) {
tmp = (0.5 * Math.sin(re)) * ((im * im) + 2.0);
} else {
tmp = re + (re * (0.041666666666666664 * Math.pow(im, 4.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 4.6e+33) or not (im <= 1.35e+154): tmp = (0.5 * math.sin(re)) * ((im * im) + 2.0) else: tmp = re + (re * (0.041666666666666664 * math.pow(im, 4.0))) return tmp
function code(re, im) tmp = 0.0 if ((im <= 4.6e+33) || !(im <= 1.35e+154)) tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(im * im) + 2.0)); else tmp = Float64(re + Float64(re * Float64(0.041666666666666664 * (im ^ 4.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 4.6e+33) || ~((im <= 1.35e+154))) tmp = (0.5 * sin(re)) * ((im * im) + 2.0); else tmp = re + (re * (0.041666666666666664 * (im ^ 4.0))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 4.6e+33], N[Not[LessEqual[im, 1.35e+154]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(re + N[(re * N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.6 \cdot 10^{+33} \lor \neg \left(im \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im + 2\right)\\
\mathbf{else}:\\
\;\;\;\;re + re \cdot \left(0.041666666666666664 \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 4.60000000000000021e33 or 1.35000000000000003e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 81.6%
Simplified81.6%
if 4.60000000000000021e33 < im < 1.35000000000000003e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 72.0%
Simplified72.0%
Taylor expanded in im around 0 56.9%
associate-*r*56.9%
associate-*r*56.9%
distribute-rgt-out56.9%
+-commutative56.9%
unpow256.9%
Simplified56.9%
Taylor expanded in im around inf 56.9%
associate-*r*56.9%
*-commutative56.9%
Simplified56.9%
Final simplification79.1%
(FPCore (re im) :precision binary64 (if (<= im 6.8e+30) (sin re) (* re (+ (* 0.041666666666666664 (pow im 4.0)) 2.5))))
double code(double re, double im) {
double tmp;
if (im <= 6.8e+30) {
tmp = sin(re);
} else {
tmp = re * ((0.041666666666666664 * pow(im, 4.0)) + 2.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 6.8d+30) then
tmp = sin(re)
else
tmp = re * ((0.041666666666666664d0 * (im ** 4.0d0)) + 2.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 6.8e+30) {
tmp = Math.sin(re);
} else {
tmp = re * ((0.041666666666666664 * Math.pow(im, 4.0)) + 2.5);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 6.8e+30: tmp = math.sin(re) else: tmp = re * ((0.041666666666666664 * math.pow(im, 4.0)) + 2.5) return tmp
function code(re, im) tmp = 0.0 if (im <= 6.8e+30) tmp = sin(re); else tmp = Float64(re * Float64(Float64(0.041666666666666664 * (im ^ 4.0)) + 2.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 6.8e+30) tmp = sin(re); else tmp = re * ((0.041666666666666664 * (im ^ 4.0)) + 2.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 6.8e+30], N[Sin[re], $MachinePrecision], N[(re * N[(N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision] + 2.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 6.8 \cdot 10^{+30}:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.041666666666666664 \cdot {im}^{4} + 2.5\right)\\
\end{array}
\end{array}
if im < 6.8000000000000005e30Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 63.9%
if 6.8000000000000005e30 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 81.6%
Simplified81.6%
Taylor expanded in im around 0 73.9%
associate-*r*73.9%
associate-*r*73.9%
distribute-rgt-out73.9%
+-commutative73.9%
unpow273.9%
Simplified73.9%
Applied egg-rr73.9%
Taylor expanded in re around 0 73.9%
Final simplification65.8%
(FPCore (re im) :precision binary64 (if (<= im 6.8e+30) (sin re) (+ re (* re (* 0.041666666666666664 (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 6.8e+30) {
tmp = sin(re);
} else {
tmp = re + (re * (0.041666666666666664 * 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 <= 6.8d+30) then
tmp = sin(re)
else
tmp = re + (re * (0.041666666666666664d0 * (im ** 4.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 6.8e+30) {
tmp = Math.sin(re);
} else {
tmp = re + (re * (0.041666666666666664 * Math.pow(im, 4.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 6.8e+30: tmp = math.sin(re) else: tmp = re + (re * (0.041666666666666664 * math.pow(im, 4.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 6.8e+30) tmp = sin(re); else tmp = Float64(re + Float64(re * Float64(0.041666666666666664 * (im ^ 4.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 6.8e+30) tmp = sin(re); else tmp = re + (re * (0.041666666666666664 * (im ^ 4.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 6.8e+30], N[Sin[re], $MachinePrecision], N[(re + N[(re * N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 6.8 \cdot 10^{+30}:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;re + re \cdot \left(0.041666666666666664 \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 6.8000000000000005e30Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 63.9%
if 6.8000000000000005e30 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 81.6%
Simplified81.6%
Taylor expanded in im around 0 73.9%
associate-*r*73.9%
associate-*r*73.9%
distribute-rgt-out73.9%
+-commutative73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in im around inf 73.9%
associate-*r*73.9%
*-commutative73.9%
Simplified73.9%
Final simplification65.8%
(FPCore (re im)
:precision binary64
(if (<= im 500.0)
(sin re)
(if (<= im 6e+183)
(* (* re (* im im)) (+ 0.5 (* -0.08333333333333333 (* re re))))
(* (* 0.5 re) (+ (* im im) 2.0)))))
double code(double re, double im) {
double tmp;
if (im <= 500.0) {
tmp = sin(re);
} else if (im <= 6e+183) {
tmp = (re * (im * im)) * (0.5 + (-0.08333333333333333 * (re * re)));
} else {
tmp = (0.5 * re) * ((im * 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 <= 500.0d0) then
tmp = sin(re)
else if (im <= 6d+183) then
tmp = (re * (im * im)) * (0.5d0 + ((-0.08333333333333333d0) * (re * re)))
else
tmp = (0.5d0 * re) * ((im * im) + 2.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 500.0) {
tmp = Math.sin(re);
} else if (im <= 6e+183) {
tmp = (re * (im * im)) * (0.5 + (-0.08333333333333333 * (re * re)));
} else {
tmp = (0.5 * re) * ((im * im) + 2.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 500.0: tmp = math.sin(re) elif im <= 6e+183: tmp = (re * (im * im)) * (0.5 + (-0.08333333333333333 * (re * re))) else: tmp = (0.5 * re) * ((im * im) + 2.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 500.0) tmp = sin(re); elseif (im <= 6e+183) tmp = Float64(Float64(re * Float64(im * im)) * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re)))); else tmp = Float64(Float64(0.5 * re) * Float64(Float64(im * im) + 2.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 500.0) tmp = sin(re); elseif (im <= 6e+183) tmp = (re * (im * im)) * (0.5 + (-0.08333333333333333 * (re * re))); else tmp = (0.5 * re) * ((im * im) + 2.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 500.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 6e+183], N[(N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 500:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 6 \cdot 10^{+183}:\\
\;\;\;\;\left(re \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im + 2\right)\\
\end{array}
\end{array}
if im < 500Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 65.7%
if 500 < im < 5.99999999999999992e183Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 20.3%
Simplified20.3%
Taylor expanded in re around 0 6.9%
metadata-eval6.9%
distribute-lft-in6.9%
associate-*l*6.9%
*-commutative6.9%
associate-*r*6.9%
sub-neg6.9%
+-commutative6.9%
metadata-eval6.9%
metadata-eval6.9%
distribute-lft-in6.9%
associate-*l*6.9%
*-commutative6.9%
associate-*r*6.9%
unpow36.9%
unpow26.9%
associate-*l*6.9%
associate-*r*6.9%
Simplified39.3%
Taylor expanded in im around inf 39.3%
unpow239.3%
*-commutative39.3%
Simplified39.3%
if 5.99999999999999992e183 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 94.4%
Simplified94.4%
Taylor expanded in im around 0 94.4%
unpow294.4%
Simplified94.4%
Final simplification63.9%
(FPCore (re im) :precision binary64 (if (or (<= im 114.0) (not (<= im 5e+183))) (* (* 0.5 re) (+ (* im im) 2.0)) (* (* re (* im im)) (+ 0.5 (* -0.08333333333333333 (* re re))))))
double code(double re, double im) {
double tmp;
if ((im <= 114.0) || !(im <= 5e+183)) {
tmp = (0.5 * re) * ((im * im) + 2.0);
} else {
tmp = (re * (im * im)) * (0.5 + (-0.08333333333333333 * (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 <= 114.0d0) .or. (.not. (im <= 5d+183))) then
tmp = (0.5d0 * re) * ((im * im) + 2.0d0)
else
tmp = (re * (im * im)) * (0.5d0 + ((-0.08333333333333333d0) * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 114.0) || !(im <= 5e+183)) {
tmp = (0.5 * re) * ((im * im) + 2.0);
} else {
tmp = (re * (im * im)) * (0.5 + (-0.08333333333333333 * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 114.0) or not (im <= 5e+183): tmp = (0.5 * re) * ((im * im) + 2.0) else: tmp = (re * (im * im)) * (0.5 + (-0.08333333333333333 * (re * re))) return tmp
function code(re, im) tmp = 0.0 if ((im <= 114.0) || !(im <= 5e+183)) tmp = Float64(Float64(0.5 * re) * Float64(Float64(im * im) + 2.0)); else tmp = Float64(Float64(re * Float64(im * im)) * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 114.0) || ~((im <= 5e+183))) tmp = (0.5 * re) * ((im * im) + 2.0); else tmp = (re * (im * im)) * (0.5 + (-0.08333333333333333 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 114.0], N[Not[LessEqual[im, 5e+183]], $MachinePrecision]], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 114 \lor \neg \left(im \leq 5 \cdot 10^{+183}\right):\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im + 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot \left(im \cdot im\right)\right) \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 114 or 5.00000000000000009e183 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 64.2%
Simplified64.2%
Taylor expanded in im around 0 52.1%
unpow252.1%
Simplified52.1%
if 114 < im < 5.00000000000000009e183Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 20.0%
Simplified20.0%
Taylor expanded in re around 0 6.8%
metadata-eval6.8%
distribute-lft-in6.8%
associate-*l*6.8%
*-commutative6.8%
associate-*r*6.8%
sub-neg6.8%
+-commutative6.8%
metadata-eval6.8%
metadata-eval6.8%
distribute-lft-in6.8%
associate-*l*6.8%
*-commutative6.8%
associate-*r*6.8%
unpow36.8%
unpow26.8%
associate-*l*6.8%
associate-*r*6.8%
Simplified38.4%
Taylor expanded in im around inf 38.4%
unpow238.4%
*-commutative38.4%
Simplified38.4%
Final simplification50.1%
(FPCore (re im) :precision binary64 (if (<= im 1.55e+129) (* (+ 0.5 (* -0.08333333333333333 (* re re))) (* re 2.0)) (* (* 0.5 re) (+ (* im im) 2.0))))
double code(double re, double im) {
double tmp;
if (im <= 1.55e+129) {
tmp = (0.5 + (-0.08333333333333333 * (re * re))) * (re * 2.0);
} else {
tmp = (0.5 * re) * ((im * 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 <= 1.55d+129) then
tmp = (0.5d0 + ((-0.08333333333333333d0) * (re * re))) * (re * 2.0d0)
else
tmp = (0.5d0 * re) * ((im * im) + 2.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.55e+129) {
tmp = (0.5 + (-0.08333333333333333 * (re * re))) * (re * 2.0);
} else {
tmp = (0.5 * re) * ((im * im) + 2.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.55e+129: tmp = (0.5 + (-0.08333333333333333 * (re * re))) * (re * 2.0) else: tmp = (0.5 * re) * ((im * im) + 2.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.55e+129) tmp = Float64(Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re))) * Float64(re * 2.0)); else tmp = Float64(Float64(0.5 * re) * Float64(Float64(im * im) + 2.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.55e+129) tmp = (0.5 + (-0.08333333333333333 * (re * re))) * (re * 2.0); else tmp = (0.5 * re) * ((im * im) + 2.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.55e+129], N[(N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.55 \cdot 10^{+129}:\\
\;\;\;\;\left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right) \cdot \left(re \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im + 2\right)\\
\end{array}
\end{array}
if im < 1.55e129Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 73.8%
Simplified73.8%
Taylor expanded in re around 0 33.7%
metadata-eval33.7%
distribute-lft-in33.7%
associate-*l*33.7%
*-commutative33.7%
associate-*r*33.6%
sub-neg33.6%
+-commutative33.6%
metadata-eval33.6%
metadata-eval33.6%
distribute-lft-in33.6%
associate-*l*33.6%
*-commutative33.6%
associate-*r*33.6%
unpow333.6%
unpow233.6%
associate-*l*33.6%
associate-*r*33.6%
Simplified49.7%
Taylor expanded in im around 0 39.1%
*-commutative39.1%
Simplified39.1%
if 1.55e129 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 90.6%
Simplified90.6%
Taylor expanded in im around 0 78.7%
unpow278.7%
Simplified78.7%
Final simplification44.0%
(FPCore (re im) :precision binary64 (if (<= im 4.5e+43) re (+ 0.08333333333333333 (/ 0.25 (* re re)))))
double code(double re, double im) {
double tmp;
if (im <= 4.5e+43) {
tmp = re;
} else {
tmp = 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 <= 4.5d+43) then
tmp = re
else
tmp = 0.08333333333333333d0 + (0.25d0 / (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4.5e+43) {
tmp = re;
} else {
tmp = 0.08333333333333333 + (0.25 / (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.5e+43: tmp = re else: tmp = 0.08333333333333333 + (0.25 / (re * re)) return tmp
function code(re, im) tmp = 0.0 if (im <= 4.5e+43) tmp = re; else tmp = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4.5e+43) tmp = re; else tmp = 0.08333333333333333 + (0.25 / (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.5e+43], re, N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.5 \cdot 10^{+43}:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\
\end{array}
\end{array}
if im < 4.5e43Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 62.0%
Simplified62.0%
Taylor expanded in im around 0 33.2%
if 4.5e43 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr6.4%
Taylor expanded in re around 0 6.4%
associate-*r/6.4%
metadata-eval6.4%
unpow26.4%
Simplified6.4%
Final simplification28.5%
(FPCore (re im) :precision binary64 (* (* 0.5 re) (+ (* im im) 2.0)))
double code(double re, double im) {
return (0.5 * re) * ((im * im) + 2.0);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * re) * ((im * im) + 2.0d0)
end function
public static double code(double re, double im) {
return (0.5 * re) * ((im * im) + 2.0);
}
def code(re, im): return (0.5 * re) * ((im * im) + 2.0)
function code(re, im) return Float64(Float64(0.5 * re) * Float64(Float64(im * im) + 2.0)) end
function tmp = code(re, im) tmp = (0.5 * re) * ((im * im) + 2.0); end
code[re_, im_] := N[(N[(0.5 * re), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot re\right) \cdot \left(im \cdot im + 2\right)
\end{array}
Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 65.6%
Simplified65.6%
Taylor expanded in im around 0 48.6%
unpow248.6%
Simplified48.6%
Final simplification48.6%
(FPCore (re im) :precision binary64 (if (<= im 2.2e+44) re (/ 0.25 (* re re))))
double code(double re, double im) {
double tmp;
if (im <= 2.2e+44) {
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 <= 2.2d+44) 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 <= 2.2e+44) {
tmp = re;
} else {
tmp = 0.25 / (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.2e+44: tmp = re else: tmp = 0.25 / (re * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.2e+44) 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 <= 2.2e+44) tmp = re; else tmp = 0.25 / (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.2e+44], re, N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.2 \cdot 10^{+44}:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\end{array}
\end{array}
if im < 2.19999999999999996e44Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 62.0%
Simplified62.0%
Taylor expanded in im around 0 33.2%
if 2.19999999999999996e44 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr6.4%
Taylor expanded in re around 0 6.2%
unpow26.2%
Simplified6.2%
Final simplification28.5%
(FPCore (re im) :precision binary64 0.08333333333333333)
double code(double re, double im) {
return 0.08333333333333333;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.08333333333333333d0
end function
public static double code(double re, double im) {
return 0.08333333333333333;
}
def code(re, im): return 0.08333333333333333
function code(re, im) return 0.08333333333333333 end
function tmp = code(re, im) tmp = 0.08333333333333333; end
code[re_, im_] := 0.08333333333333333
\begin{array}{l}
\\
0.08333333333333333
\end{array}
Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr6.4%
Taylor expanded in re around 0 6.4%
associate-*r/6.4%
metadata-eval6.4%
unpow26.4%
Simplified6.4%
Taylor expanded in re around inf 4.2%
Final simplification4.2%
(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%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 65.6%
Simplified65.6%
Taylor expanded in im around 0 27.9%
Final simplification27.9%
herbie shell --seed 2023275
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))