
(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%
distribute-lft-neg-in99.7%
cancel-sign-sub99.7%
associate-*r/99.8%
remove-double-neg99.8%
associate-/l*99.8%
/-rgt-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (B x) :precision binary64 (if (or (<= x -3e-16) (not (<= x 1.66e-6))) (- (/ 1.0 B) (/ x (tan B))) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -3e-16) || !(x <= 1.66e-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 <= (-3d-16)) .or. (.not. (x <= 1.66d-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 <= -3e-16) || !(x <= 1.66e-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 <= -3e-16) or not (x <= 1.66e-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 <= -3e-16) || !(x <= 1.66e-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 <= -3e-16) || ~((x <= 1.66e-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, -3e-16], N[Not[LessEqual[x, 1.66e-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 -3 \cdot 10^{-16} \lor \neg \left(x \leq 1.66 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -2.99999999999999994e-16 or 1.65999999999999999e-6 < x Initial program 99.6%
+-commutative99.6%
distribute-lft-neg-in99.6%
cancel-sign-sub99.6%
associate-*r/99.8%
remove-double-neg99.8%
associate-/l*99.8%
/-rgt-identity99.8%
Simplified99.8%
Taylor expanded in B around 0 98.8%
if -2.99999999999999994e-16 < x < 1.65999999999999999e-6Initial program 99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 99.4%
Final simplification99.1%
(FPCore (B x) :precision binary64 (if (or (<= x -2.8) (not (<= x 1.0))) (/ (- x) (tan B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -2.8) || !(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 <= (-2.8d0)) .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 <= -2.8) || !(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 <= -2.8) 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 <= -2.8) || !(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 <= -2.8) || ~((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, -2.8], 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 -2.8 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -2.7999999999999998 or 1 < x Initial program 99.6%
+-commutative99.6%
distribute-lft-neg-in99.6%
cancel-sign-sub99.6%
associate-*r/99.8%
remove-double-neg99.8%
associate-/l*99.8%
/-rgt-identity99.8%
Simplified99.8%
tan-quot99.7%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 97.3%
mul-1-neg97.3%
associate-*r/97.3%
distribute-lft-neg-in97.3%
Simplified97.3%
distribute-lft-neg-out97.3%
clear-num97.3%
tan-quot97.3%
div-inv97.5%
neg-sub097.5%
Applied egg-rr97.5%
sub0-neg97.5%
distribute-neg-frac97.5%
Simplified97.5%
if -2.7999999999999998 < x < 1Initial program 99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 98.5%
Final simplification98.0%
(FPCore (B x)
:precision binary64
(let* ((t_0 (/ (- 1.0 x) B)))
(if (<= x -3e-16)
(+ (* B (+ 0.16666666666666666 (* x 0.3333333333333333))) t_0)
(if (<= x 3.2e-7)
(/ 1.0 (sin B))
(+ t_0 (* x (* B 0.3333333333333333)))))))
double code(double B, double x) {
double t_0 = (1.0 - x) / B;
double tmp;
if (x <= -3e-16) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0;
} else if (x <= 3.2e-7) {
tmp = 1.0 / sin(B);
} else {
tmp = t_0 + (x * (B * 0.3333333333333333));
}
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 <= (-3d-16)) then
tmp = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + t_0
else if (x <= 3.2d-7) then
tmp = 1.0d0 / sin(b)
else
tmp = t_0 + (x * (b * 0.3333333333333333d0))
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 <= -3e-16) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0;
} else if (x <= 3.2e-7) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = t_0 + (x * (B * 0.3333333333333333));
}
return tmp;
}
def code(B, x): t_0 = (1.0 - x) / B tmp = 0 if x <= -3e-16: tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0 elif x <= 3.2e-7: tmp = 1.0 / math.sin(B) else: tmp = t_0 + (x * (B * 0.3333333333333333)) return tmp
function code(B, x) t_0 = Float64(Float64(1.0 - x) / B) tmp = 0.0 if (x <= -3e-16) tmp = Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + t_0); elseif (x <= 3.2e-7) tmp = Float64(1.0 / sin(B)); else tmp = Float64(t_0 + Float64(x * Float64(B * 0.3333333333333333))); end return tmp end
function tmp_2 = code(B, x) t_0 = (1.0 - x) / B; tmp = 0.0; if (x <= -3e-16) tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0; elseif (x <= 3.2e-7) tmp = 1.0 / sin(B); else tmp = t_0 + (x * (B * 0.3333333333333333)); end tmp_2 = tmp; end
code[B_, x_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[x, -3e-16], N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x, 3.2e-7], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(x * N[(B * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{B}\\
\mathbf{if}\;x \leq -3 \cdot 10^{-16}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + t_0\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t_0 + x \cdot \left(B \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
if x < -2.99999999999999994e-16Initial program 99.5%
distribute-lft-neg-in99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in B around 0 50.2%
+-commutative50.2%
mul-1-neg50.2%
sub-neg50.2%
associate--l+50.2%
*-commutative50.2%
div-sub50.2%
Simplified50.2%
if -2.99999999999999994e-16 < x < 3.2000000000000001e-7Initial program 99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 99.4%
if 3.2000000000000001e-7 < x Initial program 99.7%
distribute-lft-neg-in99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in B around 0 51.5%
+-commutative51.5%
mul-1-neg51.5%
sub-neg51.5%
associate--l+51.5%
*-commutative51.5%
div-sub51.6%
Simplified51.6%
Taylor expanded in x around inf 51.6%
associate-*r*51.6%
*-commutative51.6%
*-commutative51.6%
Simplified51.6%
Final simplification72.5%
(FPCore (B x) :precision binary64 (+ (/ (- 1.0 x) B) (* x (* B 0.3333333333333333))))
double code(double B, double x) {
return ((1.0 - x) / B) + (x * (B * 0.3333333333333333));
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = ((1.0d0 - x) / b) + (x * (b * 0.3333333333333333d0))
end function
public static double code(double B, double x) {
return ((1.0 - x) / B) + (x * (B * 0.3333333333333333));
}
def code(B, x): return ((1.0 - x) / B) + (x * (B * 0.3333333333333333))
function code(B, x) return Float64(Float64(Float64(1.0 - x) / B) + Float64(x * Float64(B * 0.3333333333333333))) end
function tmp = code(B, x) tmp = ((1.0 - x) / B) + (x * (B * 0.3333333333333333)); end
code[B_, x_] := N[(N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision] + N[(x * N[(B * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{B} + x \cdot \left(B \cdot 0.3333333333333333\right)
\end{array}
Initial program 99.7%
distribute-lft-neg-in99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in B around 0 48.6%
+-commutative48.6%
mul-1-neg48.6%
sub-neg48.6%
associate--l+48.6%
*-commutative48.6%
div-sub48.7%
Simplified48.7%
Taylor expanded in x around inf 48.7%
associate-*r*48.7%
*-commutative48.7%
*-commutative48.7%
Simplified48.7%
Final simplification48.7%
(FPCore (B x) :precision binary64 (if (or (<= x -14200.0) (not (<= x 3.3e-9))) (/ (- x) B) (/ (+ 1.0 x) B)))
double code(double B, double x) {
double tmp;
if ((x <= -14200.0) || !(x <= 3.3e-9)) {
tmp = -x / B;
} else {
tmp = (1.0 + 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 <= (-14200.0d0)) .or. (.not. (x <= 3.3d-9))) then
tmp = -x / b
else
tmp = (1.0d0 + x) / b
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -14200.0) || !(x <= 3.3e-9)) {
tmp = -x / B;
} else {
tmp = (1.0 + x) / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -14200.0) or not (x <= 3.3e-9): tmp = -x / B else: tmp = (1.0 + x) / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -14200.0) || !(x <= 3.3e-9)) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 + x) / B); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -14200.0) || ~((x <= 3.3e-9))) tmp = -x / B; else tmp = (1.0 + x) / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -14200.0], N[Not[LessEqual[x, 3.3e-9]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(N[(1.0 + x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -14200 \lor \neg \left(x \leq 3.3 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + x}{B}\\
\end{array}
\end{array}
if x < -14200 or 3.30000000000000018e-9 < x Initial program 99.6%
distribute-lft-neg-in99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in B around 0 49.3%
mul-1-neg49.3%
sub-neg49.3%
Simplified49.3%
Taylor expanded in x around inf 48.0%
mul-1-neg48.0%
distribute-neg-frac48.0%
Simplified48.0%
if -14200 < x < 3.30000000000000018e-9Initial program 99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in B around 0 47.0%
mul-1-neg47.0%
sub-neg47.0%
Simplified47.0%
expm1-log1p-u27.5%
expm1-udef27.3%
sub-neg27.3%
+-commutative27.3%
add-sqr-sqrt13.8%
sqrt-unprod27.3%
sqr-neg27.3%
unpow227.3%
unpow227.3%
sqrt-prod13.4%
add-sqr-sqrt26.5%
Applied egg-rr26.5%
expm1-def26.8%
expm1-log1p46.1%
Simplified46.1%
Final simplification47.1%
(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%
Simplified99.7%
Taylor expanded in B around 0 48.6%
+-commutative48.6%
mul-1-neg48.6%
sub-neg48.6%
associate--l+48.6%
*-commutative48.6%
div-sub48.7%
Simplified48.7%
Taylor expanded in x around 0 48.4%
*-commutative48.4%
Simplified48.4%
Final simplification48.4%
(FPCore (B x) :precision binary64 (if (or (<= x -14200.0) (not (<= x 3.3e-9))) (/ (- x) B) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -14200.0) || !(x <= 3.3e-9)) {
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 <= (-14200.0d0)) .or. (.not. (x <= 3.3d-9))) 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 <= -14200.0) || !(x <= 3.3e-9)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -14200.0) or not (x <= 3.3e-9): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -14200.0) || !(x <= 3.3e-9)) 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 <= -14200.0) || ~((x <= 3.3e-9))) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -14200.0], N[Not[LessEqual[x, 3.3e-9]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -14200 \lor \neg \left(x \leq 3.3 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -14200 or 3.30000000000000018e-9 < x Initial program 99.6%
distribute-lft-neg-in99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in B around 0 49.3%
mul-1-neg49.3%
sub-neg49.3%
Simplified49.3%
Taylor expanded in x around inf 48.0%
mul-1-neg48.0%
distribute-neg-frac48.0%
Simplified48.0%
if -14200 < x < 3.30000000000000018e-9Initial program 99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in B around 0 47.0%
mul-1-neg47.0%
sub-neg47.0%
Simplified47.0%
Taylor expanded in x around 0 46.1%
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%
*-commutative99.7%
Simplified99.7%
Taylor expanded in B around 0 48.3%
mul-1-neg48.3%
sub-neg48.3%
Simplified48.3%
Final simplification48.3%
(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%
Simplified99.7%
Taylor expanded in B around 0 48.3%
mul-1-neg48.3%
sub-neg48.3%
Simplified48.3%
Taylor expanded in x around 0 22.5%
Final simplification22.5%
herbie shell --seed 2023301
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))