
(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)) (pow (sin B) -1.0)))
double code(double B, double x) {
return (-x / tan(B)) + pow(sin(B), -1.0);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (-x / tan(b)) + (sin(b) ** (-1.0d0))
end function
public static double code(double B, double x) {
return (-x / Math.tan(B)) + Math.pow(Math.sin(B), -1.0);
}
def code(B, x): return (-x / math.tan(B)) + math.pow(math.sin(B), -1.0)
function code(B, x) return Float64(Float64(Float64(-x) / tan(B)) + (sin(B) ^ -1.0)) end
function tmp = code(B, x) tmp = (-x / tan(B)) + (sin(B) ^ -1.0); end
code[B_, x_] := N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{\tan B} + {\sin B}^{-1}
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (B x) :precision binary64 (if (or (<= x -1.45) (not (<= x 1.25))) (+ (/ -1.0 (/ (tan B) x)) (pow B -1.0)) (+ (- (/ x B)) (pow (sin B) -1.0))))
double code(double B, double x) {
double tmp;
if ((x <= -1.45) || !(x <= 1.25)) {
tmp = (-1.0 / (tan(B) / x)) + pow(B, -1.0);
} else {
tmp = -(x / B) + pow(sin(B), -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 <= (-1.45d0)) .or. (.not. (x <= 1.25d0))) then
tmp = ((-1.0d0) / (tan(b) / x)) + (b ** (-1.0d0))
else
tmp = -(x / b) + (sin(b) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -1.45) || !(x <= 1.25)) {
tmp = (-1.0 / (Math.tan(B) / x)) + Math.pow(B, -1.0);
} else {
tmp = -(x / B) + Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.45) or not (x <= 1.25): tmp = (-1.0 / (math.tan(B) / x)) + math.pow(B, -1.0) else: tmp = -(x / B) + math.pow(math.sin(B), -1.0) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.45) || !(x <= 1.25)) tmp = Float64(Float64(-1.0 / Float64(tan(B) / x)) + (B ^ -1.0)); else tmp = Float64(Float64(-Float64(x / B)) + (sin(B) ^ -1.0)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -1.45) || ~((x <= 1.25))) tmp = (-1.0 / (tan(B) / x)) + (B ^ -1.0); else tmp = -(x / B) + (sin(B) ^ -1.0); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.45], N[Not[LessEqual[x, 1.25]], $MachinePrecision]], N[(N[(-1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \lor \neg \left(x \leq 1.25\right):\\
\;\;\;\;\frac{-1}{\frac{\tan B}{x}} + {B}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if x < -1.44999999999999996 or 1.25 < x Initial program 99.7%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
lift-neg.f64N/A
lift-/.f64N/A
clear-numN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
lower-/.f6498.4
Applied rewrites98.4%
if -1.44999999999999996 < x < 1.25Initial program 99.9%
Taylor expanded in B around 0
lower-/.f6497.3
Applied rewrites97.3%
Final simplification97.9%
(FPCore (B x) :precision binary64 (if (or (<= x -1.45) (not (<= x 0.58))) (+ (* (/ -1.0 (tan B)) x) (pow B -1.0)) (+ (- (/ x B)) (pow (sin B) -1.0))))
double code(double B, double x) {
double tmp;
if ((x <= -1.45) || !(x <= 0.58)) {
tmp = ((-1.0 / tan(B)) * x) + pow(B, -1.0);
} else {
tmp = -(x / B) + pow(sin(B), -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 <= (-1.45d0)) .or. (.not. (x <= 0.58d0))) then
tmp = (((-1.0d0) / tan(b)) * x) + (b ** (-1.0d0))
else
tmp = -(x / b) + (sin(b) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -1.45) || !(x <= 0.58)) {
tmp = ((-1.0 / Math.tan(B)) * x) + Math.pow(B, -1.0);
} else {
tmp = -(x / B) + Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.45) or not (x <= 0.58): tmp = ((-1.0 / math.tan(B)) * x) + math.pow(B, -1.0) else: tmp = -(x / B) + math.pow(math.sin(B), -1.0) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.45) || !(x <= 0.58)) tmp = Float64(Float64(Float64(-1.0 / tan(B)) * x) + (B ^ -1.0)); else tmp = Float64(Float64(-Float64(x / B)) + (sin(B) ^ -1.0)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -1.45) || ~((x <= 0.58))) tmp = ((-1.0 / tan(B)) * x) + (B ^ -1.0); else tmp = -(x / B) + (sin(B) ^ -1.0); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.45], N[Not[LessEqual[x, 0.58]], $MachinePrecision]], N[(N[(N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] + N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \lor \neg \left(x \leq 0.58\right):\\
\;\;\;\;\frac{-1}{\tan B} \cdot x + {B}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if x < -1.44999999999999996 or 0.57999999999999996 < x Initial program 99.7%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
lift-neg.f64N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
lower-/.f6498.3
Applied rewrites98.3%
if -1.44999999999999996 < x < 0.57999999999999996Initial program 99.8%
Taylor expanded in B around 0
lower-/.f6497.3
Applied rewrites97.3%
Final simplification97.8%
(FPCore (B x) :precision binary64 (if (or (<= x -1.45) (not (<= x 1.25))) (+ (/ (- x) (tan B)) (pow B -1.0)) (+ (- (/ x B)) (pow (sin B) -1.0))))
double code(double B, double x) {
double tmp;
if ((x <= -1.45) || !(x <= 1.25)) {
tmp = (-x / tan(B)) + pow(B, -1.0);
} else {
tmp = -(x / B) + pow(sin(B), -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 <= (-1.45d0)) .or. (.not. (x <= 1.25d0))) then
tmp = (-x / tan(b)) + (b ** (-1.0d0))
else
tmp = -(x / b) + (sin(b) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -1.45) || !(x <= 1.25)) {
tmp = (-x / Math.tan(B)) + Math.pow(B, -1.0);
} else {
tmp = -(x / B) + Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.45) or not (x <= 1.25): tmp = (-x / math.tan(B)) + math.pow(B, -1.0) else: tmp = -(x / B) + math.pow(math.sin(B), -1.0) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.45) || !(x <= 1.25)) tmp = Float64(Float64(Float64(-x) / tan(B)) + (B ^ -1.0)); else tmp = Float64(Float64(-Float64(x / B)) + (sin(B) ^ -1.0)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -1.45) || ~((x <= 1.25))) tmp = (-x / tan(B)) + (B ^ -1.0); else tmp = -(x / B) + (sin(B) ^ -1.0); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.45], N[Not[LessEqual[x, 1.25]], $MachinePrecision]], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \lor \neg \left(x \leq 1.25\right):\\
\;\;\;\;\frac{-x}{\tan B} + {B}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if x < -1.44999999999999996 or 1.25 < x Initial program 99.7%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
associate-/r/N/A
div-invN/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f6498.4
Applied rewrites98.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
if -1.44999999999999996 < x < 1.25Initial program 99.9%
Taylor expanded in B around 0
lower-/.f6497.3
Applied rewrites97.3%
Final simplification97.9%
(FPCore (B x) :precision binary64 (if (or (<= x -5.2e+15) (not (<= x 5.1e+36))) (+ (* x (/ -1.0 (tan B))) (* 0.16666666666666666 B)) (+ (- (/ x B)) (pow (sin B) -1.0))))
double code(double B, double x) {
double tmp;
if ((x <= -5.2e+15) || !(x <= 5.1e+36)) {
tmp = (x * (-1.0 / tan(B))) + (0.16666666666666666 * B);
} else {
tmp = -(x / B) + pow(sin(B), -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 <= (-5.2d+15)) .or. (.not. (x <= 5.1d+36))) then
tmp = (x * ((-1.0d0) / tan(b))) + (0.16666666666666666d0 * b)
else
tmp = -(x / b) + (sin(b) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -5.2e+15) || !(x <= 5.1e+36)) {
tmp = (x * (-1.0 / Math.tan(B))) + (0.16666666666666666 * B);
} else {
tmp = -(x / B) + Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -5.2e+15) or not (x <= 5.1e+36): tmp = (x * (-1.0 / math.tan(B))) + (0.16666666666666666 * B) else: tmp = -(x / B) + math.pow(math.sin(B), -1.0) return tmp
function code(B, x) tmp = 0.0 if ((x <= -5.2e+15) || !(x <= 5.1e+36)) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(0.16666666666666666 * B)); else tmp = Float64(Float64(-Float64(x / B)) + (sin(B) ^ -1.0)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -5.2e+15) || ~((x <= 5.1e+36))) tmp = (x * (-1.0 / tan(B))) + (0.16666666666666666 * B); else tmp = -(x / B) + (sin(B) ^ -1.0); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -5.2e+15], N[Not[LessEqual[x, 5.1e+36]], $MachinePrecision]], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * B), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+15} \lor \neg \left(x \leq 5.1 \cdot 10^{+36}\right):\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + 0.16666666666666666 \cdot B\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if x < -5.2e15 or 5.09999999999999973e36 < x Initial program 99.7%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6468.8
Applied rewrites68.8%
Taylor expanded in B around inf
Applied rewrites77.9%
if -5.2e15 < x < 5.09999999999999973e36Initial program 99.8%
Taylor expanded in B around 0
lower-/.f6494.3
Applied rewrites94.3%
Final simplification86.8%
(FPCore (B x)
:precision binary64
(if (<= B 0.48)
(/
(fma
(fma
(fma
0.022222222222222223
x
(fma
(fma x 0.0021164021164021165 0.00205026455026455)
(* B B)
0.019444444444444445))
(* B B)
(fma 0.3333333333333333 x 0.16666666666666666))
(* B B)
(- 1.0 x))
B)
(+ (* x (/ -1.0 (tan B))) (* 0.16666666666666666 B))))
double code(double B, double x) {
double tmp;
if (B <= 0.48) {
tmp = fma(fma(fma(0.022222222222222223, x, fma(fma(x, 0.0021164021164021165, 0.00205026455026455), (B * B), 0.019444444444444445)), (B * B), fma(0.3333333333333333, x, 0.16666666666666666)), (B * B), (1.0 - x)) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (0.16666666666666666 * B);
}
return tmp;
}
function code(B, x) tmp = 0.0 if (B <= 0.48) tmp = Float64(fma(fma(fma(0.022222222222222223, x, fma(fma(x, 0.0021164021164021165, 0.00205026455026455), Float64(B * B), 0.019444444444444445)), Float64(B * B), fma(0.3333333333333333, x, 0.16666666666666666)), Float64(B * B), Float64(1.0 - x)) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(0.16666666666666666 * B)); end return tmp end
code[B_, x_] := If[LessEqual[B, 0.48], N[(N[(N[(N[(0.022222222222222223 * x + N[(N[(x * 0.0021164021164021165 + 0.00205026455026455), $MachinePrecision] * N[(B * B), $MachinePrecision] + 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[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.48:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.022222222222222223, x, \mathsf{fma}\left(\mathsf{fma}\left(x, 0.0021164021164021165, 0.00205026455026455\right), B \cdot B, 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}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + 0.16666666666666666 \cdot B\\
\end{array}
\end{array}
if B < 0.47999999999999998Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites69.7%
if 0.47999999999999998 < B Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6418.0
Applied rewrites18.0%
Taylor expanded in B around inf
Applied rewrites29.1%
Final simplification61.6%
(FPCore (B x) :precision binary64 (if (or (<= x -850.0) (not (<= x 1.0))) (/ (- x) B) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -850.0) || !(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 <= (-850.0d0)) .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 <= -850.0) || !(x <= 1.0)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -850.0) or not (x <= 1.0): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -850.0) || !(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 <= -850.0) || ~((x <= 1.0))) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -850.0], 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 -850 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -850 or 1 < x Initial program 99.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6455.9
Applied rewrites55.9%
Taylor expanded in x around inf
Applied rewrites55.0%
if -850 < x < 1Initial program 99.9%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6457.7
Applied rewrites57.7%
Taylor expanded in x around 0
Applied rewrites56.3%
Final simplification55.6%
(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.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6456.8
Applied rewrites56.8%
(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.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6456.8
Applied rewrites56.8%
Taylor expanded in x around 0
Applied rewrites29.6%
(FPCore (B x) :precision binary64 (* 0.16666666666666666 B))
double code(double B, double x) {
return 0.16666666666666666 * B;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = 0.16666666666666666d0 * b
end function
public static double code(double B, double x) {
return 0.16666666666666666 * B;
}
def code(B, x): return 0.16666666666666666 * B
function code(B, x) return Float64(0.16666666666666666 * B) end
function tmp = code(B, x) tmp = 0.16666666666666666 * B; end
code[B_, x_] := N[(0.16666666666666666 * B), $MachinePrecision]
\begin{array}{l}
\\
0.16666666666666666 \cdot B
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6456.5
Applied rewrites56.5%
Taylor expanded in B around inf
Applied rewrites2.7%
Taylor expanded in x around 0
Applied rewrites3.2%
Final simplification3.2%
herbie shell --seed 2024307
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))