
(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 10 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 -195000000.0) (not (<= x 2600000.0))) (/ (- x) (tan B)) (/ (- 1.0 x) (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -195000000.0) || !(x <= 2600000.0)) {
tmp = -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 <= (-195000000.0d0)) .or. (.not. (x <= 2600000.0d0))) then
tmp = -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 <= -195000000.0) || !(x <= 2600000.0)) {
tmp = -x / Math.tan(B);
} else {
tmp = (1.0 - x) / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -195000000.0) or not (x <= 2600000.0): tmp = -x / math.tan(B) else: tmp = (1.0 - x) / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -195000000.0) || !(x <= 2600000.0)) tmp = Float64(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 <= -195000000.0) || ~((x <= 2600000.0))) tmp = -x / tan(B); else tmp = (1.0 - x) / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -195000000.0], N[Not[LessEqual[x, 2600000.0]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -195000000 \lor \neg \left(x \leq 2600000\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if x < -1.95e8 or 2.6e6 < x Initial program 99.6%
distribute-lft-neg-in99.6%
+-commutative99.6%
cancel-sign-sub-inv99.6%
*-commutative99.6%
*-commutative99.6%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
tan-quot99.6%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in B around inf 99.7%
div-sub99.7%
Simplified99.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
associate-/l*98.9%
distribute-neg-frac98.9%
Simplified98.9%
tan-quot99.0%
expm1-log1p-u87.2%
expm1-udef52.6%
Applied egg-rr52.6%
expm1-def87.2%
expm1-log1p99.0%
Simplified99.0%
if -1.95e8 < x < 2.6e6Initial program 99.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r/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.5%
Final simplification98.8%
(FPCore (B x) :precision binary64 (if (or (<= x -1.9) (not (<= x 1.0))) (/ (- x) (tan B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.9) || !(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.9d0)) .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.9) || !(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.9) 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.9) || !(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.9) || ~((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.9], 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.9 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.8999999999999999 or 1 < x Initial program 99.6%
distribute-lft-neg-in99.6%
+-commutative99.6%
cancel-sign-sub-inv99.6%
*-commutative99.6%
*-commutative99.6%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
tan-quot99.6%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in B around inf 99.7%
div-sub99.7%
Simplified99.7%
Taylor expanded in x around inf 97.4%
mul-1-neg97.4%
associate-/l*97.4%
distribute-neg-frac97.4%
Simplified97.4%
tan-quot97.5%
expm1-log1p-u86.0%
expm1-udef51.5%
Applied egg-rr51.5%
expm1-def86.0%
expm1-log1p97.5%
Simplified97.5%
if -1.8999999999999999 < x < 1Initial program 99.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 98.3%
Final simplification97.9%
(FPCore (B x)
:precision binary64
(if (<= x -5e-7)
(+ (/ (- 1.0 x) B) (* B -0.16666666666666666))
(if (<= x 470000000.0)
(/ 1.0 (sin B))
(- (* B (- (* x -0.16666666666666666) (* x -0.5))) (/ x B)))))
double code(double B, double x) {
double tmp;
if (x <= -5e-7) {
tmp = ((1.0 - x) / B) + (B * -0.16666666666666666);
} else if (x <= 470000000.0) {
tmp = 1.0 / sin(B);
} else {
tmp = (B * ((x * -0.16666666666666666) - (x * -0.5))) - (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 <= (-5d-7)) then
tmp = ((1.0d0 - x) / b) + (b * (-0.16666666666666666d0))
else if (x <= 470000000.0d0) then
tmp = 1.0d0 / sin(b)
else
tmp = (b * ((x * (-0.16666666666666666d0)) - (x * (-0.5d0)))) - (x / b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (x <= -5e-7) {
tmp = ((1.0 - x) / B) + (B * -0.16666666666666666);
} else if (x <= 470000000.0) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = (B * ((x * -0.16666666666666666) - (x * -0.5))) - (x / B);
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -5e-7: tmp = ((1.0 - x) / B) + (B * -0.16666666666666666) elif x <= 470000000.0: tmp = 1.0 / math.sin(B) else: tmp = (B * ((x * -0.16666666666666666) - (x * -0.5))) - (x / B) return tmp
function code(B, x) tmp = 0.0 if (x <= -5e-7) tmp = Float64(Float64(Float64(1.0 - x) / B) + Float64(B * -0.16666666666666666)); elseif (x <= 470000000.0) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(B * Float64(Float64(x * -0.16666666666666666) - Float64(x * -0.5))) - Float64(x / B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (x <= -5e-7) tmp = ((1.0 - x) / B) + (B * -0.16666666666666666); elseif (x <= 470000000.0) tmp = 1.0 / sin(B); else tmp = (B * ((x * -0.16666666666666666) - (x * -0.5))) - (x / B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -5e-7], N[(N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision] + N[(B * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 470000000.0], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(B * N[(N[(x * -0.16666666666666666), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-7}:\\
\;\;\;\;\frac{1 - x}{B} + B \cdot -0.16666666666666666\\
\mathbf{elif}\;x \leq 470000000:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;B \cdot \left(x \cdot -0.16666666666666666 - x \cdot -0.5\right) - \frac{x}{B}\\
\end{array}
\end{array}
if x < -4.99999999999999977e-7Initial program 99.5%
distribute-lft-neg-in99.5%
+-commutative99.5%
distribute-lft-neg-in99.5%
distribute-rgt-neg-in99.5%
Simplified99.5%
Taylor expanded in B around 0 54.3%
Taylor expanded in B around 0 53.7%
neg-mul-153.7%
+-commutative53.7%
associate-+r+53.7%
+-commutative53.7%
sub-neg53.7%
div-sub53.8%
*-commutative53.8%
Simplified53.8%
add-sqr-sqrt23.6%
sqrt-unprod53.4%
*-commutative53.4%
*-commutative53.4%
swap-sqr53.4%
metadata-eval53.4%
Applied egg-rr53.4%
unpow253.4%
*-commutative53.4%
unpow253.4%
Simplified53.4%
Taylor expanded in B around -inf 54.0%
*-commutative54.0%
Simplified54.0%
if -4.99999999999999977e-7 < x < 4.7e8Initial program 99.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 99.1%
if 4.7e8 < x Initial program 99.6%
distribute-lft-neg-in99.6%
+-commutative99.6%
cancel-sign-sub-inv99.6%
*-commutative99.6%
*-commutative99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
tan-quot99.6%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in B around inf 99.6%
div-sub99.6%
Simplified99.6%
Taylor expanded in x around inf 99.6%
mul-1-neg99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
Simplified99.6%
Taylor expanded in B around 0 55.1%
Final simplification76.7%
(FPCore (B x) :precision binary64 (+ (/ (- 1.0 x) B) (* B (+ 0.16666666666666666 (* x 0.3333333333333333)))))
double code(double B, double x) {
return ((1.0 - x) / B) + (B * (0.16666666666666666 + (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 * (0.16666666666666666d0 + (x * 0.3333333333333333d0)))
end function
public static double code(double B, double x) {
return ((1.0 - x) / B) + (B * (0.16666666666666666 + (x * 0.3333333333333333)));
}
def code(B, x): return ((1.0 - x) / B) + (B * (0.16666666666666666 + (x * 0.3333333333333333)))
function code(B, x) return Float64(Float64(Float64(1.0 - x) / B) + Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333)))) end
function tmp = code(B, x) tmp = ((1.0 - x) / B) + (B * (0.16666666666666666 + (x * 0.3333333333333333))); end
code[B_, x_] := N[(N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision] + N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{B} + B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right)
\end{array}
Initial program 99.7%
distribute-lft-neg-in99.7%
+-commutative99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 52.9%
+-commutative52.9%
mul-1-neg52.9%
sub-neg52.9%
associate--l+52.9%
*-commutative52.9%
div-sub52.9%
Simplified52.9%
Final simplification52.9%
(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-lft-neg-in99.7%
+-commutative99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 76.4%
Taylor expanded in B around 0 52.7%
neg-mul-152.7%
+-commutative52.7%
associate-+r+52.7%
+-commutative52.7%
sub-neg52.7%
div-sub52.7%
*-commutative52.7%
Simplified52.7%
add-sqr-sqrt27.8%
sqrt-unprod52.4%
*-commutative52.4%
*-commutative52.4%
swap-sqr52.4%
metadata-eval52.4%
Applied egg-rr52.4%
unpow252.4%
*-commutative52.4%
unpow252.4%
Simplified52.4%
Taylor expanded in B around -inf 52.7%
*-commutative52.7%
Simplified52.7%
Final simplification52.7%
(FPCore (B x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.28e-27))) (/ (- x) B) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.28e-27)) {
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 <= (-1.0d0)) .or. (.not. (x <= 1.28d-27))) 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 <= -1.0) || !(x <= 1.28e-27)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.0) or not (x <= 1.28e-27): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.28e-27)) 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 <= -1.0) || ~((x <= 1.28e-27))) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.28e-27]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1.28 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -1 or 1.27999999999999993e-27 < x Initial program 99.6%
distribute-lft-neg-in99.6%
+-commutative99.6%
distribute-lft-neg-in99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
Taylor expanded in B around 0 52.3%
neg-mul-152.3%
sub-neg52.3%
Simplified52.3%
Taylor expanded in x around inf 51.3%
neg-mul-151.5%
Simplified51.3%
if -1 < x < 1.27999999999999993e-27Initial program 99.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in B around 0 53.1%
neg-mul-153.1%
sub-neg53.1%
Simplified53.1%
Taylor expanded in x around 0 52.1%
Final simplification51.7%
(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-lft-neg-in99.7%
+-commutative99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 52.7%
neg-mul-152.7%
sub-neg52.7%
Simplified52.7%
Final simplification52.7%
(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-lft-neg-in99.7%
+-commutative99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 76.4%
Taylor expanded in B around 0 52.7%
neg-mul-152.7%
+-commutative52.7%
associate-+r+52.7%
+-commutative52.7%
sub-neg52.7%
div-sub52.7%
*-commutative52.7%
Simplified52.7%
Taylor expanded in x around inf 27.7%
neg-mul-127.7%
Simplified27.7%
Taylor expanded in x around 0 3.0%
*-commutative3.0%
Simplified3.0%
Final simplification3.0%
(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%
distribute-lft-neg-in99.7%
+-commutative99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 52.7%
neg-mul-152.7%
sub-neg52.7%
Simplified52.7%
Taylor expanded in x around 0 27.4%
Final simplification27.4%
herbie shell --seed 2023272
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))