
(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 (- (/ (- x) (tan B)) (/ -1.0 (sin B))))
double code(double B, double x) {
return (-x / tan(B)) - (-1.0 / sin(B));
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (-x / tan(b)) - ((-1.0d0) / sin(b))
end function
public static double code(double B, double x) {
return (-x / Math.tan(B)) - (-1.0 / Math.sin(B));
}
def code(B, x): return (-x / math.tan(B)) - (-1.0 / math.sin(B))
function code(B, x) return Float64(Float64(Float64(-x) / tan(B)) - Float64(-1.0 / sin(B))) end
function tmp = code(B, x) tmp = (-x / tan(B)) - (-1.0 / sin(B)); end
code[B_, x_] := N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] - N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{\tan B} - \frac{-1}{\sin B}
\end{array}
Initial program 99.6%
lift-+.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
lower--.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lift-/.f64N/A
div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
(FPCore (B x)
:precision binary64
(let* ((t_0 (- (* x (/ -1.0 (tan B))) (/ -1.0 (sin B)))))
(if (or (<= t_0 -200.0) (not (<= t_0 20.0)))
(/ (- 1.0 x) (tan B))
(/ (- 1.0 x) (sin B)))))
double code(double B, double x) {
double t_0 = (x * (-1.0 / tan(B))) - (-1.0 / sin(B));
double tmp;
if ((t_0 <= -200.0) || !(t_0 <= 20.0)) {
tmp = (1.0 - 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) :: t_0
real(8) :: tmp
t_0 = (x * ((-1.0d0) / tan(b))) - ((-1.0d0) / sin(b))
if ((t_0 <= (-200.0d0)) .or. (.not. (t_0 <= 20.0d0))) then
tmp = (1.0d0 - 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 t_0 = (x * (-1.0 / Math.tan(B))) - (-1.0 / Math.sin(B));
double tmp;
if ((t_0 <= -200.0) || !(t_0 <= 20.0)) {
tmp = (1.0 - x) / Math.tan(B);
} else {
tmp = (1.0 - x) / Math.sin(B);
}
return tmp;
}
def code(B, x): t_0 = (x * (-1.0 / math.tan(B))) - (-1.0 / math.sin(B)) tmp = 0 if (t_0 <= -200.0) or not (t_0 <= 20.0): tmp = (1.0 - x) / math.tan(B) else: tmp = (1.0 - x) / math.sin(B) return tmp
function code(B, x) t_0 = Float64(Float64(x * Float64(-1.0 / tan(B))) - Float64(-1.0 / sin(B))) tmp = 0.0 if ((t_0 <= -200.0) || !(t_0 <= 20.0)) tmp = Float64(Float64(1.0 - x) / tan(B)); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
function tmp_2 = code(B, x) t_0 = (x * (-1.0 / tan(B))) - (-1.0 / sin(B)); tmp = 0.0; if ((t_0 <= -200.0) || ~((t_0 <= 20.0))) tmp = (1.0 - x) / tan(B); else tmp = (1.0 - x) / sin(B); end tmp_2 = tmp; end
code[B_, x_] := Block[{t$95$0 = N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -200.0], N[Not[LessEqual[t$95$0, 20.0]], $MachinePrecision]], N[(N[(1.0 - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B} - \frac{-1}{\sin B}\\
\mathbf{if}\;t\_0 \leq -200 \lor \neg \left(t\_0 \leq 20\right):\\
\;\;\;\;\frac{1 - x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (/.f64 #s(literal 1 binary64) (sin.f64 B))) < -200 or 20 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (/.f64 #s(literal 1 binary64) (sin.f64 B))) Initial program 99.6%
lift-+.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
lower--.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lift-/.f64N/A
div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
*-commutativeN/A
associate-/r*N/A
Applied rewrites99.8%
Taylor expanded in B around 0
mul-1-negN/A
sub-negN/A
lower--.f6498.8
Applied rewrites98.8%
if -200 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (/.f64 #s(literal 1 binary64) (sin.f64 B))) < 20Initial program 99.7%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
frac-addN/A
lower-/.f64N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
distribute-rgt-inN/A
associate-*r/N/A
associate-*l/N/A
associate-*r*N/A
*-commutativeN/A
associate-/r*N/A
associate-*l/N/A
div-add-revN/A
lft-mult-inverseN/A
lower-/.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites96.7%
Final simplification98.3%
(FPCore (B x) :precision binary64 (/ (fma (- x) (cos B) 1.0) (sin B)))
double code(double B, double x) {
return fma(-x, cos(B), 1.0) / sin(B);
}
function code(B, x) return Float64(fma(Float64(-x), cos(B), 1.0) / sin(B)) end
code[B_, x_] := N[(N[((-x) * N[Cos[B], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(-x, \cos B, 1\right)}{\sin B}
\end{array}
Initial program 99.6%
Taylor expanded in B around inf
sub-negN/A
mul-1-negN/A
+-commutativeN/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
neg-mul-1N/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (B x)
:precision binary64
(if (<= B 2.05)
(/
(fma
(fma
(fma
(* (fma x 0.0021164021164021165 0.00205026455026455) B)
B
(fma 0.022222222222222223 x 0.019444444444444445))
(* B B)
(fma 0.3333333333333333 x 0.16666666666666666))
(* B B)
(- 1.0 x))
B)
(pow (sin B) -1.0)))
double code(double B, double x) {
double tmp;
if (B <= 2.05) {
tmp = fma(fma(fma((fma(x, 0.0021164021164021165, 0.00205026455026455) * B), B, fma(0.022222222222222223, x, 0.019444444444444445)), (B * B), fma(0.3333333333333333, x, 0.16666666666666666)), (B * B), (1.0 - x)) / B;
} else {
tmp = pow(sin(B), -1.0);
}
return tmp;
}
function code(B, x) tmp = 0.0 if (B <= 2.05) tmp = Float64(fma(fma(fma(Float64(fma(x, 0.0021164021164021165, 0.00205026455026455) * B), B, fma(0.022222222222222223, x, 0.019444444444444445)), Float64(B * B), fma(0.3333333333333333, x, 0.16666666666666666)), Float64(B * B), Float64(1.0 - x)) / B); else tmp = sin(B) ^ -1.0; end return tmp end
code[B_, x_] := If[LessEqual[B, 2.05], N[(N[(N[(N[(N[(N[(x * 0.0021164021164021165 + 0.00205026455026455), $MachinePrecision] * B), $MachinePrecision] * B + N[(0.022222222222222223 * x + 0.019444444444444445), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.05:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x, 0.0021164021164021165, 0.00205026455026455\right) \cdot B, B, \mathsf{fma}\left(0.022222222222222223, x, 0.019444444444444445\right)\right), B \cdot B, \mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right)\right), B \cdot B, 1 - x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;{\sin B}^{-1}\\
\end{array}
\end{array}
if B < 2.0499999999999998Initial program 99.7%
Taylor expanded in B around 0
Applied rewrites67.1%
if 2.0499999999999998 < B Initial program 99.4%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
frac-addN/A
lower-/.f64N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
Taylor expanded in x around inf
distribute-rgt-inN/A
associate-*r/N/A
associate-*l/N/A
associate-*r*N/A
*-commutativeN/A
associate-/r*N/A
associate-*l/N/A
div-add-revN/A
lft-mult-inverseN/A
lower-/.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.4
Applied rewrites99.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-sin.f6441.9
Applied rewrites41.9%
Final simplification60.3%
(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.6%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
frac-addN/A
lower-/.f64N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f6483.8
Applied rewrites83.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
associate-*r/N/A
associate-*l/N/A
associate-*r*N/A
*-commutativeN/A
associate-/r*N/A
associate-*l/N/A
div-add-revN/A
lft-mult-inverseN/A
lower-/.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites72.2%
(FPCore (B x) :precision binary64 (/ (fma (* (* 0.3333333333333333 B) x) B (- 1.0 x)) B))
double code(double B, double x) {
return fma(((0.3333333333333333 * B) * x), B, (1.0 - x)) / B;
}
function code(B, x) return Float64(fma(Float64(Float64(0.3333333333333333 * B) * x), B, Float64(1.0 - x)) / B) end
code[B_, x_] := N[(N[(N[(N[(0.3333333333333333 * B), $MachinePrecision] * x), $MachinePrecision] * B + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(\left(0.3333333333333333 \cdot B\right) \cdot x, B, 1 - x\right)}{B}
\end{array}
Initial program 99.6%
lift-+.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
lower--.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lift-/.f64N/A
div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6449.9
Applied rewrites49.9%
Taylor expanded in x around inf
Applied rewrites50.1%
Final simplification50.1%
(FPCore (B x) :precision binary64 (if (or (<= x -410.0) (not (<= x 1.0))) (/ (- x) B) (/ (+ x 1.0) B)))
double code(double B, double x) {
double tmp;
if ((x <= -410.0) || !(x <= 1.0)) {
tmp = -x / B;
} else {
tmp = (x + 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 <= (-410.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = -x / b
else
tmp = (x + 1.0d0) / b
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -410.0) || !(x <= 1.0)) {
tmp = -x / B;
} else {
tmp = (x + 1.0) / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -410.0) or not (x <= 1.0): tmp = -x / B else: tmp = (x + 1.0) / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -410.0) || !(x <= 1.0)) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(x + 1.0) / B); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -410.0) || ~((x <= 1.0))) tmp = -x / B; else tmp = (x + 1.0) / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -410.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -410 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 1}{B}\\
\end{array}
\end{array}
if x < -410 or 1 < x Initial program 99.5%
lift-+.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
lower--.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lift-/.f64N/A
div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6447.8
Applied rewrites47.8%
Taylor expanded in x around -inf
Applied rewrites47.4%
Taylor expanded in B around 0
Applied rewrites47.1%
if -410 < x < 1Initial program 99.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6452.8
Applied rewrites52.8%
Applied rewrites52.8%
Applied rewrites52.4%
Final simplification49.5%
(FPCore (B x) :precision binary64 (if (or (<= x -3.4e-14) (not (<= x 1.0))) (/ (- x) B) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -3.4e-14) || !(x <= 1.0)) {
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 <= (-3.4d-14)) .or. (.not. (x <= 1.0d0))) 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 <= -3.4e-14) || !(x <= 1.0)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -3.4e-14) or not (x <= 1.0): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -3.4e-14) || !(x <= 1.0)) 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 <= -3.4e-14) || ~((x <= 1.0))) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -3.4e-14], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-14} \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -3.40000000000000003e-14 or 1 < x Initial program 99.5%
lift-+.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
lower--.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lift-/.f64N/A
div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in x around -inf
Applied rewrites46.5%
Taylor expanded in B around 0
Applied rewrites46.2%
if -3.40000000000000003e-14 < x < 1Initial program 99.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6454.1
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites53.7%
Final simplification49.5%
(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.6%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6449.9
Applied rewrites49.9%
Final simplification49.9%
(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.6%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6449.9
Applied rewrites49.9%
Taylor expanded in x around 0
Applied rewrites25.3%
Final simplification25.3%
herbie shell --seed 2024305
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))