
(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 10 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-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im) :precision binary64 (if (or (<= im 4.0) (not (<= im 4.7e+149))) (* (sin re) (fma (* 0.5 im) im 1.0)) (* (* 0.5 re) (+ (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if ((im <= 4.0) || !(im <= 4.7e+149)) {
tmp = sin(re) * fma((0.5 * im), im, 1.0);
} else {
tmp = (0.5 * re) * (exp(-im) + exp(im));
}
return tmp;
}
function code(re, im) tmp = 0.0 if ((im <= 4.0) || !(im <= 4.7e+149)) tmp = Float64(sin(re) * fma(Float64(0.5 * im), im, 1.0)); else tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) + exp(im))); end return tmp end
code[re_, im_] := If[Or[LessEqual[im, 4.0], N[Not[LessEqual[im, 4.7e+149]], $MachinePrecision]], N[(N[Sin[re], $MachinePrecision] * N[(N[(0.5 * im), $MachinePrecision] * im + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4 \lor \neg \left(im \leq 4.7 \cdot 10^{+149}\right):\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5 \cdot im, im, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\
\end{array}
\end{array}
if im < 4 or 4.7000000000000004e149 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 86.7%
Simplified86.7%
unpow286.7%
associate-*r*86.7%
fma-define86.7%
Applied egg-rr86.7%
if 4 < im < 4.7000000000000004e149Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 82.8%
Simplified82.8%
Final simplification86.2%
(FPCore (re im) :precision binary64 (if (or (<= im 820.0) (not (<= im 1.1e+144))) (* (sin re) (fma (* 0.5 im) im 1.0)) (cbrt (pow re -12.0))))
double code(double re, double im) {
double tmp;
if ((im <= 820.0) || !(im <= 1.1e+144)) {
tmp = sin(re) * fma((0.5 * im), im, 1.0);
} else {
tmp = cbrt(pow(re, -12.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if ((im <= 820.0) || !(im <= 1.1e+144)) tmp = Float64(sin(re) * fma(Float64(0.5 * im), im, 1.0)); else tmp = cbrt((re ^ -12.0)); end return tmp end
code[re_, im_] := If[Or[LessEqual[im, 820.0], N[Not[LessEqual[im, 1.1e+144]], $MachinePrecision]], N[(N[Sin[re], $MachinePrecision] * N[(N[(0.5 * im), $MachinePrecision] * im + 1.0), $MachinePrecision]), $MachinePrecision], N[Power[N[Power[re, -12.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 820 \lor \neg \left(im \leq 1.1 \cdot 10^{+144}\right):\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(0.5 \cdot im, im, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{re}^{-12}}\\
\end{array}
\end{array}
if im < 820 or 1.09999999999999994e144 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 86.7%
Simplified86.7%
unpow286.7%
associate-*r*86.7%
fma-define86.7%
Applied egg-rr86.7%
if 820 < im < 1.09999999999999994e144Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 82.8%
Simplified82.8%
Applied egg-rr35.0%
add-cbrt-cube35.0%
pow1/335.0%
pow335.0%
exp-to-pow35.2%
pow-pow35.2%
metadata-eval35.2%
Applied egg-rr35.2%
unpow1/335.2%
Simplified35.2%
Final simplification80.8%
(FPCore (re im)
:precision binary64
(if (<= im 650.0)
(sin re)
(if (<= im 1.1e+144)
(cbrt (pow re -12.0))
(* (sin re) (* 0.5 (pow im 2.0))))))
double code(double re, double im) {
double tmp;
if (im <= 650.0) {
tmp = sin(re);
} else if (im <= 1.1e+144) {
tmp = cbrt(pow(re, -12.0));
} else {
tmp = sin(re) * (0.5 * pow(im, 2.0));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= 650.0) {
tmp = Math.sin(re);
} else if (im <= 1.1e+144) {
tmp = Math.cbrt(Math.pow(re, -12.0));
} else {
tmp = Math.sin(re) * (0.5 * Math.pow(im, 2.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 650.0) tmp = sin(re); elseif (im <= 1.1e+144) tmp = cbrt((re ^ -12.0)); else tmp = Float64(sin(re) * Float64(0.5 * (im ^ 2.0))); end return tmp end
code[re_, im_] := If[LessEqual[im, 650.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.1e+144], N[Power[N[Power[re, -12.0], $MachinePrecision], 1/3], $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 650:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+144}:\\
\;\;\;\;\sqrt[3]{{re}^{-12}}\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(0.5 \cdot {im}^{2}\right)\\
\end{array}
\end{array}
if im < 650Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 68.7%
if 650 < im < 1.09999999999999994e144Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 82.8%
Simplified82.8%
Applied egg-rr35.0%
add-cbrt-cube35.0%
pow1/335.0%
pow335.0%
exp-to-pow35.2%
pow-pow35.2%
metadata-eval35.2%
Applied egg-rr35.2%
unpow1/335.2%
Simplified35.2%
if 1.09999999999999994e144 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification68.9%
(FPCore (re im)
:precision binary64
(if (<= im 850.0)
(sin re)
(if (<= im 3.3e+140)
(cbrt (pow re -12.0))
(+ re (* 0.5 (* re (pow im 2.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 850.0) {
tmp = sin(re);
} else if (im <= 3.3e+140) {
tmp = cbrt(pow(re, -12.0));
} else {
tmp = re + (0.5 * (re * pow(im, 2.0)));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= 850.0) {
tmp = Math.sin(re);
} else if (im <= 3.3e+140) {
tmp = Math.cbrt(Math.pow(re, -12.0));
} else {
tmp = re + (0.5 * (re * Math.pow(im, 2.0)));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 850.0) tmp = sin(re); elseif (im <= 3.3e+140) tmp = cbrt((re ^ -12.0)); else tmp = Float64(re + Float64(0.5 * Float64(re * (im ^ 2.0)))); end return tmp end
code[re_, im_] := If[LessEqual[im, 850.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.3e+140], N[Power[N[Power[re, -12.0], $MachinePrecision], 1/3], $MachinePrecision], N[(re + N[(0.5 * N[(re * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 850:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3.3 \cdot 10^{+140}:\\
\;\;\;\;\sqrt[3]{{re}^{-12}}\\
\mathbf{else}:\\
\;\;\;\;re + 0.5 \cdot \left(re \cdot {im}^{2}\right)\\
\end{array}
\end{array}
if im < 850Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 68.7%
if 850 < im < 3.3000000000000002e140Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 82.1%
Simplified82.1%
Applied egg-rr36.2%
add-cbrt-cube36.2%
pow1/336.2%
pow336.2%
exp-to-pow36.4%
pow-pow36.4%
metadata-eval36.4%
Applied egg-rr36.4%
unpow1/336.4%
Simplified36.4%
if 3.3000000000000002e140 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 76.5%
Simplified76.5%
Taylor expanded in im around 0 76.5%
Final simplification66.2%
(FPCore (re im) :precision binary64 (if (<= im 780.0) (sin re) (if (<= im 4.2e+139) (pow re -4.0) (+ re (* 0.5 (* re (pow im 2.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 780.0) {
tmp = sin(re);
} else if (im <= 4.2e+139) {
tmp = pow(re, -4.0);
} else {
tmp = re + (0.5 * (re * pow(im, 2.0)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 780.0d0) then
tmp = sin(re)
else if (im <= 4.2d+139) then
tmp = re ** (-4.0d0)
else
tmp = re + (0.5d0 * (re * (im ** 2.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 780.0) {
tmp = Math.sin(re);
} else if (im <= 4.2e+139) {
tmp = Math.pow(re, -4.0);
} else {
tmp = re + (0.5 * (re * Math.pow(im, 2.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 780.0: tmp = math.sin(re) elif im <= 4.2e+139: tmp = math.pow(re, -4.0) else: tmp = re + (0.5 * (re * math.pow(im, 2.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 780.0) tmp = sin(re); elseif (im <= 4.2e+139) tmp = re ^ -4.0; else tmp = Float64(re + Float64(0.5 * Float64(re * (im ^ 2.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 780.0) tmp = sin(re); elseif (im <= 4.2e+139) tmp = re ^ -4.0; else tmp = re + (0.5 * (re * (im ^ 2.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 780.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 4.2e+139], N[Power[re, -4.0], $MachinePrecision], N[(re + N[(0.5 * N[(re * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 780:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+139}:\\
\;\;\;\;{re}^{-4}\\
\mathbf{else}:\\
\;\;\;\;re + 0.5 \cdot \left(re \cdot {im}^{2}\right)\\
\end{array}
\end{array}
if im < 780Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 68.7%
if 780 < im < 4.1999999999999997e139Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 82.1%
Simplified82.1%
Applied egg-rr36.4%
if 4.1999999999999997e139 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 76.5%
Simplified76.5%
Taylor expanded in im around 0 76.5%
Final simplification66.2%
(FPCore (re im) :precision binary64 (if (<= im 780.0) (sin re) (pow re -4.0)))
double code(double re, double im) {
double tmp;
if (im <= 780.0) {
tmp = sin(re);
} else {
tmp = pow(re, -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 <= 780.0d0) then
tmp = sin(re)
else
tmp = re ** (-4.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 780.0) {
tmp = Math.sin(re);
} else {
tmp = Math.pow(re, -4.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 780.0: tmp = math.sin(re) else: tmp = math.pow(re, -4.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 780.0) tmp = sin(re); else tmp = re ^ -4.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 780.0) tmp = sin(re); else tmp = re ^ -4.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 780.0], N[Sin[re], $MachinePrecision], N[Power[re, -4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 780:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;{re}^{-4}\\
\end{array}
\end{array}
if im < 780Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 68.7%
if 780 < im Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 79.0%
Simplified79.0%
Applied egg-rr23.4%
Final simplification57.7%
(FPCore (re im) :precision binary64 (sin re))
double code(double re, double im) {
return sin(re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re)
end function
public static double code(double re, double im) {
return Math.sin(re);
}
def code(re, im): return math.sin(re)
function code(re, im) return sin(re) end
function tmp = code(re, im) tmp = sin(re); end
code[re_, im_] := N[Sin[re], $MachinePrecision]
\begin{array}{l}
\\
\sin re
\end{array}
Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 52.7%
Final simplification52.7%
(FPCore (re im) :precision binary64 (if (<= re 1.05e-10) re (/ re (+ re (- re re)))))
double code(double re, double im) {
double tmp;
if (re <= 1.05e-10) {
tmp = re;
} else {
tmp = re / (re + (re - re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 1.05d-10) then
tmp = re
else
tmp = re / (re + (re - re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.05e-10) {
tmp = re;
} else {
tmp = re / (re + (re - re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.05e-10: tmp = re else: tmp = re / (re + (re - re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.05e-10) tmp = re; else tmp = Float64(re / Float64(re + Float64(re - re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.05e-10) tmp = re; else tmp = re / (re + (re - re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.05e-10], re, N[(re / N[(re + N[(re - re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.05 \cdot 10^{-10}:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\frac{re}{re + \left(re - re\right)}\\
\end{array}
\end{array}
if re < 1.05e-10Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 72.4%
Simplified72.4%
Taylor expanded in im around 0 31.7%
if 1.05e-10 < re Initial program 100.0%
distribute-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 25.2%
Simplified25.2%
Applied egg-rr7.4%
Final simplification24.9%
(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-rgt-in100.0%
cancel-sign-sub100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 59.1%
Simplified59.1%
Taylor expanded in im around 0 23.6%
Final simplification23.6%
herbie shell --seed 2024112
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))