Average Error: 8.6 → 0.0
Time: 4.6s
Precision: binary64
\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
\[\mathsf{fma}\left(J \cdot \left(2 \cdot \sinh \ell\right), \cos \left(\frac{K}{2}\right), U\right) \]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\mathsf{fma}\left(J \cdot \left(2 \cdot \sinh \ell\right), \cos \left(\frac{K}{2}\right), U\right)
(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 (* 2.0 (sinh l))) (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 * (2.0 * sinh(l))), cos(K / 2.0), U);
}

Error

Bits error versus J

Bits error versus l

Bits error versus K

Bits error versus U

Derivation

  1. Initial program 8.6

    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  2. Simplified8.6

    \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \left(e^{\ell} - e^{-\ell}\right), \cos \left(\frac{K}{2}\right), U\right)} \]
  3. Applied sinh-undef_binary640.0

    \[\leadsto \mathsf{fma}\left(J \cdot \color{blue}{\left(2 \cdot \sinh \ell\right)}, \cos \left(\frac{K}{2}\right), U\right) \]
  4. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(J \cdot \left(2 \cdot \sinh \ell\right), \cos \left(\frac{K}{2}\right), U\right) \]

Reproduce

herbie shell --seed 2022067 
(FPCore (J l K U)
  :name "Maksimov and Kolovsky, Equation (4)"
  :precision binary64
  (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))