
(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 10 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 (- (* (sin eps) (cos x)) (/ (* (pow (sin eps) 2.0) (sin x)) (+ 1.0 (cos eps)))))
double code(double x, double eps) {
return (sin(eps) * cos(x)) - ((pow(sin(eps), 2.0) * sin(x)) / (1.0 + cos(eps)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (sin(eps) * cos(x)) - (((sin(eps) ** 2.0d0) * sin(x)) / (1.0d0 + cos(eps)))
end function
public static double code(double x, double eps) {
return (Math.sin(eps) * Math.cos(x)) - ((Math.pow(Math.sin(eps), 2.0) * Math.sin(x)) / (1.0 + Math.cos(eps)));
}
def code(x, eps): return (math.sin(eps) * math.cos(x)) - ((math.pow(math.sin(eps), 2.0) * math.sin(x)) / (1.0 + math.cos(eps)))
function code(x, eps) return Float64(Float64(sin(eps) * cos(x)) - Float64(Float64((sin(eps) ^ 2.0) * sin(x)) / Float64(1.0 + cos(eps)))) end
function tmp = code(x, eps) tmp = (sin(eps) * cos(x)) - (((sin(eps) ^ 2.0) * sin(x)) / (1.0 + cos(eps))); end
code[x_, eps_] := N[(N[(N[Sin[eps], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Power[N[Sin[eps], $MachinePrecision], 2.0], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[Cos[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin \varepsilon \cdot \cos x - \frac{{\sin \varepsilon}^{2} \cdot \sin x}{1 + \cos \varepsilon}
\end{array}
Initial program 39.0%
sin-sum66.1%
associate--l+66.2%
Applied egg-rr66.2%
+-commutative66.2%
associate-+l-99.2%
*-commutative99.2%
*-rgt-identity99.2%
distribute-lft-out--99.2%
Simplified99.2%
*-commutative99.2%
flip--99.1%
associate-*l/99.1%
metadata-eval99.1%
1-sub-cos99.3%
pow299.3%
Applied egg-rr99.3%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (sin (+ eps x)) (sin x))))
(if (<= t_0 -1e-7)
t_0
(if (<= t_0 0.0) (* (cos x) (* 2.0 (sin (* eps 0.5)))) (sin eps)))))
double code(double x, double eps) {
double t_0 = sin((eps + x)) - sin(x);
double tmp;
if (t_0 <= -1e-7) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = cos(x) * (2.0 * sin((eps * 0.5)));
} else {
tmp = sin(eps);
}
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 <= (-1d-7)) then
tmp = t_0
else if (t_0 <= 0.0d0) then
tmp = cos(x) * (2.0d0 * sin((eps * 0.5d0)))
else
tmp = sin(eps)
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 <= -1e-7) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = Math.cos(x) * (2.0 * Math.sin((eps * 0.5)));
} else {
tmp = Math.sin(eps);
}
return tmp;
}
def code(x, eps): t_0 = math.sin((eps + x)) - math.sin(x) tmp = 0 if t_0 <= -1e-7: tmp = t_0 elif t_0 <= 0.0: tmp = math.cos(x) * (2.0 * math.sin((eps * 0.5))) else: tmp = math.sin(eps) return tmp
function code(x, eps) t_0 = Float64(sin(Float64(eps + x)) - sin(x)) tmp = 0.0 if (t_0 <= -1e-7) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(cos(x) * Float64(2.0 * sin(Float64(eps * 0.5)))); else tmp = sin(eps); end return tmp end
function tmp_2 = code(x, eps) t_0 = sin((eps + x)) - sin(x); tmp = 0.0; if (t_0 <= -1e-7) tmp = t_0; elseif (t_0 <= 0.0) tmp = cos(x) * (2.0 * sin((eps * 0.5))); else tmp = sin(eps); 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[LessEqual[t$95$0, -1e-7], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[Cos[x], $MachinePrecision] * N[(2.0 * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[eps], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\varepsilon + x\right) - \sin x\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\cos x \cdot \left(2 \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \varepsilon\\
\end{array}
\end{array}
if (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) < -9.9999999999999995e-8Initial program 61.9%
if -9.9999999999999995e-8 < (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) < 0.0Initial program 13.9%
diff-sin13.9%
div-inv13.9%
associate--l+13.9%
metadata-eval13.9%
div-inv13.9%
+-commutative13.9%
associate-+l+13.9%
metadata-eval13.9%
Applied egg-rr13.9%
associate-*r*13.9%
*-commutative13.9%
*-commutative13.9%
+-commutative13.9%
count-213.9%
fma-def13.9%
sub-neg13.9%
mul-1-neg13.9%
+-commutative13.9%
associate-+r+77.5%
mul-1-neg77.5%
sub-neg77.5%
+-inverses77.5%
remove-double-neg77.5%
mul-1-neg77.5%
sub-neg77.5%
neg-sub077.5%
mul-1-neg77.5%
remove-double-neg77.5%
Simplified77.5%
Taylor expanded in eps around 0 77.5%
if 0.0 < (-.f64 (sin.f64 (+.f64 x eps)) (sin.f64 x)) Initial program 73.9%
Taylor expanded in x around 0 75.1%
Final simplification73.9%
(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}
Initial program 39.0%
add-sqr-sqrt21.9%
sqrt-unprod20.4%
pow220.4%
Applied egg-rr20.4%
sqrt-pow139.0%
metadata-eval39.0%
pow139.0%
sin-sum66.1%
associate--l+66.2%
+-commutative66.2%
*-commutative66.2%
*-commutative66.2%
Applied egg-rr66.2%
Taylor expanded in eps around inf 66.1%
+-commutative66.1%
*-commutative66.1%
associate--l+99.2%
unsub-neg99.2%
+-commutative99.2%
neg-mul-199.2%
distribute-rgt-out99.2%
metadata-eval99.2%
associate--r-99.2%
neg-sub099.2%
+-commutative99.2%
fma-def99.3%
neg-sub099.3%
associate--r-99.3%
metadata-eval99.3%
Simplified99.3%
Final simplification99.3%
(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 39.0%
sin-sum66.1%
associate--l+66.2%
Applied egg-rr66.2%
+-commutative66.2%
associate-+l-99.2%
*-commutative99.2%
*-rgt-identity99.2%
distribute-lft-out--99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x eps) :precision binary64 (fma (sin x) 0.0 (* (sin eps) (cos x))))
double code(double x, double eps) {
return fma(sin(x), 0.0, (sin(eps) * cos(x)));
}
function code(x, eps) return fma(sin(x), 0.0, Float64(sin(eps) * cos(x))) end
code[x_, eps_] := N[(N[Sin[x], $MachinePrecision] * 0.0 + N[(N[Sin[eps], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin x, 0, \sin \varepsilon \cdot \cos x\right)
\end{array}
Initial program 39.0%
add-sqr-sqrt21.9%
sqrt-unprod20.4%
pow220.4%
Applied egg-rr20.4%
sqrt-pow139.0%
metadata-eval39.0%
pow139.0%
sin-sum66.1%
associate--l+66.2%
+-commutative66.2%
*-commutative66.2%
*-commutative66.2%
Applied egg-rr66.2%
Taylor expanded in eps around inf 66.1%
+-commutative66.1%
*-commutative66.1%
associate--l+99.2%
unsub-neg99.2%
+-commutative99.2%
neg-mul-199.2%
distribute-rgt-out99.2%
metadata-eval99.2%
associate--r-99.2%
neg-sub099.2%
+-commutative99.2%
fma-def99.3%
neg-sub099.3%
associate--r-99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in eps around 0 74.8%
Final simplification74.8%
(FPCore (x eps) :precision binary64 (* 2.0 (* (cos (* 0.5 (+ eps (* x 2.0)))) (sin (* eps 0.5)))))
double code(double x, double eps) {
return 2.0 * (cos((0.5 * (eps + (x * 2.0)))) * sin((eps * 0.5)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 2.0d0 * (cos((0.5d0 * (eps + (x * 2.0d0)))) * sin((eps * 0.5d0)))
end function
public static double code(double x, double eps) {
return 2.0 * (Math.cos((0.5 * (eps + (x * 2.0)))) * Math.sin((eps * 0.5)));
}
def code(x, eps): return 2.0 * (math.cos((0.5 * (eps + (x * 2.0)))) * math.sin((eps * 0.5)))
function code(x, eps) return Float64(2.0 * Float64(cos(Float64(0.5 * Float64(eps + Float64(x * 2.0)))) * sin(Float64(eps * 0.5)))) end
function tmp = code(x, eps) tmp = 2.0 * (cos((0.5 * (eps + (x * 2.0)))) * sin((eps * 0.5))); end
code[x_, eps_] := N[(2.0 * N[(N[Cos[N[(0.5 * N[(eps + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\cos \left(0.5 \cdot \left(\varepsilon + x \cdot 2\right)\right) \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)
\end{array}
Initial program 39.0%
add-cube-cbrt38.3%
pow338.3%
Applied egg-rr38.3%
rem-cube-cbrt39.0%
diff-sin38.8%
div-inv38.8%
+-commutative38.8%
associate--l+73.4%
metadata-eval73.4%
div-inv73.4%
+-commutative73.4%
associate-+l+73.4%
metadata-eval73.4%
Applied egg-rr73.4%
*-commutative73.4%
+-inverses73.4%
*-commutative73.4%
count-273.4%
Simplified73.4%
Final simplification73.4%
(FPCore (x eps) :precision binary64 (if (or (<= x -0.5) (not (<= x 0.00095))) (* (cos x) (* 2.0 (sin (* eps 0.5)))) (+ (sin eps) (* x (+ (cos eps) -1.0)))))
double code(double x, double eps) {
double tmp;
if ((x <= -0.5) || !(x <= 0.00095)) {
tmp = cos(x) * (2.0 * sin((eps * 0.5)));
} else {
tmp = sin(eps) + (x * (cos(eps) + -1.0));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((x <= (-0.5d0)) .or. (.not. (x <= 0.00095d0))) then
tmp = cos(x) * (2.0d0 * sin((eps * 0.5d0)))
else
tmp = sin(eps) + (x * (cos(eps) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((x <= -0.5) || !(x <= 0.00095)) {
tmp = Math.cos(x) * (2.0 * Math.sin((eps * 0.5)));
} else {
tmp = Math.sin(eps) + (x * (Math.cos(eps) + -1.0));
}
return tmp;
}
def code(x, eps): tmp = 0 if (x <= -0.5) or not (x <= 0.00095): tmp = math.cos(x) * (2.0 * math.sin((eps * 0.5))) else: tmp = math.sin(eps) + (x * (math.cos(eps) + -1.0)) return tmp
function code(x, eps) tmp = 0.0 if ((x <= -0.5) || !(x <= 0.00095)) tmp = Float64(cos(x) * Float64(2.0 * sin(Float64(eps * 0.5)))); else tmp = Float64(sin(eps) + Float64(x * Float64(cos(eps) + -1.0))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((x <= -0.5) || ~((x <= 0.00095))) tmp = cos(x) * (2.0 * sin((eps * 0.5))); else tmp = sin(eps) + (x * (cos(eps) + -1.0)); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[x, -0.5], N[Not[LessEqual[x, 0.00095]], $MachinePrecision]], N[(N[Cos[x], $MachinePrecision] * N[(2.0 * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[eps], $MachinePrecision] + N[(x * N[(N[Cos[eps], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5 \lor \neg \left(x \leq 0.00095\right):\\
\;\;\;\;\cos x \cdot \left(2 \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \varepsilon + x \cdot \left(\cos \varepsilon + -1\right)\\
\end{array}
\end{array}
if x < -0.5 or 9.49999999999999998e-4 < x Initial program 6.4%
diff-sin6.4%
div-inv6.4%
associate--l+6.4%
metadata-eval6.4%
div-inv6.4%
+-commutative6.4%
associate-+l+6.2%
metadata-eval6.2%
Applied egg-rr6.2%
associate-*r*6.2%
*-commutative6.2%
*-commutative6.2%
+-commutative6.2%
count-26.2%
fma-def6.2%
sub-neg6.2%
mul-1-neg6.2%
+-commutative6.2%
associate-+r+53.6%
mul-1-neg53.6%
sub-neg53.6%
+-inverses53.6%
remove-double-neg53.6%
mul-1-neg53.6%
sub-neg53.6%
neg-sub053.6%
mul-1-neg53.6%
remove-double-neg53.6%
Simplified53.6%
Taylor expanded in eps around 0 53.8%
if -0.5 < x < 9.49999999999999998e-4Initial program 79.6%
Taylor expanded in x around 0 99.1%
Final simplification74.0%
(FPCore (x eps) :precision binary64 (if (or (<= eps -1.1e-7) (not (<= eps 1.5e-5))) (sin eps) (* eps (cos x))))
double code(double x, double eps) {
double tmp;
if ((eps <= -1.1e-7) || !(eps <= 1.5e-5)) {
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 <= (-1.1d-7)) .or. (.not. (eps <= 1.5d-5))) 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 <= -1.1e-7) || !(eps <= 1.5e-5)) {
tmp = Math.sin(eps);
} else {
tmp = eps * Math.cos(x);
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -1.1e-7) or not (eps <= 1.5e-5): tmp = math.sin(eps) else: tmp = eps * math.cos(x) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -1.1e-7) || !(eps <= 1.5e-5)) tmp = sin(eps); else tmp = Float64(eps * cos(x)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -1.1e-7) || ~((eps <= 1.5e-5))) tmp = sin(eps); else tmp = eps * cos(x); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -1.1e-7], N[Not[LessEqual[eps, 1.5e-5]], $MachinePrecision]], N[Sin[eps], $MachinePrecision], N[(eps * N[Cos[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1.1 \cdot 10^{-7} \lor \neg \left(\varepsilon \leq 1.5 \cdot 10^{-5}\right):\\
\;\;\;\;\sin \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \cos x\\
\end{array}
\end{array}
if eps < -1.1000000000000001e-7 or 1.50000000000000004e-5 < eps Initial program 49.8%
Taylor expanded in x around 0 51.6%
if -1.1000000000000001e-7 < eps < 1.50000000000000004e-5Initial program 26.4%
Taylor expanded in eps around 0 99.1%
Final simplification73.5%
(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 39.0%
Taylor expanded in x around 0 50.3%
Final simplification50.3%
(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 39.0%
Taylor expanded in eps around 0 47.9%
Taylor expanded in x around 0 24.6%
Final simplification24.6%
(FPCore (x eps) :precision binary64 (fma (cos x) (sin eps) (* (sin x) (- (cos eps) 1.0))))
double code(double x, double eps) {
return fma(cos(x), sin(eps), (sin(x) * (cos(eps) - 1.0)));
}
function code(x, eps) return fma(cos(x), sin(eps), Float64(sin(x) * Float64(cos(eps) - 1.0))) end
code[x_, eps_] := N[(N[Cos[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * N[(N[Cos[eps], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos x, \sin \varepsilon, \sin x \cdot \left(\cos \varepsilon - 1\right)\right)
\end{array}
herbie shell --seed 2023332
(FPCore (x eps)
:name "2sin (example 3.3)"
:precision binary64
:herbie-target
(fma (cos x) (sin eps) (* (sin x) (- (cos eps) 1.0)))
(- (sin (+ x eps)) (sin x)))