Average Error: 17.7 → 0.3
Time: 8.0s
Precision: binary64
\[\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)\\ \left(0.016666666666666666 \cdot \left({\ell}^{5} \cdot t_0\right) + \left(0.3333333333333333 \cdot \left(t_0 \cdot {\ell}^{3}\right) + 2 \cdot \left(\ell \cdot t_0\right)\right)\right) \cdot J + U \end{array} \]
\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)\\
\left(0.016666666666666666 \cdot \left({\ell}^{5} \cdot t_0\right) + \left(0.3333333333333333 \cdot \left(t_0 \cdot {\ell}^{3}\right) + 2 \cdot \left(\ell \cdot t_0\right)\right)\right) \cdot J + U
\end{array}
(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))))
   (+
    (*
     (+
      (* 0.016666666666666666 (* (pow l 5.0) t_0))
      (+ (* 0.3333333333333333 (* t_0 (pow l 3.0))) (* 2.0 (* l t_0))))
     J)
    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 (((0.016666666666666666 * (pow(l, 5.0) * t_0)) + ((0.3333333333333333 * (t_0 * pow(l, 3.0))) + (2.0 * (l * t_0)))) * J) + U;
}

Error

Bits error versus J

Bits error versus l

Bits error versus K

Bits error versus U

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 17.7

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

    \[\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.1

    \[\leadsto \mathsf{fma}\left(J \cdot \color{blue}{\left(2 \cdot \sinh \ell\right)}, \cos \left(\frac{K}{2}\right), U\right) \]
  4. Taylor expanded in l around 0 0.3

    \[\leadsto \color{blue}{0.016666666666666666 \cdot \left({\ell}^{5} \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right)\right) + \left(0.3333333333333333 \cdot \left({\ell}^{3} \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right)\right) + \left(2 \cdot \left(\ell \cdot \left(\cos \left(0.5 \cdot K\right) \cdot J\right)\right) + U\right)\right)} \]
  5. Simplified0.3

    \[\leadsto \color{blue}{\left(J \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \left(0.016666666666666666 \cdot {\ell}^{5} + \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right)\right) + U} \]
  6. Taylor expanded in J around 0 0.3

    \[\leadsto \color{blue}{\left(0.016666666666666666 \cdot \left({\ell}^{5} \cdot \cos \left(0.5 \cdot K\right)\right) + \left(0.3333333333333333 \cdot \left({\ell}^{3} \cdot \cos \left(0.5 \cdot K\right)\right) + 2 \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\right) \cdot J} + U \]
  7. Final simplification0.3

    \[\leadsto \left(0.016666666666666666 \cdot \left({\ell}^{5} \cdot \cos \left(0.5 \cdot K\right)\right) + \left(0.3333333333333333 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot {\ell}^{3}\right) + 2 \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\right) \cdot J + U \]

Reproduce

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