\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
t_2 := \sqrt{\cos t_1}\\
\left|\mathsf{fma}\left(ew \cdot \sin t, t_2 \cdot t_2, \left(eh \cdot \cos t\right) \cdot \sin t_1\right)\right|
\end{array}
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t)))) (t_2 (sqrt (cos t_1)))) (fabs (fma (* ew (sin t)) (* t_2 t_2) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) * cos(atan((eh / ew) / tan(t)))) + ((eh * cos(t)) * sin(atan((eh / ew) / tan(t)))));
}
double code(double eh, double ew, double t) {
double t_1 = atan((eh / ew) / tan(t));
double t_2 = sqrt(cos(t_1));
return fabs(fma((ew * sin(t)), (t_2 * t_2), ((eh * cos(t)) * sin(t_1))));
}



Bits error versus eh



Bits error versus ew



Bits error versus t
Initial program 0.1
Simplified0.1
Applied add-sqr-sqrt_binary640.1
Final simplification0.1
herbie shell --seed 2022068
(FPCore (eh ew t)
:name "Example from Robby"
:precision binary64
(fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))