Average Error: 0.2 → 0.2
Time: 8.5s
Precision: binary64
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
\[\mathsf{fma}\left(1, \frac{1}{\sin B}, \frac{-x}{\tan B}\right) \]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\mathsf{fma}\left(1, \frac{1}{\sin B}, \frac{-x}{\tan B}\right)
(FPCore (B x)
 :precision binary64
 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
(FPCore (B x) :precision binary64 (fma 1.0 (/ 1.0 (sin B)) (/ (- x) (tan B))))
double code(double B, double x) {
	return -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
double code(double B, double x) {
	return fma(1.0, (1.0 / sin(B)), (-x / tan(B)));
}

Error

Bits error versus B

Bits error versus x

Derivation

  1. Initial program 0.2

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

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
  3. Applied clear-num_binary640.2

    \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
  4. Applied *-un-lft-identity_binary640.2

    \[\leadsto \frac{1}{\color{blue}{1 \cdot \sin B}} - \frac{1}{\frac{\tan B}{x}} \]
  5. Applied add-cube-cbrt_binary640.2

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot \sin B} - \frac{1}{\frac{\tan B}{x}} \]
  6. Applied times-frac_binary640.2

    \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{\sin B}} - \frac{1}{\frac{\tan B}{x}} \]
  7. Applied fma-neg_binary640.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}, \frac{\sqrt[3]{1}}{\sin B}, -\frac{1}{\frac{\tan B}{x}}\right)} \]
  8. Simplified0.2

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

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

Reproduce

herbie shell --seed 2022088 
(FPCore (B x)
  :name "VandenBroeck and Keller, Equation (24)"
  :precision binary64
  (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))