
(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 (<= im 6.8e-7)
(* (* 0.5 (sin re)) (fma im im 2.0))
(if (<= im 1e+48)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(* (sin re) (* 0.001388888888888889 (pow im 6.0))))))
double code(double re, double im) {
double tmp;
if (im <= 6.8e-7) {
tmp = (0.5 * sin(re)) * fma(im, im, 2.0);
} else if (im <= 1e+48) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else {
tmp = sin(re) * (0.001388888888888889 * pow(im, 6.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 6.8e-7) tmp = Float64(Float64(0.5 * sin(re)) * fma(im, im, 2.0)); elseif (im <= 1e+48) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); else tmp = Float64(sin(re) * Float64(0.001388888888888889 * (im ^ 6.0))); end return tmp end
code[re_, im_] := If[LessEqual[im, 6.8e-7], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e+48], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(0.001388888888888889 * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 6.8 \cdot 10^{-7}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\
\mathbf{elif}\;im \leq 10^{+48}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(0.001388888888888889 \cdot {im}^{6}\right)\\
\end{array}
\end{array}
if im < 6.79999999999999948e-7Initial 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 81.3%
+-commutative81.3%
unpow281.3%
fma-define81.3%
Simplified81.3%
if 6.79999999999999948e-7 < im < 1.00000000000000004e48Initial program 99.8%
distribute-rgt-in99.5%
cancel-sign-sub99.5%
distribute-rgt-out--99.8%
sub-neg99.8%
remove-double-neg99.8%
neg-sub099.8%
Simplified99.8%
Taylor expanded in re around 0 55.5%
if 1.00000000000000004e48 < 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 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in im around inf 98.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
Final simplification83.7%
(FPCore (re im)
:precision binary64
(if (<= im 37000000000.0)
(sin re)
(if (<= im 1e+48)
(pow re -1716.0)
(* (sin re) (* 0.001388888888888889 (pow im 6.0))))))
double code(double re, double im) {
double tmp;
if (im <= 37000000000.0) {
tmp = sin(re);
} else if (im <= 1e+48) {
tmp = pow(re, -1716.0);
} else {
tmp = sin(re) * (0.001388888888888889 * pow(im, 6.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 37000000000.0d0) then
tmp = sin(re)
else if (im <= 1d+48) then
tmp = re ** (-1716.0d0)
else
tmp = sin(re) * (0.001388888888888889d0 * (im ** 6.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 37000000000.0) {
tmp = Math.sin(re);
} else if (im <= 1e+48) {
tmp = Math.pow(re, -1716.0);
} else {
tmp = Math.sin(re) * (0.001388888888888889 * Math.pow(im, 6.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 37000000000.0: tmp = math.sin(re) elif im <= 1e+48: tmp = math.pow(re, -1716.0) else: tmp = math.sin(re) * (0.001388888888888889 * math.pow(im, 6.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 37000000000.0) tmp = sin(re); elseif (im <= 1e+48) tmp = re ^ -1716.0; else tmp = Float64(sin(re) * Float64(0.001388888888888889 * (im ^ 6.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 37000000000.0) tmp = sin(re); elseif (im <= 1e+48) tmp = re ^ -1716.0; else tmp = sin(re) * (0.001388888888888889 * (im ^ 6.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 37000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1e+48], N[Power[re, -1716.0], $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(0.001388888888888889 * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 37000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 10^{+48}:\\
\;\;\;\;{re}^{-1716}\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(0.001388888888888889 \cdot {im}^{6}\right)\\
\end{array}
\end{array}
if im < 3.7e10Initial program 100.0%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 63.5%
if 3.7e10 < im < 1.00000000000000004e48Initial 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 60.0%
Applied egg-rr20.6%
if 1.00000000000000004e48 < 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 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in im around inf 98.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
Final simplification69.4%
(FPCore (re im)
:precision binary64
(if (<= im 37000000000.0)
(* (* 0.5 (sin re)) (fma im im 2.0))
(if (<= im 1e+48)
(pow re -1716.0)
(* (sin re) (* 0.001388888888888889 (pow im 6.0))))))
double code(double re, double im) {
double tmp;
if (im <= 37000000000.0) {
tmp = (0.5 * sin(re)) * fma(im, im, 2.0);
} else if (im <= 1e+48) {
tmp = pow(re, -1716.0);
} else {
tmp = sin(re) * (0.001388888888888889 * pow(im, 6.0));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= 37000000000.0) tmp = Float64(Float64(0.5 * sin(re)) * fma(im, im, 2.0)); elseif (im <= 1e+48) tmp = re ^ -1716.0; else tmp = Float64(sin(re) * Float64(0.001388888888888889 * (im ^ 6.0))); end return tmp end
code[re_, im_] := If[LessEqual[im, 37000000000.0], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e+48], N[Power[re, -1716.0], $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(0.001388888888888889 * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 37000000000:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(im, im, 2\right)\\
\mathbf{elif}\;im \leq 10^{+48}:\\
\;\;\;\;{re}^{-1716}\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(0.001388888888888889 \cdot {im}^{6}\right)\\
\end{array}
\end{array}
if im < 3.7e10Initial program 100.0%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 80.0%
+-commutative80.0%
unpow280.0%
fma-define80.0%
Simplified80.0%
if 3.7e10 < im < 1.00000000000000004e48Initial 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 60.0%
Applied egg-rr20.6%
if 1.00000000000000004e48 < 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 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in im around inf 98.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
Final simplification82.4%
(FPCore (re im)
:precision binary64
(if (<= im 37000000000.0)
(sin re)
(if (<= im 1.4e+55)
(pow re -1716.0)
(* 0.001388888888888889 (* re (pow im 6.0))))))
double code(double re, double im) {
double tmp;
if (im <= 37000000000.0) {
tmp = sin(re);
} else if (im <= 1.4e+55) {
tmp = pow(re, -1716.0);
} else {
tmp = 0.001388888888888889 * (re * pow(im, 6.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 37000000000.0d0) then
tmp = sin(re)
else if (im <= 1.4d+55) then
tmp = re ** (-1716.0d0)
else
tmp = 0.001388888888888889d0 * (re * (im ** 6.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 37000000000.0) {
tmp = Math.sin(re);
} else if (im <= 1.4e+55) {
tmp = Math.pow(re, -1716.0);
} else {
tmp = 0.001388888888888889 * (re * Math.pow(im, 6.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 37000000000.0: tmp = math.sin(re) elif im <= 1.4e+55: tmp = math.pow(re, -1716.0) else: tmp = 0.001388888888888889 * (re * math.pow(im, 6.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 37000000000.0) tmp = sin(re); elseif (im <= 1.4e+55) tmp = re ^ -1716.0; else tmp = Float64(0.001388888888888889 * Float64(re * (im ^ 6.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 37000000000.0) tmp = sin(re); elseif (im <= 1.4e+55) tmp = re ^ -1716.0; else tmp = 0.001388888888888889 * (re * (im ^ 6.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 37000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.4e+55], N[Power[re, -1716.0], $MachinePrecision], N[(0.001388888888888889 * N[(re * N[Power[im, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 37000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.4 \cdot 10^{+55}:\\
\;\;\;\;{re}^{-1716}\\
\mathbf{else}:\\
\;\;\;\;0.001388888888888889 \cdot \left(re \cdot {im}^{6}\right)\\
\end{array}
\end{array}
if im < 3.7e10Initial program 100.0%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 63.5%
if 3.7e10 < im < 1.4e55Initial 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 50.0%
Applied egg-rr25.8%
if 1.4e55 < 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%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 80.9%
Taylor expanded in im around inf 80.9%
Final simplification65.5%
(FPCore (re im) :precision binary64 (if (<= im 37000000000.0) (sin re) (pow re -1716.0)))
double code(double re, double im) {
double tmp;
if (im <= 37000000000.0) {
tmp = sin(re);
} else {
tmp = pow(re, -1716.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 37000000000.0d0) then
tmp = sin(re)
else
tmp = re ** (-1716.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 37000000000.0) {
tmp = Math.sin(re);
} else {
tmp = Math.pow(re, -1716.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 37000000000.0: tmp = math.sin(re) else: tmp = math.pow(re, -1716.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 37000000000.0) tmp = sin(re); else tmp = re ^ -1716.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 37000000000.0) tmp = sin(re); else tmp = re ^ -1716.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 37000000000.0], N[Sin[re], $MachinePrecision], N[Power[re, -1716.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 37000000000:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;{re}^{-1716}\\
\end{array}
\end{array}
if im < 3.7e10Initial program 100.0%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 63.5%
if 3.7e10 < 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.4%
Applied egg-rr31.6%
Final simplification56.6%
(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 50.4%
Final simplification50.4%
(FPCore (re im) :precision binary64 (if (<= re 27.5) re 1.0))
double code(double re, double im) {
double tmp;
if (re <= 27.5) {
tmp = re;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 27.5d0) then
tmp = re
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 27.5) {
tmp = re;
} else {
tmp = 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 27.5: tmp = re else: tmp = 1.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 27.5) tmp = re; else tmp = 1.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 27.5) tmp = re; else tmp = 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 27.5], re, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 27.5:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if re < 27.5Initial 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 75.1%
Taylor expanded in im around 0 31.2%
if 27.5 < re Initial program 100.0%
distribute-rgt-in99.9%
cancel-sign-sub99.9%
distribute-rgt-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-sub0100.0%
Simplified100.0%
Applied egg-rr6.9%
+-inverses6.9%
+-rgt-identity6.9%
*-inverses6.9%
Simplified6.9%
Final simplification24.7%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 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%
Applied egg-rr2.8%
pow-base-12.8%
metadata-eval2.8%
Simplified2.8%
Final simplification2.8%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\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%
Applied egg-rr5.0%
+-inverses5.0%
+-rgt-identity5.0%
*-inverses5.0%
Simplified5.0%
Final simplification5.0%
herbie shell --seed 2024077
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))