Average Error: 15.9 → 8.2
Time: 40.2s
Precision: 64
Internal Precision: 128
\[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}\]
\[\begin{array}{l} \mathbf{if}\;U \le -4.8076397923551706 \cdot 10^{+224} \lor \neg \left(U \le 3.8733391839665026 \cdot 10^{+233}\right):\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;\left(\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot -2\right)\right) \cdot \sqrt{1^2 + \left(\frac{\frac{U}{2}}{\cos \left(\frac{K}{2}\right) \cdot J}\right)^2}^*\\ \end{array}\]

Error

Bits error versus J

Bits error versus K

Bits error versus U

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if U < -4.8076397923551706e+224 or 3.8733391839665026e+233 < U

    1. Initial program 38.8

      \[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}\]
    2. Initial simplification25.9

      \[\leadsto \sqrt{1^2 + \left(\frac{\frac{\frac{U}{2}}{J}}{\cos \left(\frac{K}{2}\right)}\right)^2}^* \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right)\]
    3. Using strategy rm
    4. Applied associate-/l/25.9

      \[\leadsto \sqrt{1^2 + \color{blue}{\left(\frac{\frac{U}{2}}{\cos \left(\frac{K}{2}\right) \cdot J}\right)}^2}^* \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right)\]
    5. Taylor expanded around -inf 34.3

      \[\leadsto \color{blue}{-1 \cdot U}\]
    6. Simplified34.3

      \[\leadsto \color{blue}{-U}\]

    if -4.8076397923551706e+224 < U < 3.8733391839665026e+233

    1. Initial program 12.6

      \[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}\]
    2. Initial simplification4.5

      \[\leadsto \sqrt{1^2 + \left(\frac{\frac{\frac{U}{2}}{J}}{\cos \left(\frac{K}{2}\right)}\right)^2}^* \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right)\]
    3. Using strategy rm
    4. Applied associate-/l/4.4

      \[\leadsto \sqrt{1^2 + \color{blue}{\left(\frac{\frac{U}{2}}{\cos \left(\frac{K}{2}\right) \cdot J}\right)}^2}^* \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;U \le -4.8076397923551706 \cdot 10^{+224} \lor \neg \left(U \le 3.8733391839665026 \cdot 10^{+233}\right):\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;\left(\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot -2\right)\right) \cdot \sqrt{1^2 + \left(\frac{\frac{U}{2}}{\cos \left(\frac{K}{2}\right) \cdot J}\right)^2}^*\\ \end{array}\]

Runtime

Time bar (total: 40.2s)Debug logProfile

herbie shell --seed 2018346 +o rules:numerics
(FPCore (J K U)
  :name "Maksimov and Kolovsky, Equation (3)"
  (* (* (* -2 J) (cos (/ K 2))) (sqrt (+ 1 (pow (/ U (* (* 2 J) (cos (/ K 2)))) 2)))))