(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
(let* ((t_0 (* (sin B) (pow F 2.0))) (t_1 (/ x (tan B))))
(if (<= F -1.0847063455858735e+151)
(- (/ -1.0 (sin B)) (* (/ x (sin B)) (cos B)))
(if (<= F 31465108.153329495)
(- (/ (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (- F)) (- (sin B))) t_1)
(- (- (/ 1.0 (sin B)) (+ (/ x t_0) (/ 1.0 t_0))) t_1)))))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 t_0 = sin(B) * pow(F, 2.0);
double t_1 = x / tan(B);
double tmp;
if (F <= -1.0847063455858735e+151) {
tmp = (-1.0 / sin(B)) - ((x / sin(B)) * cos(B));
} else if (F <= 31465108.153329495) {
tmp = ((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * -F) / -sin(B)) - t_1;
} else {
tmp = ((1.0 / sin(B)) - ((x / t_0) + (1.0 / t_0))) - t_1;
}
return tmp;
}
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function code(F, B, x) t_0 = Float64(sin(B) * (F ^ 2.0)) t_1 = Float64(x / tan(B)) tmp = 0.0 if (F <= -1.0847063455858735e+151) tmp = Float64(Float64(-1.0 / sin(B)) - Float64(Float64(x / sin(B)) * cos(B))); elseif (F <= 31465108.153329495) tmp = Float64(Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(-F)) / Float64(-sin(B))) - t_1); else tmp = Float64(Float64(Float64(1.0 / sin(B)) - Float64(Float64(x / t_0) + Float64(1.0 / t_0))) - t_1); end return tmp end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Sin[B], $MachinePrecision] * N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.0847063455858735e+151], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 31465108.153329495], N[(N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * (-F)), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(N[(x / t$95$0), $MachinePrecision] + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\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}
t_0 := \sin B \cdot {F}^{2}\\
t_1 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1.0847063455858735 \cdot 10^{+151}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\sin B} \cdot \cos B\\
\mathbf{elif}\;F \leq 31465108.153329495:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \left(-F\right)}{-\sin B} - t_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sin B} - \left(\frac{x}{t_0} + \frac{1}{t_0}\right)\right) - t_1\\
\end{array}



Bits error versus F



Bits error versus B



Bits error versus x
if F < -1.08470634558587346e151Initial program 41.1
Simplified41.1
Applied egg-rr41.1
Taylor expanded in F around -inf 0.2
if -1.08470634558587346e151 < F < 31465108.1533294953Initial program 1.8
Simplified1.8
Applied egg-rr0.3
if 31465108.1533294953 < F Initial program 25.5
Simplified25.4
Taylor expanded in F around inf 0.1
Final simplification0.2
herbie shell --seed 2022133
(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))))))