
(FPCore (x eps) :precision binary64 (- (sin (+ x eps)) (sin x)))
double code(double x, double eps) {
return sin((x + eps)) - sin(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = sin((x + eps)) - sin(x)
end function
public static double code(double x, double eps) {
return Math.sin((x + eps)) - Math.sin(x);
}
def code(x, eps): return math.sin((x + eps)) - math.sin(x)
function code(x, eps) return Float64(sin(Float64(x + eps)) - sin(x)) end
function tmp = code(x, eps) tmp = sin((x + eps)) - sin(x); end
code[x_, eps_] := N[(N[Sin[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Sin[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin \left(x + \varepsilon\right) - \sin x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (- (sin (+ x eps)) (sin x)))
double code(double x, double eps) {
return sin((x + eps)) - sin(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = sin((x + eps)) - sin(x)
end function
public static double code(double x, double eps) {
return Math.sin((x + eps)) - Math.sin(x);
}
def code(x, eps): return math.sin((x + eps)) - math.sin(x)
function code(x, eps) return Float64(sin(Float64(x + eps)) - sin(x)) end
function tmp = code(x, eps) tmp = sin((x + eps)) - sin(x); end
code[x_, eps_] := N[(N[Sin[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Sin[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin \left(x + \varepsilon\right) - \sin x
\end{array}
(FPCore (x eps) :precision binary64 (fma (sin eps) (cos x) (* (- (sin eps)) (* (sin x) (tan (* eps 0.5))))))
double code(double x, double eps) {
return fma(sin(eps), cos(x), (-sin(eps) * (sin(x) * tan((eps * 0.5)))));
}
function code(x, eps) return fma(sin(eps), cos(x), Float64(Float64(-sin(eps)) * Float64(sin(x) * tan(Float64(eps * 0.5))))) end
code[x_, eps_] := N[(N[Sin[eps], $MachinePrecision] * N[Cos[x], $MachinePrecision] + N[((-N[Sin[eps], $MachinePrecision]) * N[(N[Sin[x], $MachinePrecision] * N[Tan[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin \varepsilon, \cos x, \left(-\sin \varepsilon\right) \cdot \left(\sin x \cdot \tan \left(\varepsilon \cdot 0.5\right)\right)\right)
\end{array}
Initial program 43.0%
sin-sum65.9%
associate--l+65.9%
Applied egg-rr65.9%
+-commutative65.9%
associate-+l-99.7%
*-commutative99.7%
*-rgt-identity99.7%
distribute-lft-out--99.7%
Simplified99.7%
Taylor expanded in eps around inf 99.7%
fma-neg99.7%
distribute-rgt-neg-in99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
metadata-eval99.7%
Simplified99.7%
flip-+99.4%
associate-*r/99.4%
metadata-eval99.4%
sub-1-cos99.4%
unpow299.4%
sub-neg99.4%
metadata-eval99.4%
Applied egg-rr99.4%
*-commutative99.4%
associate-/l*99.4%
associate-/r/99.4%
distribute-frac-neg99.4%
neg-mul-199.4%
metadata-eval99.4%
times-frac99.4%
*-lft-identity99.4%
unpow299.4%
times-frac99.4%
+-commutative99.4%
hang-0p-tan99.8%
Simplified99.8%
fma-udef99.7%
+-commutative99.7%
associate-*l*99.7%
frac-2neg99.7%
metadata-eval99.7%
/-rgt-identity99.7%
div-inv99.7%
metadata-eval99.7%
*-commutative99.7%
Applied egg-rr99.7%
+-commutative99.7%
fma-def99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (sin (+ eps x)) (sin x))))
(if (or (<= t_0 -2e-8) (not (<= t_0 1e-262)))
t_0
(+ (* -0.5 (* (sin x) (* eps eps))) (* eps (cos x))))))
double code(double x, double eps) {
double t_0 = sin((eps + x)) - sin(x);
double tmp;
if ((t_0 <= -2e-8) || !(t_0 <= 1e-262)) {
tmp = t_0;
} else {
tmp = (-0.5 * (sin(x) * (eps * eps))) + (eps * cos(x));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = sin((eps + x)) - sin(x)
if ((t_0 <= (-2d-8)) .or. (.not. (t_0 <= 1d-262))) then
tmp = t_0
else
tmp = ((-0.5d0) * (sin(x) * (eps * eps))) + (eps * cos(x))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.sin((eps + x)) - Math.sin(x);
double tmp;
if ((t_0 <= -2e-8) || !(t_0 <= 1e-262)) {
tmp = t_0;
} else {
tmp = (-0.5 * (Math.sin(x) * (eps * eps))) + (eps * Math.cos(x));
}
return tmp;
}
def code(x, eps): t_0 = math.sin((eps + x)) - math.sin(x) tmp = 0 if (t_0 <= -2e-8) or not (t_0 <= 1e-262): tmp = t_0 else: tmp = (-0.5 * (math.sin(x) * (eps * eps))) + (eps * math.cos(x)) return tmp
function code(x, eps) t_0 = Float64(sin(Float64(eps + x)) - sin(x)) tmp = 0.0 if ((t_0 <= -2e-8) || !(t_0 <= 1e-262)) tmp = t_0; else tmp = Float64(Float64(-0.5 * Float64(sin(x) * Float64(eps * eps))) + Float64(eps * cos(x))); end return tmp end
function tmp_2 = code(x, eps) t_0 = sin((eps + x)) - sin(x); tmp = 0.0; if ((t_0 <= -2e-8) || ~((t_0 <= 1e-262))) tmp = t_0; else tmp = (-0.5 * (sin(x) * (eps * eps))) + (eps * cos(x)); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Sin[N[(eps + x), $MachinePrecision]], $MachinePrecision] - N[Sin[x], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e-8], N[Not[LessEqual[t$95$0, 1e-262]], $MachinePrecision]], t$95$0, N[(N[(-0.5 * N[(N[Sin[x], $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\varepsilon + x\right) - \sin x\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{-8} \lor \neg \left(t_0 \leq 10^{-262}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(\sin x \cdot \left(\varepsilon \cdot \varepsilon\right)\right) + \varepsilon \cdot \cos x\\
\end{array}
\end{array}
if (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) < -2e-8 or 1.00000000000000001e-262 < (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) Initial program 73.4%
if -2e-8 < (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) < 1.00000000000000001e-262Initial program 18.6%
Taylor expanded in eps around 0 79.7%
unpow279.7%
Applied egg-rr79.7%
Final simplification76.9%
(FPCore (x eps) :precision binary64 (let* ((t_0 (- (sin (+ eps x)) (sin x)))) (if (or (<= t_0 -2e-8) (not (<= t_0 1e-262))) t_0 (* eps (cos x)))))
double code(double x, double eps) {
double t_0 = sin((eps + x)) - sin(x);
double tmp;
if ((t_0 <= -2e-8) || !(t_0 <= 1e-262)) {
tmp = t_0;
} else {
tmp = eps * cos(x);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = sin((eps + x)) - sin(x)
if ((t_0 <= (-2d-8)) .or. (.not. (t_0 <= 1d-262))) then
tmp = t_0
else
tmp = eps * cos(x)
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.sin((eps + x)) - Math.sin(x);
double tmp;
if ((t_0 <= -2e-8) || !(t_0 <= 1e-262)) {
tmp = t_0;
} else {
tmp = eps * Math.cos(x);
}
return tmp;
}
def code(x, eps): t_0 = math.sin((eps + x)) - math.sin(x) tmp = 0 if (t_0 <= -2e-8) or not (t_0 <= 1e-262): tmp = t_0 else: tmp = eps * math.cos(x) return tmp
function code(x, eps) t_0 = Float64(sin(Float64(eps + x)) - sin(x)) tmp = 0.0 if ((t_0 <= -2e-8) || !(t_0 <= 1e-262)) tmp = t_0; else tmp = Float64(eps * cos(x)); end return tmp end
function tmp_2 = code(x, eps) t_0 = sin((eps + x)) - sin(x); tmp = 0.0; if ((t_0 <= -2e-8) || ~((t_0 <= 1e-262))) tmp = t_0; else tmp = eps * cos(x); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Sin[N[(eps + x), $MachinePrecision]], $MachinePrecision] - N[Sin[x], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e-8], N[Not[LessEqual[t$95$0, 1e-262]], $MachinePrecision]], t$95$0, N[(eps * N[Cos[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\varepsilon + x\right) - \sin x\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{-8} \lor \neg \left(t_0 \leq 10^{-262}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \cos x\\
\end{array}
\end{array}
if (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) < -2e-8 or 1.00000000000000001e-262 < (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) Initial program 73.4%
if -2e-8 < (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) < 1.00000000000000001e-262Initial program 18.6%
Taylor expanded in eps around 0 79.6%
Final simplification76.8%
(FPCore (x eps) :precision binary64 (fma (+ (cos eps) -1.0) (sin x) (* (sin eps) (cos x))))
double code(double x, double eps) {
return fma((cos(eps) + -1.0), sin(x), (sin(eps) * cos(x)));
}
function code(x, eps) return fma(Float64(cos(eps) + -1.0), sin(x), Float64(sin(eps) * cos(x))) end
code[x_, eps_] := N[(N[(N[Cos[eps], $MachinePrecision] + -1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision] + N[(N[Sin[eps], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \varepsilon + -1, \sin x, \sin \varepsilon \cdot \cos x\right)
\end{array}
Initial program 43.0%
sin-sum65.9%
associate--l+65.9%
Applied egg-rr65.9%
+-commutative65.9%
associate-+l-99.7%
*-commutative99.7%
*-rgt-identity99.7%
distribute-lft-out--99.7%
Simplified99.7%
Taylor expanded in eps around inf 99.7%
fma-neg99.7%
distribute-rgt-neg-in99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
*-commutative99.7%
fma-def99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x eps) :precision binary64 (+ (* (sin eps) (cos x)) (* (sin x) (+ (cos eps) -1.0))))
double code(double x, double eps) {
return (sin(eps) * cos(x)) + (sin(x) * (cos(eps) + -1.0));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (sin(eps) * cos(x)) + (sin(x) * (cos(eps) + (-1.0d0)))
end function
public static double code(double x, double eps) {
return (Math.sin(eps) * Math.cos(x)) + (Math.sin(x) * (Math.cos(eps) + -1.0));
}
def code(x, eps): return (math.sin(eps) * math.cos(x)) + (math.sin(x) * (math.cos(eps) + -1.0))
function code(x, eps) return Float64(Float64(sin(eps) * cos(x)) + Float64(sin(x) * Float64(cos(eps) + -1.0))) end
function tmp = code(x, eps) tmp = (sin(eps) * cos(x)) + (sin(x) * (cos(eps) + -1.0)); end
code[x_, eps_] := N[(N[(N[Sin[eps], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * N[(N[Cos[eps], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin \varepsilon \cdot \cos x + \sin x \cdot \left(\cos \varepsilon + -1\right)
\end{array}
Initial program 43.0%
sin-sum65.9%
associate--l+65.9%
Applied egg-rr65.9%
+-commutative65.9%
associate-+l-99.7%
*-commutative99.7%
*-rgt-identity99.7%
distribute-lft-out--99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x eps) :precision binary64 (* 2.0 (* (sin (* eps 0.5)) (cos (* 0.5 (+ eps (* x 2.0)))))))
double code(double x, double eps) {
return 2.0 * (sin((eps * 0.5)) * cos((0.5 * (eps + (x * 2.0)))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 2.0d0 * (sin((eps * 0.5d0)) * cos((0.5d0 * (eps + (x * 2.0d0)))))
end function
public static double code(double x, double eps) {
return 2.0 * (Math.sin((eps * 0.5)) * Math.cos((0.5 * (eps + (x * 2.0)))));
}
def code(x, eps): return 2.0 * (math.sin((eps * 0.5)) * math.cos((0.5 * (eps + (x * 2.0)))))
function code(x, eps) return Float64(2.0 * Float64(sin(Float64(eps * 0.5)) * cos(Float64(0.5 * Float64(eps + Float64(x * 2.0)))))) end
function tmp = code(x, eps) tmp = 2.0 * (sin((eps * 0.5)) * cos((0.5 * (eps + (x * 2.0))))); end
code[x_, eps_] := N[(2.0 * N[(N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * N[(eps + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\sin \left(\varepsilon \cdot 0.5\right) \cdot \cos \left(0.5 \cdot \left(\varepsilon + x \cdot 2\right)\right)\right)
\end{array}
Initial program 43.0%
add-sqr-sqrt20.7%
sqrt-unprod19.8%
pow219.8%
Applied egg-rr19.8%
sqrt-pow143.0%
diff-sin42.6%
metadata-eval42.6%
pow142.6%
div-inv42.6%
+-commutative42.6%
associate--l+77.0%
metadata-eval77.0%
div-inv77.0%
+-commutative77.0%
associate-+l+77.0%
metadata-eval77.0%
Applied egg-rr77.0%
*-commutative77.0%
+-inverses77.0%
*-commutative77.0%
count-277.0%
Simplified77.0%
Final simplification77.0%
(FPCore (x eps) :precision binary64 (* (cos (/ (+ eps (* x 2.0)) 2.0)) (* 2.0 (sin (/ eps 2.0)))))
double code(double x, double eps) {
return cos(((eps + (x * 2.0)) / 2.0)) * (2.0 * sin((eps / 2.0)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = cos(((eps + (x * 2.0d0)) / 2.0d0)) * (2.0d0 * sin((eps / 2.0d0)))
end function
public static double code(double x, double eps) {
return Math.cos(((eps + (x * 2.0)) / 2.0)) * (2.0 * Math.sin((eps / 2.0)));
}
def code(x, eps): return math.cos(((eps + (x * 2.0)) / 2.0)) * (2.0 * math.sin((eps / 2.0)))
function code(x, eps) return Float64(cos(Float64(Float64(eps + Float64(x * 2.0)) / 2.0)) * Float64(2.0 * sin(Float64(eps / 2.0)))) end
function tmp = code(x, eps) tmp = cos(((eps + (x * 2.0)) / 2.0)) * (2.0 * sin((eps / 2.0))); end
code[x_, eps_] := N[(N[Cos[N[(N[(eps + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[Sin[N[(eps / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{\varepsilon + x \cdot 2}{2}\right) \cdot \left(2 \cdot \sin \left(\frac{\varepsilon}{2}\right)\right)
\end{array}
Initial program 43.0%
expm1-log1p-u42.9%
Applied egg-rr42.9%
expm1-log1p-u43.0%
diff-sin42.6%
+-commutative42.6%
+-commutative42.6%
Applied egg-rr42.6%
*-commutative42.6%
*-commutative42.6%
associate-*l*42.6%
associate-+l+42.6%
count-242.6%
associate--l+77.0%
+-inverses77.0%
Simplified77.0%
Final simplification77.0%
(FPCore (x eps) :precision binary64 (if (or (<= eps -0.006) (not (<= eps 1.45e-28))) (sin eps) (* eps (cos x))))
double code(double x, double eps) {
double tmp;
if ((eps <= -0.006) || !(eps <= 1.45e-28)) {
tmp = sin(eps);
} else {
tmp = eps * cos(x);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-0.006d0)) .or. (.not. (eps <= 1.45d-28))) then
tmp = sin(eps)
else
tmp = eps * cos(x)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -0.006) || !(eps <= 1.45e-28)) {
tmp = Math.sin(eps);
} else {
tmp = eps * Math.cos(x);
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -0.006) or not (eps <= 1.45e-28): tmp = math.sin(eps) else: tmp = eps * math.cos(x) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -0.006) || !(eps <= 1.45e-28)) tmp = sin(eps); else tmp = Float64(eps * cos(x)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -0.006) || ~((eps <= 1.45e-28))) tmp = sin(eps); else tmp = eps * cos(x); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -0.006], N[Not[LessEqual[eps, 1.45e-28]], $MachinePrecision]], N[Sin[eps], $MachinePrecision], N[(eps * N[Cos[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.006 \lor \neg \left(\varepsilon \leq 1.45 \cdot 10^{-28}\right):\\
\;\;\;\;\sin \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \cos x\\
\end{array}
\end{array}
if eps < -0.0060000000000000001 or 1.45000000000000006e-28 < eps Initial program 54.5%
Taylor expanded in x around 0 54.4%
if -0.0060000000000000001 < eps < 1.45000000000000006e-28Initial program 31.0%
Taylor expanded in eps around 0 99.1%
Final simplification76.4%
(FPCore (x eps) :precision binary64 (expm1 eps))
double code(double x, double eps) {
return expm1(eps);
}
public static double code(double x, double eps) {
return Math.expm1(eps);
}
def code(x, eps): return math.expm1(eps)
function code(x, eps) return expm1(eps) end
code[x_, eps_] := N[(Exp[eps] - 1), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{expm1}\left(\varepsilon\right)
\end{array}
Initial program 43.0%
add-sqr-sqrt20.7%
sqrt-unprod19.8%
pow219.8%
Applied egg-rr19.8%
Taylor expanded in x around 0 22.7%
sqrt-pow159.4%
metadata-eval59.4%
pow159.4%
expm1-log1p-u59.3%
Applied egg-rr59.3%
Taylor expanded in eps around 0 36.1%
Final simplification36.1%
(FPCore (x eps) :precision binary64 (sin eps))
double code(double x, double eps) {
return sin(eps);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = sin(eps)
end function
public static double code(double x, double eps) {
return Math.sin(eps);
}
def code(x, eps): return math.sin(eps)
function code(x, eps) return sin(eps) end
function tmp = code(x, eps) tmp = sin(eps); end
code[x_, eps_] := N[Sin[eps], $MachinePrecision]
\begin{array}{l}
\\
\sin \varepsilon
\end{array}
Initial program 43.0%
Taylor expanded in x around 0 59.4%
Final simplification59.4%
(FPCore (x eps) :precision binary64 eps)
double code(double x, double eps) {
return eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps
end function
public static double code(double x, double eps) {
return eps;
}
def code(x, eps): return eps
function code(x, eps) return eps end
function tmp = code(x, eps) tmp = eps; end
code[x_, eps_] := eps
\begin{array}{l}
\\
\varepsilon
\end{array}
Initial program 43.0%
add-sqr-sqrt20.7%
sqrt-unprod19.8%
pow219.8%
Applied egg-rr19.8%
Taylor expanded in x around 0 22.7%
Taylor expanded in eps around 0 35.1%
Final simplification35.1%
(FPCore (x eps) :precision binary64 (fma (sin x) (- (cos eps) 1.0) (* (sin eps) (cos x))))
double code(double x, double eps) {
return fma(sin(x), (cos(eps) - 1.0), (sin(eps) * cos(x)));
}
function code(x, eps) return fma(sin(x), Float64(cos(eps) - 1.0), Float64(sin(eps) * cos(x))) end
code[x_, eps_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Cos[eps], $MachinePrecision] - 1.0), $MachinePrecision] + N[(N[Sin[eps], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin x, \cos \varepsilon - 1, \sin \varepsilon \cdot \cos x\right)
\end{array}
herbie shell --seed 2023333
(FPCore (x eps)
:name "2sin (example 3.3)"
:precision binary64
:herbie-target
(fma (sin x) (- (cos eps) 1.0) (* (sin eps) (cos x)))
(- (sin (+ x eps)) (sin x)))