Average Error: 13.9 → 10.9
Time: 36.5s
Precision: 64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
\[\frac{1}{\frac{\sin B}{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}} - \frac{x}{\tan B}\]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\frac{1}{\frac{\sin B}{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}} - \frac{x}{\tan B}
double f(double F, double B, double x) {
        double r1414650 = x;
        double r1414651 = 1.0;
        double r1414652 = B;
        double r1414653 = tan(r1414652);
        double r1414654 = r1414651 / r1414653;
        double r1414655 = r1414650 * r1414654;
        double r1414656 = -r1414655;
        double r1414657 = F;
        double r1414658 = sin(r1414652);
        double r1414659 = r1414657 / r1414658;
        double r1414660 = r1414657 * r1414657;
        double r1414661 = 2.0;
        double r1414662 = r1414660 + r1414661;
        double r1414663 = r1414661 * r1414650;
        double r1414664 = r1414662 + r1414663;
        double r1414665 = r1414651 / r1414661;
        double r1414666 = -r1414665;
        double r1414667 = pow(r1414664, r1414666);
        double r1414668 = r1414659 * r1414667;
        double r1414669 = r1414656 + r1414668;
        return r1414669;
}

double f(double F, double B, double x) {
        double r1414670 = 1.0;
        double r1414671 = B;
        double r1414672 = sin(r1414671);
        double r1414673 = F;
        double r1414674 = x;
        double r1414675 = 2.0;
        double r1414676 = fma(r1414673, r1414673, r1414675);
        double r1414677 = fma(r1414674, r1414675, r1414676);
        double r1414678 = sqrt(r1414677);
        double r1414679 = r1414673 / r1414678;
        double r1414680 = r1414672 / r1414679;
        double r1414681 = r1414670 / r1414680;
        double r1414682 = tan(r1414671);
        double r1414683 = r1414674 / r1414682;
        double r1414684 = r1414681 - r1414683;
        return r1414684;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Initial program 13.9

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
  2. Simplified13.8

    \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}}\]
  3. Using strategy rm
  4. Applied associate-*r/10.9

    \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}} \cdot F}{\sin B}} - \frac{x}{\tan B}\]
  5. Using strategy rm
  6. Applied log1p-expm1-u10.9

    \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\frac{-1}{2}} \cdot F\right)\right)}}{\sin B} - \frac{x}{\tan B}\]
  7. Using strategy rm
  8. Applied add-sqr-sqrt10.9

    \[\leadsto \frac{\mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}}^{\frac{-1}{2}} \cdot F\right)\right)}{\sin B} - \frac{x}{\tan B}\]
  9. Applied unpow-prod-down11.0

    \[\leadsto \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\left({\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}}\right)} \cdot F\right)\right)}{\sin B} - \frac{x}{\tan B}\]
  10. Using strategy rm
  11. Applied clear-num11.0

    \[\leadsto \color{blue}{\frac{1}{\frac{\sin B}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left({\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\frac{-1}{2}}\right) \cdot F\right)\right)}}} - \frac{x}{\tan B}\]
  12. Simplified10.9

    \[\leadsto \frac{1}{\color{blue}{\frac{\sin B}{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}}} - \frac{x}{\tan B}\]
  13. Final simplification10.9

    \[\leadsto \frac{1}{\frac{\sin B}{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}} - \frac{x}{\tan B}\]

Reproduce

herbie shell --seed 2019152 +o rules:numerics
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))