(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* 0.5 K))))
(fma
J
(+
(* 0.016666666666666666 (* (pow l 5.0) t_0))
(+
(* 0.0003968253968253968 (* t_0 (pow l 7.0)))
(+ (* 0.3333333333333333 (* t_0 (pow l 3.0))) (* 2.0 (* l t_0)))))
U)))double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
double code(double J, double l, double K, double U) {
double t_0 = cos((0.5 * K));
return fma(J, ((0.016666666666666666 * (pow(l, 5.0) * t_0)) + ((0.0003968253968253968 * (t_0 * pow(l, 7.0))) + ((0.3333333333333333 * (t_0 * pow(l, 3.0))) + (2.0 * (l * t_0))))), U);
}
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function code(J, l, K, U) t_0 = cos(Float64(0.5 * K)) return fma(J, Float64(Float64(0.016666666666666666 * Float64((l ^ 5.0) * t_0)) + Float64(Float64(0.0003968253968253968 * Float64(t_0 * (l ^ 7.0))) + Float64(Float64(0.3333333333333333 * Float64(t_0 * (l ^ 3.0))) + Float64(2.0 * Float64(l * t_0))))), U) end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, N[(J * N[(N[(0.016666666666666666 * N[(N[Power[l, 5.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(0.0003968253968253968 * N[(t$95$0 * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(t$95$0 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right)\\
\mathsf{fma}\left(J, 0.016666666666666666 \cdot \left({\ell}^{5} \cdot t_0\right) + \left(0.0003968253968253968 \cdot \left(t_0 \cdot {\ell}^{7}\right) + \left(0.3333333333333333 \cdot \left(t_0 \cdot {\ell}^{3}\right) + 2 \cdot \left(\ell \cdot t_0\right)\right)\right), U\right)
\end{array}



Bits error versus J



Bits error versus l



Bits error versus K



Bits error versus U
Initial program 17.2
Simplified17.2
Taylor expanded in l around 0 0.3
Final simplification0.3
herbie shell --seed 2022162
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))