Average Error: 14.0 → 0.5
Time: 11.0s
Precision: 64
\[\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 \le -2.9768268976581668 \cdot 10^{119}:\\ \;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right)\\ \mathbf{elif}\;F \le 7.0203905594146349 \cdot 10^{-5}:\\ \;\;\;\;\left(-\left(1 \cdot \frac{x}{\sin B}\right) \cdot \cos B\right) + \frac{F}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B \cdot \left({\left(\frac{1}{F}\right)}^{-1} + 1 \cdot {\left(\frac{1}{{F}^{1}}\right)}^{1}\right)}\\ \end{array}\]
\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 \le -2.9768268976581668 \cdot 10^{119}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right)\\

\mathbf{elif}\;F \le 7.0203905594146349 \cdot 10^{-5}:\\
\;\;\;\;\left(-\left(1 \cdot \frac{x}{\sin B}\right) \cdot \cos B\right) + \frac{F}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\\

\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B \cdot \left({\left(\frac{1}{F}\right)}^{-1} + 1 \cdot {\left(\frac{1}{{F}^{1}}\right)}^{1}\right)}\\

\end{array}
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 temp;
	if ((F <= -2.9768268976581668e+119)) {
		temp = (-(x * (1.0 / tan(B))) + ((1.0 * (1.0 / (sin(B) * pow(F, 2.0)))) - (1.0 / sin(B))));
	} else {
		double temp_1;
		if ((F <= 7.020390559414635e-05)) {
			temp_1 = (-((1.0 * (x / sin(B))) * cos(B)) + (F / (sin(B) * pow((((F * F) + 2.0) + (2.0 * x)), (1.0 / 2.0)))));
		} else {
			temp_1 = (-(x * (1.0 / tan(B))) + (F / (sin(B) * (pow((1.0 / F), -1.0) + (1.0 * pow((1.0 / pow(F, 1.0)), 1.0))))));
		}
		temp = temp_1;
	}
	return temp;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if F < -2.9768268976581668e+119

    1. Initial program 37.2

      \[\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)}\]
    2. Taylor expanded around -inf 0.2

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right)}\]

    if -2.9768268976581668e+119 < F < 7.020390559414635e-05

    1. Initial program 1.1

      \[\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)}\]
    2. Using strategy rm
    3. Applied pow-neg1.1

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\frac{1}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}}\]
    4. Applied frac-times0.4

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot 1}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}}\]
    5. Simplified0.4

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{\color{blue}{F}}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\]
    6. Using strategy rm
    7. Applied tan-quot0.4

      \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\frac{\sin B}{\cos B}}}\right) + \frac{F}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\]
    8. Applied associate-/r/0.4

      \[\leadsto \left(-x \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \cos B\right)}\right) + \frac{F}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\]
    9. Applied associate-*r*0.4

      \[\leadsto \left(-\color{blue}{\left(x \cdot \frac{1}{\sin B}\right) \cdot \cos B}\right) + \frac{F}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\]
    10. Taylor expanded around inf 0.3

      \[\leadsto \left(-\color{blue}{\left(1 \cdot \frac{x}{\sin B}\right)} \cdot \cos B\right) + \frac{F}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\]

    if 7.020390559414635e-05 < F

    1. Initial program 25.3

      \[\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)}\]
    2. Using strategy rm
    3. Applied pow-neg25.3

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\frac{1}{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}}\]
    4. Applied frac-times19.8

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot 1}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}}\]
    5. Simplified19.8

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{\color{blue}{F}}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\]
    6. Taylor expanded around inf 0.9

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B \cdot \color{blue}{\left({\left(\frac{1}{F}\right)}^{-1} + 1 \cdot {\left(\frac{1}{{F}^{1}}\right)}^{1}\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -2.9768268976581668 \cdot 10^{119}:\\ \;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right)\\ \mathbf{elif}\;F \le 7.0203905594146349 \cdot 10^{-5}:\\ \;\;\;\;\left(-\left(1 \cdot \frac{x}{\sin B}\right) \cdot \cos B\right) + \frac{F}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B \cdot \left({\left(\frac{1}{F}\right)}^{-1} + 1 \cdot {\left(\frac{1}{{F}^{1}}\right)}^{1}\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020066 
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  :precision binary64
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))