
(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%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (B x) :precision binary64 (if (<= x -1.6e-13) (- (/ 1.0 B) (/ x (tan B))) (if (<= x 8.2e-8) (/ 1.0 (sin B)) (* x (/ (+ (/ 1.0 x) -1.0) (tan B))))))
double code(double B, double x) {
double tmp;
if (x <= -1.6e-13) {
tmp = (1.0 / B) - (x / tan(B));
} else if (x <= 8.2e-8) {
tmp = 1.0 / sin(B);
} else {
tmp = x * (((1.0 / x) + -1.0) / 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 <= (-1.6d-13)) then
tmp = (1.0d0 / b) - (x / tan(b))
else if (x <= 8.2d-8) then
tmp = 1.0d0 / sin(b)
else
tmp = x * (((1.0d0 / x) + (-1.0d0)) / tan(b))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (x <= -1.6e-13) {
tmp = (1.0 / B) - (x / Math.tan(B));
} else if (x <= 8.2e-8) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = x * (((1.0 / x) + -1.0) / Math.tan(B));
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -1.6e-13: tmp = (1.0 / B) - (x / math.tan(B)) elif x <= 8.2e-8: tmp = 1.0 / math.sin(B) else: tmp = x * (((1.0 / x) + -1.0) / math.tan(B)) return tmp
function code(B, x) tmp = 0.0 if (x <= -1.6e-13) tmp = Float64(Float64(1.0 / B) - Float64(x / tan(B))); elseif (x <= 8.2e-8) tmp = Float64(1.0 / sin(B)); else tmp = Float64(x * Float64(Float64(Float64(1.0 / x) + -1.0) / tan(B))); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (x <= -1.6e-13) tmp = (1.0 / B) - (x / tan(B)); elseif (x <= 8.2e-8) tmp = 1.0 / sin(B); else tmp = x * (((1.0 / x) + -1.0) / tan(B)); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -1.6e-13], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.2e-8], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-13}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{x} + -1}{\tan B}\\
\end{array}
\end{array}
if x < -1.6e-13Initial program 99.6%
+-commutative99.6%
unsub-neg99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 98.2%
if -1.6e-13 < x < 8.20000000000000063e-8Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 99.4%
if 8.20000000000000063e-8 < x Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
+-commutative99.6%
cancel-sign-sub-inv99.6%
div-inv99.7%
clear-num99.6%
frac-sub90.0%
*-un-lft-identity90.0%
*-commutative90.0%
*-un-lft-identity90.0%
Applied egg-rr90.0%
associate-/r*99.6%
associate-/r/99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in B around 0 97.3%
Final simplification98.5%
(FPCore (B x) :precision binary64 (if (or (<= x -1.6e-13) (not (<= x 3.5e-6))) (- (/ 1.0 B) (/ x (tan B))) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.6e-13) || !(x <= 3.5e-6)) {
tmp = (1.0 / B) - (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.6d-13)) .or. (.not. (x <= 3.5d-6))) then
tmp = (1.0d0 / b) - (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.6e-13) || !(x <= 3.5e-6)) {
tmp = (1.0 / B) - (x / Math.tan(B));
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.6e-13) or not (x <= 3.5e-6): tmp = (1.0 / B) - (x / math.tan(B)) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.6e-13) || !(x <= 3.5e-6)) tmp = Float64(Float64(1.0 / B) - 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.6e-13) || ~((x <= 3.5e-6))) tmp = (1.0 / B) - (x / tan(B)); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.6e-13], N[Not[LessEqual[x, 3.5e-6]], $MachinePrecision]], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-13} \lor \neg \left(x \leq 3.5 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.6e-13 or 3.49999999999999995e-6 < x Initial program 99.6%
+-commutative99.6%
unsub-neg99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 97.8%
if -1.6e-13 < x < 3.49999999999999995e-6Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 99.4%
Final simplification98.5%
(FPCore (B x) :precision binary64 (if (or (<= x -1.15) (not (<= x 1.0))) (/ (- x) (tan B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.15) || !(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.15d0)) .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.15) || !(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.15) 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.15) || !(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.15) || ~((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.15], 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.15 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.1499999999999999 or 1 < x Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
Taylor expanded in x around inf 97.3%
clear-num97.2%
/-rgt-identity97.2%
div-inv97.2%
metadata-eval97.2%
frac-times97.1%
tan-quot97.1%
div-inv97.3%
clear-num97.4%
div-inv97.3%
add-sqr-sqrt42.9%
sqrt-unprod29.9%
sqr-neg29.9%
sqrt-unprod0.3%
add-sqr-sqrt0.5%
expm1-log1p-u0.2%
expm1-udef0.2%
Applied egg-rr44.5%
expm1-def44.5%
expm1-log1p97.4%
Simplified97.4%
if -1.1499999999999999 < x < 1Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 98.7%
Final simplification98.0%
(FPCore (B x)
:precision binary64
(let* ((t_0 (/ (- 1.0 x) B)))
(if (<= x -1.6e-13)
(+ (* B (+ 0.16666666666666666 (* x 0.3333333333333333))) t_0)
(if (<= x 8.5e-6)
(/ 1.0 (sin B))
(+ t_0 (* 0.3333333333333333 (* B x)))))))
double code(double B, double x) {
double t_0 = (1.0 - x) / B;
double tmp;
if (x <= -1.6e-13) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0;
} else if (x <= 8.5e-6) {
tmp = 1.0 / sin(B);
} else {
tmp = t_0 + (0.3333333333333333 * (B * x));
}
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 = (1.0d0 - x) / b
if (x <= (-1.6d-13)) then
tmp = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + t_0
else if (x <= 8.5d-6) then
tmp = 1.0d0 / sin(b)
else
tmp = t_0 + (0.3333333333333333d0 * (b * x))
end if
code = tmp
end function
public static double code(double B, double x) {
double t_0 = (1.0 - x) / B;
double tmp;
if (x <= -1.6e-13) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0;
} else if (x <= 8.5e-6) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = t_0 + (0.3333333333333333 * (B * x));
}
return tmp;
}
def code(B, x): t_0 = (1.0 - x) / B tmp = 0 if x <= -1.6e-13: tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0 elif x <= 8.5e-6: tmp = 1.0 / math.sin(B) else: tmp = t_0 + (0.3333333333333333 * (B * x)) return tmp
function code(B, x) t_0 = Float64(Float64(1.0 - x) / B) tmp = 0.0 if (x <= -1.6e-13) tmp = Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + t_0); elseif (x <= 8.5e-6) tmp = Float64(1.0 / sin(B)); else tmp = Float64(t_0 + Float64(0.3333333333333333 * Float64(B * x))); end return tmp end
function tmp_2 = code(B, x) t_0 = (1.0 - x) / B; tmp = 0.0; if (x <= -1.6e-13) tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0; elseif (x <= 8.5e-6) tmp = 1.0 / sin(B); else tmp = t_0 + (0.3333333333333333 * (B * x)); end tmp_2 = tmp; end
code[B_, x_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[x, -1.6e-13], N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x, 8.5e-6], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(0.3333333333333333 * N[(B * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{B}\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{-13}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + t_0\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t_0 + 0.3333333333333333 \cdot \left(B \cdot x\right)\\
\end{array}
\end{array}
if x < -1.6e-13Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
Taylor expanded in B around 0 47.5%
+-commutative47.5%
mul-1-neg47.5%
sub-neg47.5%
associate--l+47.5%
*-commutative47.5%
*-commutative47.5%
div-sub47.6%
Simplified47.6%
if -1.6e-13 < x < 8.4999999999999999e-6Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 99.4%
if 8.4999999999999999e-6 < x Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
Taylor expanded in B around 0 97.3%
Taylor expanded in B around 0 48.1%
+-commutative48.1%
associate-+l+48.1%
*-commutative48.1%
mul-1-neg48.1%
sub-neg48.1%
div-sub48.2%
Simplified48.2%
Final simplification70.0%
(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-lft-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 76.9%
Taylor expanded in B around 0 48.3%
+-commutative48.3%
associate-+l+48.3%
*-commutative48.3%
mul-1-neg48.3%
sub-neg48.3%
div-sub48.3%
Simplified48.3%
Final simplification48.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-lft-neg-in99.7%
Simplified99.7%
Taylor expanded in B around 0 48.3%
+-commutative48.3%
mul-1-neg48.3%
sub-neg48.3%
associate--l+48.3%
*-commutative48.3%
*-commutative48.3%
div-sub48.3%
Simplified48.3%
Taylor expanded in x around 0 48.0%
*-commutative48.0%
Simplified48.0%
Final simplification48.0%
(FPCore (B x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (- (/ x B)) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -1.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 <= (-1.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 <= -1.0) || !(x <= 1.0)) {
tmp = -(x / B);
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.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 <= -1.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 <= -1.0) || ~((x <= 1.0))) 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.0]], $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\right):\\
\;\;\;\;-\frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
Taylor expanded in x around inf 97.3%
Taylor expanded in B around 0 45.8%
if -1 < x < 1Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Taylor expanded in B around 0 50.2%
Taylor expanded in x around 0 48.9%
Final simplification47.1%
(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%
Simplified99.7%
Taylor expanded in B around 0 47.7%
mul-1-neg47.7%
sub-neg47.7%
Simplified47.7%
Final simplification47.7%
(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%
Simplified99.7%
Taylor expanded in B around 0 76.9%
Taylor expanded in x around 0 23.1%
Final simplification23.1%
herbie shell --seed 2023250
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))