(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 (/ x (tan B))))
(if (<= F -68000000.0)
(- (fma 0.5 (/ (fma 2.0 x 2.0) (* (* F F) (sin B))) (/ -1.0 (sin B))) t_0)
(if (<= F 0.000115)
(- (/ F (/ (sin B) (pow (fma x 2.0 (fma F F 2.0)) -0.5))) t_0)
(- (/ 1.0 (sin B)) t_0)))))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 = x / tan(B);
double tmp;
if (F <= -68000000.0) {
tmp = fma(0.5, (fma(2.0, x, 2.0) / ((F * F) * sin(B))), (-1.0 / sin(B))) - t_0;
} else if (F <= 0.000115) {
tmp = (F / (sin(B) / pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5))) - t_0;
} else {
tmp = (1.0 / sin(B)) - t_0;
}
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(x / tan(B)) tmp = 0.0 if (F <= -68000000.0) tmp = Float64(fma(0.5, Float64(fma(2.0, x, 2.0) / Float64(Float64(F * F) * sin(B))), Float64(-1.0 / sin(B))) - t_0); elseif (F <= 0.000115) tmp = Float64(Float64(F / Float64(sin(B) / (fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5))) - t_0); else tmp = Float64(Float64(1.0 / sin(B)) - t_0); 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[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -68000000.0], N[(N[(0.5 * N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(N[(F * F), $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 0.000115], N[(N[(F / N[(N[Sin[B], $MachinePrecision] / N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $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 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -68000000:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(2, x, 2\right)}{\left(F \cdot F\right) \cdot \sin B}, \frac{-1}{\sin B}\right) - t_0\\
\mathbf{elif}\;F \leq 0.000115:\\
\;\;\;\;\frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}} - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t_0\\
\end{array}
if F < -6.8e7Initial program 24.8
Simplified19.3
Taylor expanded in F around -inf 0.2
Simplified0.2
if -6.8e7 < F < 1.15e-4Initial program 0.4
Simplified0.3
Applied egg-rr0.3
if 1.15e-4 < F Initial program 23.8
Simplified18.0
Taylor expanded in F around inf 1.1
Final simplification0.5
herbie shell --seed 2022202
(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))))))