Average Error: 17.3 → 0.1
Time: 9.0s
Precision: binary64
\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
\[\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(2 \cdot \sinh \ell\right)\right) + U \]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(2 \cdot \sinh \ell\right)\right) + U
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
(FPCore (J l K U)
 :precision binary64
 (+ (* (cos (/ K 2.0)) (* J (* 2.0 (sinh l)))) 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 (cos(K / 2.0) * (J * (2.0 * sinh(l)))) + 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.3

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

    \[\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. Applied expm1-log1p-u_binary640.1

    \[\leadsto \mathsf{fma}\left(J \cdot \left(2 \cdot \sinh \ell\right), \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\frac{K}{2}\right)\right)\right)}, U\right) \]
  5. Applied fma-udef_binary640.1

    \[\leadsto \color{blue}{\left(J \cdot \left(2 \cdot \sinh \ell\right)\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\frac{K}{2}\right)\right)\right) + U} \]
  6. Simplified0.1

    \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(2 \cdot \sinh \ell\right)\right)} + U \]
  7. Final simplification0.1

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

Reproduce

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