Average Error: 0.2 → 0.1
Time: 9.8s
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.1

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

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

Alternatives

Alternative 1
Error0.2
Cost13248
\[\frac{1 - x \cdot \cos B}{\sin B} \]
Alternative 2
Error1.2
Cost7368
\[\begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -325395218955.4835:\\ \;\;\;\;\left(\frac{1}{B} + -1\right) - t_0\\ \mathbf{elif}\;x \leq 2.270773961100826 \cdot 10^{-6}:\\ \;\;\;\;\left(1 + \left(\frac{1}{\sin B} + -1\right)\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{1}{B}\right) - t_0\\ \end{array} \]
Alternative 3
Error1.2
Cost7240
\[\begin{array}{l} t_0 := \left(1 + \frac{1}{B}\right) - \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -5.513176502116257 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.270773961100826 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error1.2
Cost7112
\[\begin{array}{l} t_0 := \frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -5.513176502116257 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.270773961100826 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error18.4
Cost6856
\[\begin{array}{l} t_0 := \frac{1}{\sin B}\\ \mathbf{if}\;B \leq -132.77911918088685:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 3053064.9938613265:\\ \;\;\;\;\left(\frac{1}{B} + B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right)\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error35.2
Cost584
\[\begin{array}{l} t_0 := \frac{-x}{B}\\ \mathbf{if}\;x \leq -0.025087146657826402:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.687316653424116 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{B} + -1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error36.3
Cost520
\[\begin{array}{l} t_0 := \frac{-x}{B}\\ \mathbf{if}\;x \leq -0.025087146657826402:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.687316653424116 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error34.3
Cost448
\[-1 + \frac{1 - x}{B} \]
Alternative 9
Error35.6
Cost320
\[\frac{1 - x}{B} \]
Alternative 10
Error44.6
Cost192
\[\frac{1}{B} \]

Error

Reproduce

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