\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)}\begin{array}{l}
\mathbf{if}\;F \leq -4.172578609705223 \cdot 10^{+24}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 7311478.62933065:\\
\;\;\;\;F \cdot \frac{1}{\frac{\sin B}{{\left(x \cdot 2 + \left(2 + F \cdot F\right)\right)}^{-0.5}}} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sin B} - \left(\frac{x}{\sin B \cdot {F}^{2}} + \frac{1}{\sin B \cdot {F}^{2}}\right)\right) - \frac{x}{\tan B}\\
\end{array}(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
(FPCore (F B x)
:precision binary64
(if (<= F -4.172578609705223e+24)
(- (/ -1.0 (sin B)) (/ x (tan B)))
(if (<= F 7311478.62933065)
(-
(* F (/ 1.0 (/ (sin B) (pow (+ (* x 2.0) (+ 2.0 (* F F))) -0.5))))
(/ x (tan B)))
(-
(-
(/ 1.0 (sin B))
(+ (/ x (* (sin B) (pow F 2.0))) (/ 1.0 (* (sin B) (pow F 2.0)))))
(/ x (tan B))))))double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
double code(double F, double B, double x) {
double tmp;
if (F <= -4.172578609705223e+24) {
tmp = (-1.0 / sin(B)) - (x / tan(B));
} else if (F <= 7311478.62933065) {
tmp = (F * (1.0 / (sin(B) / pow(((x * 2.0) + (2.0 + (F * F))), -0.5)))) - (x / tan(B));
} else {
tmp = ((1.0 / sin(B)) - ((x / (sin(B) * pow(F, 2.0))) + (1.0 / (sin(B) * pow(F, 2.0))))) - (x / tan(B));
}
return tmp;
}



Bits error versus F



Bits error versus B



Bits error versus x
Results
if F < -4.1725786097052228e24Initial program 27.0
Simplified27.0
Taylor expanded around -inf 0.2
if -4.1725786097052228e24 < F < 7311478.62933065Initial program 0.4
Simplified0.3
rmApplied div-inv_binary640.3
Applied associate-*l*_binary640.3
Simplified0.3
rmApplied clear-num_binary640.3
if 7311478.62933065 < F Initial program 25.9
Simplified25.9
Taylor expanded around inf 0.2
Final simplification0.2
herbie shell --seed 2021059
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))