
(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%
distribute-lft-neg-in99.7%
+-commutative99.7%
cancel-sign-sub-inv99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (B x) :precision binary64 (if (or (<= x -2.5) (not (<= x 1.9))) (/ (- 1.0 x) (tan B)) (- (/ 1.0 (sin B)) (/ x B))))
double code(double B, double x) {
double tmp;
if ((x <= -2.5) || !(x <= 1.9)) {
tmp = (1.0 - x) / tan(B);
} else {
tmp = (1.0 / sin(B)) - (x / B);
}
return tmp;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-2.5d0)) .or. (.not. (x <= 1.9d0))) then
tmp = (1.0d0 - x) / tan(b)
else
tmp = (1.0d0 / sin(b)) - (x / b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -2.5) || !(x <= 1.9)) {
tmp = (1.0 - x) / Math.tan(B);
} else {
tmp = (1.0 / Math.sin(B)) - (x / B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -2.5) or not (x <= 1.9): tmp = (1.0 - x) / math.tan(B) else: tmp = (1.0 / math.sin(B)) - (x / B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -2.5) || !(x <= 1.9)) tmp = Float64(Float64(1.0 - x) / tan(B)); else tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -2.5) || ~((x <= 1.9))) tmp = (1.0 - x) / tan(B); else tmp = (1.0 / sin(B)) - (x / B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -2.5], N[Not[LessEqual[x, 1.9]], $MachinePrecision]], N[(N[(1.0 - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \lor \neg \left(x \leq 1.9\right):\\
\;\;\;\;\frac{1 - x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -2.5 or 1.8999999999999999 < x Initial program 99.6%
+-commutative99.6%
div-inv99.9%
sub-neg99.9%
frac-sub94.7%
associate-/r*99.8%
*-un-lft-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in B around 0 99.2%
if -2.5 < x < 1.8999999999999999Initial program 99.8%
Taylor expanded in B around 0 98.3%
Taylor expanded in x around 0 98.3%
mul-1-neg98.3%
+-commutative98.3%
sub-neg98.3%
Simplified98.3%
Final simplification98.7%
(FPCore (B x) :precision binary64 (if (<= x -7e-7) (/ (- 1.0 x) (tan B)) (if (<= x 6e-9) (/ 1.0 (sin B)) (- (/ 1.0 B) (/ x (tan B))))))
double code(double B, double x) {
double tmp;
if (x <= -7e-7) {
tmp = (1.0 - x) / tan(B);
} else if (x <= 6e-9) {
tmp = 1.0 / sin(B);
} else {
tmp = (1.0 / B) - (x / tan(B));
}
return tmp;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-7d-7)) then
tmp = (1.0d0 - x) / tan(b)
else if (x <= 6d-9) then
tmp = 1.0d0 / sin(b)
else
tmp = (1.0d0 / b) - (x / tan(b))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (x <= -7e-7) {
tmp = (1.0 - x) / Math.tan(B);
} else if (x <= 6e-9) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = (1.0 / B) - (x / Math.tan(B));
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -7e-7: tmp = (1.0 - x) / math.tan(B) elif x <= 6e-9: tmp = 1.0 / math.sin(B) else: tmp = (1.0 / B) - (x / math.tan(B)) return tmp
function code(B, x) tmp = 0.0 if (x <= -7e-7) tmp = Float64(Float64(1.0 - x) / tan(B)); elseif (x <= 6e-9) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(1.0 / B) - Float64(x / tan(B))); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (x <= -7e-7) tmp = (1.0 - x) / tan(B); elseif (x <= 6e-9) tmp = 1.0 / sin(B); else tmp = (1.0 / B) - (x / tan(B)); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -7e-7], N[(N[(1.0 - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-9], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-7}:\\
\;\;\;\;\frac{1 - x}{\tan B}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if x < -6.99999999999999968e-7Initial program 99.8%
+-commutative99.8%
div-inv99.9%
sub-neg99.9%
frac-sub96.3%
associate-/r*99.8%
*-un-lft-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in B around 0 98.2%
if -6.99999999999999968e-7 < x < 5.99999999999999996e-9Initial program 99.8%
Taylor expanded in x around 0 99.4%
if 5.99999999999999996e-9 < x Initial program 99.5%
distribute-lft-neg-in99.5%
+-commutative99.5%
cancel-sign-sub-inv99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r/99.9%
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in B around 0 97.6%
Final simplification98.6%
(FPCore (B x) :precision binary64 (if (or (<= x -1.05e-9) (not (<= x 0.17))) (/ (- 1.0 x) (tan B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.05e-9) || !(x <= 0.17)) {
tmp = (1.0 - x) / tan(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 ((x <= (-1.05d-9)) .or. (.not. (x <= 0.17d0))) then
tmp = (1.0d0 - x) / tan(b)
else
tmp = 1.0d0 / sin(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -1.05e-9) || !(x <= 0.17)) {
tmp = (1.0 - x) / Math.tan(B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.05e-9) or not (x <= 0.17): tmp = (1.0 - x) / math.tan(B) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.05e-9) || !(x <= 0.17)) tmp = Float64(Float64(1.0 - x) / tan(B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -1.05e-9) || ~((x <= 0.17))) tmp = (1.0 - x) / tan(B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.05e-9], N[Not[LessEqual[x, 0.17]], $MachinePrecision]], N[(N[(1.0 - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-9} \lor \neg \left(x \leq 0.17\right):\\
\;\;\;\;\frac{1 - x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.0500000000000001e-9 or 0.170000000000000012 < x Initial program 99.6%
+-commutative99.6%
div-inv99.9%
sub-neg99.9%
frac-sub94.7%
associate-/r*99.8%
*-un-lft-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in B around 0 99.2%
if -1.0500000000000001e-9 < x < 0.170000000000000012Initial program 99.8%
Taylor expanded in x around 0 98.0%
Final simplification98.6%
(FPCore (B x) :precision binary64 (if (or (<= x -1.18) (not (<= x 1.0))) (/ (- x) (tan B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.18) || !(x <= 1.0)) {
tmp = -x / tan(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 ((x <= (-1.18d0)) .or. (.not. (x <= 1.0d0))) then
tmp = -x / tan(b)
else
tmp = 1.0d0 / sin(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -1.18) || !(x <= 1.0)) {
tmp = -x / Math.tan(B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.18) or not (x <= 1.0): tmp = -x / math.tan(B) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.18) || !(x <= 1.0)) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -1.18) || ~((x <= 1.0))) tmp = -x / tan(B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.18], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.18 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.17999999999999994 or 1 < x Initial program 99.6%
+-commutative99.6%
div-inv99.9%
sub-neg99.9%
frac-sub94.7%
associate-/r*99.8%
*-un-lft-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 97.2%
neg-mul-197.2%
Simplified97.2%
if -1.17999999999999994 < x < 1Initial program 99.8%
Taylor expanded in x around 0 98.0%
Final simplification97.6%
(FPCore (B x) :precision binary64 (if (<= B 0.43) (+ (* B (+ 0.16666666666666666 (* x 0.3333333333333333))) (/ (- 1.0 x) B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if (B <= 0.43) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((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 <= 0.43d0) then
tmp = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + ((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 <= 0.43) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if B <= 0.43: tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if (B <= 0.43) tmp = Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + 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 <= 0.43) tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[B, 0.43], N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $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 0.43:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if B < 0.429999999999999993Initial program 99.8%
Taylor expanded in B around 0 67.8%
associate--l+67.8%
*-commutative67.8%
div-sub67.8%
Simplified67.8%
if 0.429999999999999993 < B Initial program 99.6%
Taylor expanded in x around 0 55.1%
Final simplification64.4%
(FPCore (B x) :precision binary64 (+ (/ (- 1.0 x) B) (* B (* x 0.3333333333333333))))
double code(double B, double x) {
return ((1.0 - x) / B) + (B * (x * 0.3333333333333333));
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = ((1.0d0 - x) / b) + (b * (x * 0.3333333333333333d0))
end function
public static double code(double B, double x) {
return ((1.0 - x) / B) + (B * (x * 0.3333333333333333));
}
def code(B, x): return ((1.0 - x) / B) + (B * (x * 0.3333333333333333))
function code(B, x) return Float64(Float64(Float64(1.0 - x) / B) + Float64(B * Float64(x * 0.3333333333333333))) end
function tmp = code(B, x) tmp = ((1.0 - x) / B) + (B * (x * 0.3333333333333333)); end
code[B_, x_] := N[(N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision] + N[(B * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{B} + B \cdot \left(x \cdot 0.3333333333333333\right)
\end{array}
Initial program 99.7%
Taylor expanded in B around 0 50.4%
associate--l+50.4%
*-commutative50.4%
div-sub50.4%
Simplified50.4%
distribute-lft-in50.4%
flip-+46.3%
Applied egg-rr46.3%
Taylor expanded in x around inf 50.6%
*-commutative50.6%
associate-*r*50.7%
Simplified50.7%
Final simplification50.7%
(FPCore (B x) :precision binary64 (if (or (<= x -14.0) (not (<= x 0.00105))) (/ (- x) B) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -14.0) || !(x <= 0.00105)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-14.0d0)) .or. (.not. (x <= 0.00105d0))) then
tmp = -x / b
else
tmp = 1.0d0 / b
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -14.0) || !(x <= 0.00105)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -14.0) or not (x <= 0.00105): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -14.0) || !(x <= 0.00105)) tmp = Float64(Float64(-x) / B); else tmp = Float64(1.0 / B); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -14.0) || ~((x <= 0.00105))) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -14.0], N[Not[LessEqual[x, 0.00105]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -14 \lor \neg \left(x \leq 0.00105\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -14 or 0.00104999999999999994 < x Initial program 99.6%
Taylor expanded in B around 0 55.4%
Taylor expanded in x around inf 53.2%
associate-*r/53.2%
neg-mul-153.2%
Simplified53.2%
if -14 < x < 0.00104999999999999994Initial program 99.8%
Taylor expanded in B around 0 45.7%
associate--l+45.7%
*-commutative45.7%
div-sub45.7%
Simplified45.7%
Taylor expanded in x around 0 45.3%
Taylor expanded in B around 0 45.5%
Final simplification49.4%
(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%
Taylor expanded in B around 0 50.4%
Final simplification50.4%
(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%
Taylor expanded in B around 0 50.4%
associate--l+50.4%
*-commutative50.4%
div-sub50.4%
Simplified50.4%
Taylor expanded in x around 0 24.3%
Taylor expanded in B around inf 3.1%
*-commutative3.1%
Simplified3.1%
Final simplification3.1%
(FPCore (B x) :precision binary64 (/ 1.0 B))
double code(double B, double x) {
return 1.0 / B;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = 1.0d0 / b
end function
public static double code(double B, double x) {
return 1.0 / B;
}
def code(B, x): return 1.0 / B
function code(B, x) return Float64(1.0 / B) end
function tmp = code(B, x) tmp = 1.0 / B; end
code[B_, x_] := N[(1.0 / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{B}
\end{array}
Initial program 99.7%
Taylor expanded in B around 0 50.4%
associate--l+50.4%
*-commutative50.4%
div-sub50.4%
Simplified50.4%
Taylor expanded in x around 0 24.3%
Taylor expanded in B around 0 24.2%
Final simplification24.2%
herbie shell --seed 2024010
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))