
(FPCore (B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
double code(double B, double x) {
return -(x * (1.0 / tan(B))) + (1.0 / sin(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
public static double code(double B, double x) {
return -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
def code(B, x): return -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B))
function code(B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))) end
function tmp = code(B, x) tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(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]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
double code(double B, double x) {
return -(x * (1.0 / tan(B))) + (1.0 / sin(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
public static double code(double B, double x) {
return -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
def code(B, x): return -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B))
function code(B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))) end
function tmp = code(B, x) tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(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]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\end{array}
(FPCore (B x) :precision binary64 (- (/ 1.0 (sin B)) (/ x (tan 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 = (1.0d0 / sin(b)) - (x / tan(b))
end function
public static double code(double B, double x) {
return (1.0 / Math.sin(B)) - (x / Math.tan(B));
}
def code(B, x): return (1.0 / math.sin(B)) - (x / math.tan(B))
function code(B, x) return Float64(Float64(1.0 / sin(B)) - Float64(x / tan(B))) end
function tmp = code(B, x) tmp = (1.0 / sin(B)) - (x / tan(B)); end
code[B_, x_] := N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sin B} - \frac{x}{\tan B}
\end{array}
Initial program 99.7%
+-commutative99.7%
distribute-lft-neg-in99.7%
cancel-sign-sub99.7%
associate-*r/99.8%
remove-double-neg99.8%
associate-/l*99.8%
/-rgt-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (B x) :precision binary64 (if (or (<= x -250000.0) (not (<= x 1.0))) (- (/ 1.0 B) (/ x (tan B))) (* (/ 1.0 (- (sin B))) (+ x -1.0))))
double code(double B, double x) {
double tmp;
if ((x <= -250000.0) || !(x <= 1.0)) {
tmp = (1.0 / B) - (x / tan(B));
} else {
tmp = (1.0 / -sin(B)) * (x + -1.0);
}
return tmp;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-250000.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (1.0d0 / b) - (x / tan(b))
else
tmp = (1.0d0 / -sin(b)) * (x + (-1.0d0))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -250000.0) || !(x <= 1.0)) {
tmp = (1.0 / B) - (x / Math.tan(B));
} else {
tmp = (1.0 / -Math.sin(B)) * (x + -1.0);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -250000.0) or not (x <= 1.0): tmp = (1.0 / B) - (x / math.tan(B)) else: tmp = (1.0 / -math.sin(B)) * (x + -1.0) return tmp
function code(B, x) tmp = 0.0 if ((x <= -250000.0) || !(x <= 1.0)) tmp = Float64(Float64(1.0 / B) - Float64(x / tan(B))); else tmp = Float64(Float64(1.0 / Float64(-sin(B))) * Float64(x + -1.0)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -250000.0) || ~((x <= 1.0))) tmp = (1.0 / B) - (x / tan(B)); else tmp = (1.0 / -sin(B)) * (x + -1.0); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -250000.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / (-N[Sin[B], $MachinePrecision])), $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -250000 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-\sin B} \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if x < -2.5e5 or 1 < x Initial program 99.6%
+-commutative99.6%
distribute-lft-neg-in99.6%
cancel-sign-sub99.6%
associate-*r/99.9%
remove-double-neg99.9%
associate-/l*99.9%
/-rgt-identity99.9%
Simplified99.9%
Taylor expanded in B around 0 76.9%
Taylor expanded in B around 0 98.9%
if -2.5e5 < x < 1Initial program 99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
cancel-sign-sub99.8%
associate-*r/99.8%
remove-double-neg99.8%
associate-/l*99.8%
/-rgt-identity99.8%
Simplified99.8%
tan-quot99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in B around inf 99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in B around 0 98.2%
frac-2neg98.2%
clear-num98.2%
associate-/r/98.2%
neg-sub098.2%
associate--r-98.2%
metadata-eval98.2%
+-commutative98.2%
Applied egg-rr98.2%
Final simplification98.6%
(FPCore (B x) :precision binary64 (if (or (<= x -250000.0) (not (<= x 1.0))) (- (/ 1.0 B) (/ x (tan B))) (/ (- 1.0 x) (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -250000.0) || !(x <= 1.0)) {
tmp = (1.0 / B) - (x / tan(B));
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-250000.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (1.0d0 / b) - (x / tan(b))
else
tmp = (1.0d0 - x) / sin(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -250000.0) || !(x <= 1.0)) {
tmp = (1.0 / B) - (x / Math.tan(B));
} else {
tmp = (1.0 - x) / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -250000.0) or not (x <= 1.0): tmp = (1.0 / B) - (x / math.tan(B)) else: tmp = (1.0 - x) / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -250000.0) || !(x <= 1.0)) tmp = Float64(Float64(1.0 / B) - Float64(x / tan(B))); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -250000.0) || ~((x <= 1.0))) tmp = (1.0 / B) - (x / tan(B)); else tmp = (1.0 - x) / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -250000.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -250000 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if x < -2.5e5 or 1 < x Initial program 99.6%
+-commutative99.6%
distribute-lft-neg-in99.6%
cancel-sign-sub99.6%
associate-*r/99.9%
remove-double-neg99.9%
associate-/l*99.9%
/-rgt-identity99.9%
Simplified99.9%
Taylor expanded in B around 0 76.9%
Taylor expanded in B around 0 98.9%
if -2.5e5 < x < 1Initial program 99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
cancel-sign-sub99.8%
associate-*r/99.8%
remove-double-neg99.8%
associate-/l*99.8%
/-rgt-identity99.8%
Simplified99.8%
tan-quot99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in B around inf 99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in B around 0 98.2%
Final simplification98.6%
(FPCore (B x) :precision binary64 (if (<= B 13.5) (+ (* 0.16666666666666666 (* B (- 1.0 x))) (/ (- 1.0 x) B)) (/ (+ 1.0 x) (sin B))))
double code(double B, double x) {
double tmp;
if (B <= 13.5) {
tmp = (0.16666666666666666 * (B * (1.0 - x))) + ((1.0 - x) / B);
} else {
tmp = (1.0 + x) / sin(B);
}
return tmp;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (b <= 13.5d0) then
tmp = (0.16666666666666666d0 * (b * (1.0d0 - x))) + ((1.0d0 - x) / b)
else
tmp = (1.0d0 + x) / sin(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (B <= 13.5) {
tmp = (0.16666666666666666 * (B * (1.0 - x))) + ((1.0 - x) / B);
} else {
tmp = (1.0 + x) / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if B <= 13.5: tmp = (0.16666666666666666 * (B * (1.0 - x))) + ((1.0 - x) / B) else: tmp = (1.0 + x) / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if (B <= 13.5) tmp = Float64(Float64(0.16666666666666666 * Float64(B * Float64(1.0 - x))) + Float64(Float64(1.0 - x) / B)); else tmp = Float64(Float64(1.0 + x) / sin(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (B <= 13.5) tmp = (0.16666666666666666 * (B * (1.0 - x))) + ((1.0 - x) / B); else tmp = (1.0 + x) / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[B, 13.5], N[(N[(0.16666666666666666 * N[(B * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 13.5:\\
\;\;\;\;0.16666666666666666 \cdot \left(B \cdot \left(1 - x\right)\right) + \frac{1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + x}{\sin B}\\
\end{array}
\end{array}
if B < 13.5Initial program 99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
cancel-sign-sub99.8%
associate-*r/99.9%
remove-double-neg99.9%
associate-/l*99.9%
/-rgt-identity99.9%
Simplified99.9%
tan-quot99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in B around inf 99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in B around 0 86.0%
Taylor expanded in B around 0 69.0%
associate--l+69.0%
div-sub69.0%
Simplified69.0%
if 13.5 < B Initial program 99.6%
+-commutative99.6%
distribute-lft-neg-in99.6%
cancel-sign-sub99.6%
associate-*r/99.8%
remove-double-neg99.8%
associate-/l*99.8%
/-rgt-identity99.8%
Simplified99.8%
tan-quot99.6%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in B around inf 99.6%
div-sub99.6%
Simplified99.6%
Taylor expanded in B around 0 54.5%
expm1-log1p-u29.1%
expm1-udef28.8%
sub-neg28.8%
add-sqr-sqrt13.8%
sqrt-unprod28.0%
sqr-neg28.0%
sqrt-unprod15.4%
add-sqr-sqrt29.5%
Applied egg-rr29.5%
expm1-def29.7%
expm1-log1p53.5%
Simplified53.5%
Final simplification65.7%
(FPCore (B x) :precision binary64 (if (<= B 13.5) (+ (* 0.16666666666666666 (* B (- 1.0 x))) (/ (- 1.0 x) B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if (B <= 13.5) {
tmp = (0.16666666666666666 * (B * (1.0 - x))) + ((1.0 - x) / B);
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (b <= 13.5d0) then
tmp = (0.16666666666666666d0 * (b * (1.0d0 - x))) + ((1.0d0 - x) / b)
else
tmp = 1.0d0 / sin(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (B <= 13.5) {
tmp = (0.16666666666666666 * (B * (1.0 - x))) + ((1.0 - x) / B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if B <= 13.5: tmp = (0.16666666666666666 * (B * (1.0 - x))) + ((1.0 - x) / B) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if (B <= 13.5) tmp = Float64(Float64(0.16666666666666666 * Float64(B * Float64(1.0 - x))) + Float64(Float64(1.0 - x) / B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (B <= 13.5) tmp = (0.16666666666666666 * (B * (1.0 - x))) + ((1.0 - x) / B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[B, 13.5], N[(N[(0.16666666666666666 * N[(B * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 13.5:\\
\;\;\;\;0.16666666666666666 \cdot \left(B \cdot \left(1 - x\right)\right) + \frac{1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if B < 13.5Initial program 99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
cancel-sign-sub99.8%
associate-*r/99.9%
remove-double-neg99.9%
associate-/l*99.9%
/-rgt-identity99.9%
Simplified99.9%
tan-quot99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in B around inf 99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in B around 0 86.0%
Taylor expanded in B around 0 69.0%
associate--l+69.0%
div-sub69.0%
Simplified69.0%
if 13.5 < B Initial program 99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
Taylor expanded in x around 0 50.4%
Final simplification65.1%
(FPCore (B x) :precision binary64 (/ (- 1.0 x) (sin B)))
double code(double B, double x) {
return (1.0 - x) / sin(B);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (1.0d0 - x) / sin(b)
end function
public static double code(double B, double x) {
return (1.0 - x) / Math.sin(B);
}
def code(B, x): return (1.0 - x) / math.sin(B)
function code(B, x) return Float64(Float64(1.0 - x) / sin(B)) end
function tmp = code(B, x) tmp = (1.0 - x) / sin(B); end
code[B_, x_] := N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{\sin B}
\end{array}
Initial program 99.7%
+-commutative99.7%
distribute-lft-neg-in99.7%
cancel-sign-sub99.7%
associate-*r/99.8%
remove-double-neg99.8%
associate-/l*99.8%
/-rgt-identity99.8%
Simplified99.8%
tan-quot99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in B around inf 99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in B around 0 79.4%
Final simplification79.4%
(FPCore (B x) :precision binary64 (+ (/ (- 1.0 x) B) (* 0.3333333333333333 (* B x))))
double code(double B, double x) {
return ((1.0 - x) / B) + (0.3333333333333333 * (B * x));
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = ((1.0d0 - x) / b) + (0.3333333333333333d0 * (b * x))
end function
public static double code(double B, double x) {
return ((1.0 - x) / B) + (0.3333333333333333 * (B * x));
}
def code(B, x): return ((1.0 - x) / B) + (0.3333333333333333 * (B * x))
function code(B, x) return Float64(Float64(Float64(1.0 - x) / B) + Float64(0.3333333333333333 * Float64(B * x))) end
function tmp = code(B, x) tmp = ((1.0 - x) / B) + (0.3333333333333333 * (B * x)); end
code[B_, x_] := N[(N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision] + N[(0.3333333333333333 * N[(B * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{B} + 0.3333333333333333 \cdot \left(B \cdot x\right)
\end{array}
Initial program 99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 55.1%
+-commutative55.1%
mul-1-neg55.1%
sub-neg55.1%
associate--l+55.1%
*-commutative55.1%
div-sub55.1%
Simplified55.1%
Taylor expanded in x around inf 55.3%
Final simplification55.3%
(FPCore (B x) :precision binary64 (+ (/ (- 1.0 x) B) (* B 0.16666666666666666)))
double code(double B, double x) {
return ((1.0 - x) / B) + (B * 0.16666666666666666);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = ((1.0d0 - x) / b) + (b * 0.16666666666666666d0)
end function
public static double code(double B, double x) {
return ((1.0 - x) / B) + (B * 0.16666666666666666);
}
def code(B, x): return ((1.0 - x) / B) + (B * 0.16666666666666666)
function code(B, x) return Float64(Float64(Float64(1.0 - x) / B) + Float64(B * 0.16666666666666666)) end
function tmp = code(B, x) tmp = ((1.0 - x) / B) + (B * 0.16666666666666666); end
code[B_, x_] := N[(N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision] + N[(B * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{B} + B \cdot 0.16666666666666666
\end{array}
Initial program 99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 77.7%
Taylor expanded in B around 0 55.2%
Taylor expanded in B around -inf 55.2%
+-commutative55.2%
*-commutative55.2%
associate-*r/55.2%
sub-neg55.2%
metadata-eval55.2%
distribute-lft-in55.2%
metadata-eval55.2%
+-commutative55.2%
mul-1-neg55.2%
sub-neg55.2%
Simplified55.2%
Final simplification55.2%
(FPCore (B x) :precision binary64 (/ (- 1.0 x) B))
double code(double B, double x) {
return (1.0 - x) / B;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (1.0d0 - x) / b
end function
public static double code(double B, double x) {
return (1.0 - x) / B;
}
def code(B, x): return (1.0 - x) / B
function code(B, x) return Float64(Float64(1.0 - x) / B) end
function tmp = code(B, x) tmp = (1.0 - x) / B; end
code[B_, x_] := N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{B}
\end{array}
Initial program 99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 55.2%
mul-1-neg55.2%
sub-neg55.2%
Simplified55.2%
Final simplification55.2%
(FPCore (B x) :precision binary64 (/ (- x) B))
double code(double B, double x) {
return -x / B;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -x / b
end function
public static double code(double B, double x) {
return -x / B;
}
def code(B, x): return -x / B
function code(B, x) return Float64(Float64(-x) / B) end
function tmp = code(B, x) tmp = -x / B; end
code[B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{B}
\end{array}
Initial program 99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 77.7%
Taylor expanded in B around 0 55.2%
Taylor expanded in x around inf 31.6%
associate-*r/31.6%
mul-1-neg31.6%
Simplified31.6%
Final simplification31.6%
(FPCore (B x) :precision binary64 (* B 0.16666666666666666))
double code(double B, double x) {
return B * 0.16666666666666666;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = b * 0.16666666666666666d0
end function
public static double code(double B, double x) {
return B * 0.16666666666666666;
}
def code(B, x): return B * 0.16666666666666666
function code(B, x) return Float64(B * 0.16666666666666666) end
function tmp = code(B, x) tmp = B * 0.16666666666666666; end
code[B_, x_] := N[(B * 0.16666666666666666), $MachinePrecision]
\begin{array}{l}
\\
B \cdot 0.16666666666666666
\end{array}
Initial program 99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 77.7%
Taylor expanded in B around 0 55.2%
Taylor expanded in B around inf 2.9%
*-commutative2.9%
Simplified2.9%
Final simplification2.9%
herbie shell --seed 2023336
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))