(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
(FPCore (J l K U) :precision binary64 (fma J (* (fma 0.3333333333333333 (pow l 3.0) (* l 2.0)) (cos (/ K 2.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) {
return fma(J, (fma(0.3333333333333333, pow(l, 3.0), (l * 2.0)) * cos((K / 2.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) return fma(J, Float64(fma(0.3333333333333333, (l ^ 3.0), Float64(l * 2.0)) * cos(Float64(K / 2.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_] := N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\mathsf{fma}\left(J, \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(\frac{K}{2}\right), U\right)



Bits error versus J



Bits error versus l



Bits error versus K



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