?

Average Error: 0.2 → 0.2
Time: 12.5s
Precision: binary64
Cost: 13248

?

\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
\[\frac{1}{\sin B} - \frac{x}{\tan B} \]
(FPCore (B x)
 :precision binary64
 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
(FPCore (B x) :precision binary64 (- (/ 1.0 (sin B)) (/ x (tan B))))
double code(double B, double x) {
	return -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
double code(double B, double x) {
	return (1.0 / sin(B)) - (x / tan(B));
}
real(8) function code(b, x)
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end function
real(8) function code(b, x)
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = (1.0d0 / sin(b)) - (x / tan(b))
end function
public static double code(double B, double x) {
	return -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
public static double code(double B, double x) {
	return (1.0 / Math.sin(B)) - (x / Math.tan(B));
}
def code(B, x):
	return -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B))
def code(B, x):
	return (1.0 / math.sin(B)) - (x / math.tan(B))
function code(B, x)
	return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B)))
end
function code(B, x)
	return Float64(Float64(1.0 / sin(B)) - Float64(x / tan(B)))
end
function tmp = code(B, x)
	tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
end
function tmp = code(B, x)
	tmp = (1.0 / sin(B)) - (x / tan(B));
end
code[B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[B_, x_] := N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\frac{1}{\sin B} - \frac{x}{\tan B}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.2

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
  2. Simplified0.2

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    Proof

    [Start]0.2

    \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]

    +-commutative [=>]0.2

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

    unsub-neg [=>]0.2

    \[ \color{blue}{\frac{1}{\sin B} - x \cdot \frac{1}{\tan B}} \]

    associate-*r/ [=>]0.2

    \[ \frac{1}{\sin B} - \color{blue}{\frac{x \cdot 1}{\tan B}} \]

    *-rgt-identity [=>]0.2

    \[ \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
  3. Final simplification0.2

    \[\leadsto \frac{1}{\sin B} - \frac{x}{\tan B} \]

Alternatives

Alternative 1
Error1.0
Cost13384
\[\begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -1.66:\\ \;\;\;\;\frac{1}{B} - t_0\\ \mathbf{elif}\;x \leq 95000000:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\sin B - t_0\\ \end{array} \]
Alternative 2
Error1.1
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-7} \lor \neg \left(x \leq 0.00024\right):\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
Alternative 3
Error0.9
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -3.8 \lor \neg \left(x \leq 0.054\right):\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
Alternative 4
Error1.6
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -1.08 \lor \neg \left(x \leq 1.1\right):\\ \;\;\;\;1 - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
Alternative 5
Error18.7
Cost6857
\[\begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{-6} \lor \neg \left(x \leq 9.5 \cdot 10^{-5}\right):\\ \;\;\;\;B \cdot 0.16666666666666666 + \frac{1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
Alternative 6
Error32.7
Cost6728
\[\begin{array}{l} \mathbf{if}\;B \leq -1.5:\\ \;\;\;\;\sin B\\ \mathbf{elif}\;B \leq 850:\\ \;\;\;\;B \cdot 0.16666666666666666 + \left(\frac{1}{B} - \frac{x}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin B\\ \end{array} \]
Alternative 7
Error34.8
Cost836
\[\begin{array}{l} \mathbf{if}\;B \leq -14000:\\ \;\;\;\;1 - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;B \cdot 0.16666666666666666 + \left(\frac{1}{B} - \frac{x}{B}\right)\\ \end{array} \]
Alternative 8
Error34.8
Cost708
\[\begin{array}{l} \mathbf{if}\;B \leq -14000:\\ \;\;\;\;1 - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;B \cdot 0.16666666666666666 + \frac{1 - x}{B}\\ \end{array} \]
Alternative 9
Error36.4
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -7200000000 \lor \neg \left(x \leq 0.98\right):\\ \;\;\;\;1 - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \]
Alternative 10
Error34.9
Cost580
\[\begin{array}{l} \mathbf{if}\;B \leq -14000:\\ \;\;\;\;1 - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{B}\\ \end{array} \]
Alternative 11
Error36.4
Cost521
\[\begin{array}{l} \mathbf{if}\;x \leq -7200000000 \lor \neg \left(x \leq 1\right):\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \]
Alternative 12
Error34.9
Cost452
\[\begin{array}{l} \mathbf{if}\;B \leq -14000:\\ \;\;\;\;1 - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
Alternative 13
Error44.8
Cost192
\[\frac{1}{B} \]

Error

Reproduce?

herbie shell --seed 2023066 
(FPCore (B x)
  :name "VandenBroeck and Keller, Equation (24)"
  :precision binary64
  (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))