Average Error: 13.4 → 10.5
Time: 40.2s
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 r1676049 = x;
        double r1676050 = 1.0;
        double r1676051 = B;
        double r1676052 = tan(r1676051);
        double r1676053 = r1676050 / r1676052;
        double r1676054 = r1676049 * r1676053;
        double r1676055 = -r1676054;
        double r1676056 = F;
        double r1676057 = sin(r1676051);
        double r1676058 = r1676056 / r1676057;
        double r1676059 = r1676056 * r1676056;
        double r1676060 = 2.0;
        double r1676061 = r1676059 + r1676060;
        double r1676062 = r1676060 * r1676049;
        double r1676063 = r1676061 + r1676062;
        double r1676064 = r1676050 / r1676060;
        double r1676065 = -r1676064;
        double r1676066 = pow(r1676063, r1676065);
        double r1676067 = r1676058 * r1676066;
        double r1676068 = r1676055 + r1676067;
        return r1676068;
}

double f(double F, double B, double x) {
        double r1676069 = 1.0;
        double r1676070 = B;
        double r1676071 = sin(r1676070);
        double r1676072 = F;
        double r1676073 = x;
        double r1676074 = 2.0;
        double r1676075 = fma(r1676072, r1676072, r1676074);
        double r1676076 = fma(r1676073, r1676074, r1676075);
        double r1676077 = sqrt(r1676076);
        double r1676078 = r1676072 / r1676077;
        double r1676079 = r1676071 / r1676078;
        double r1676080 = r1676069 / r1676079;
        double r1676081 = tan(r1676070);
        double r1676082 = r1676073 / r1676081;
        double r1676083 = r1676080 - r1676082;
        return r1676083;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Initial program 13.4

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

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

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

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

    \[\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-down10.6

    \[\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 *-un-lft-identity10.6

    \[\leadsto \frac{\color{blue}{1 \cdot \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)}}{\sin B} - \frac{x}{\tan B}\]
  12. Applied associate-/l*10.6

    \[\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}\]
  13. Simplified10.5

    \[\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}\]
  14. Final simplification10.5

    \[\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 2019135 +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))))))