Average Error: 0.2 → 0.2
Time: 11.3s
Precision: binary64
Cost: 19584
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
\[{\sin B}^{-1} - \frac{x}{\tan B} \]
(FPCore (B x)
 :precision binary64
 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
(FPCore (B x) :precision binary64 (- (pow (sin B) -1.0) (/ 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 pow(sin(B), -1.0) - (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 = (sin(b) ** (-1.0d0)) - (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 Math.pow(Math.sin(B), -1.0) - (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 math.pow(math.sin(B), -1.0) - (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((sin(B) ^ -1.0) - 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 = (sin(B) ^ -1.0) - (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[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
{\sin B}^{-1} - \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
    (-.f64 (/.f64 1 (sin.f64 B)) (/.f64 x (tan.f64 B))): 0 points increase in error, 0 points decrease in error
    (-.f64 (/.f64 1 (sin.f64 B)) (/.f64 (Rewrite<= *-rgt-identity_binary64 (*.f64 x 1)) (tan.f64 B))): 0 points increase in error, 0 points decrease in error
    (-.f64 (/.f64 1 (sin.f64 B)) (Rewrite<= associate-*r/_binary64 (*.f64 x (/.f64 1 (tan.f64 B))))): 32 points increase in error, 6 points decrease in error
    (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 1 (sin.f64 B)) (neg.f64 (*.f64 x (/.f64 1 (tan.f64 B)))))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 (*.f64 x (/.f64 1 (tan.f64 B)))) (/.f64 1 (sin.f64 B)))): 0 points increase in error, 0 points decrease in error
  3. Applied egg-rr0.2

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

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

Alternatives

Alternative 1
Error1.3
Cost13448
\[\begin{array}{l} t_0 := \frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -2496.6943410533304:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.3157180201846665 \cdot 10^{-20}:\\ \;\;\;\;{\sin B}^{-1} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.2
Cost13248
\[\frac{1 - x \cdot \cos B}{\sin B} \]
Alternative 3
Error0.2
Cost13248
\[\frac{1}{\sin B} - \frac{x}{\tan B} \]
Alternative 4
Error0.9
Cost7240
\[\begin{array}{l} t_0 := \frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -2496.6943410533304:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.1953353148812451:\\ \;\;\;\;\frac{1}{\sin B} + x \cdot \frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error0.9
Cost7112
\[\begin{array}{l} t_0 := \frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -2496.6943410533304:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.1953353148812451:\\ \;\;\;\;\frac{1 - x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error1.3
Cost7112
\[\begin{array}{l} t_0 := \frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -2496.6943410533304:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.3157180201846665 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error19.6
Cost6856
\[\begin{array}{l} t_0 := \left(\frac{1}{B} + B \cdot 0.16666666666666666\right) - \frac{x}{B}\\ \mathbf{if}\;x \leq -9.863705822434112 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.3157180201846665 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error17.0
Cost6720
\[\frac{1 - x}{\sin B} \]
Alternative 9
Error35.6
Cost704
\[\left(\frac{1}{B} + B \cdot 0.16666666666666666\right) - \frac{x}{B} \]
Alternative 10
Error37.0
Cost520
\[\begin{array}{l} t_0 := \frac{-x}{B}\\ \mathbf{if}\;x \leq -9.863705822434112 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.1953353148812451:\\ \;\;\;\;\frac{1}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Error35.8
Cost320
\[\frac{1 - x}{B} \]
Alternative 12
Error44.7
Cost192
\[\frac{1}{B} \]

Error

Reproduce

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