
(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 11 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 -58000000000.0) (not (<= x 165000.0))) (/ (- x) (tan B)) (- (/ 1.0 (sin B)) (/ x B))))
double code(double B, double x) {
double tmp;
if ((x <= -58000000000.0) || !(x <= 165000.0)) {
tmp = -x / tan(B);
} else {
tmp = (1.0 / sin(B)) - (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 <= (-58000000000.0d0)) .or. (.not. (x <= 165000.0d0))) then
tmp = -x / tan(b)
else
tmp = (1.0d0 / sin(b)) - (x / b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -58000000000.0) || !(x <= 165000.0)) {
tmp = -x / Math.tan(B);
} else {
tmp = (1.0 / Math.sin(B)) - (x / B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -58000000000.0) or not (x <= 165000.0): tmp = -x / math.tan(B) else: tmp = (1.0 / math.sin(B)) - (x / B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -58000000000.0) || !(x <= 165000.0)) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -58000000000.0) || ~((x <= 165000.0))) tmp = -x / tan(B); else tmp = (1.0 / sin(B)) - (x / B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -58000000000.0], N[Not[LessEqual[x, 165000.0]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -58000000000 \lor \neg \left(x \leq 165000\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -5.8e10 or 165000 < x Initial program 99.6%
+-commutative99.6%
div-inv99.8%
sub-neg99.8%
clear-num99.6%
frac-sub90.5%
*-un-lft-identity90.5%
*-commutative90.5%
*-un-lft-identity90.5%
Applied egg-rr90.5%
associate-/r*99.6%
associate-/r/99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in x around inf 98.8%
mul-1-neg98.8%
Simplified98.8%
associate-/l*98.9%
tan-quot98.9%
expm1-log1p-u50.4%
expm1-udef50.4%
Applied egg-rr50.4%
expm1-def50.4%
expm1-log1p98.9%
Simplified98.9%
if -5.8e10 < x < 165000Initial program 99.8%
Taylor expanded in B around 0 97.8%
Final simplification98.3%
(FPCore (B x) :precision binary64 (if (<= x -1.22) (* x (/ (+ (/ 1.0 x) -1.0) (tan B))) (if (<= x 3000.0) (- (/ 1.0 (sin B)) (/ x B)) (/ (- x) (tan B)))))
double code(double B, double x) {
double tmp;
if (x <= -1.22) {
tmp = x * (((1.0 / x) + -1.0) / tan(B));
} else if (x <= 3000.0) {
tmp = (1.0 / sin(B)) - (x / B);
} else {
tmp = -x / 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.22d0)) then
tmp = x * (((1.0d0 / x) + (-1.0d0)) / tan(b))
else if (x <= 3000.0d0) then
tmp = (1.0d0 / sin(b)) - (x / b)
else
tmp = -x / tan(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (x <= -1.22) {
tmp = x * (((1.0 / x) + -1.0) / Math.tan(B));
} else if (x <= 3000.0) {
tmp = (1.0 / Math.sin(B)) - (x / B);
} else {
tmp = -x / Math.tan(B);
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -1.22: tmp = x * (((1.0 / x) + -1.0) / math.tan(B)) elif x <= 3000.0: tmp = (1.0 / math.sin(B)) - (x / B) else: tmp = -x / math.tan(B) return tmp
function code(B, x) tmp = 0.0 if (x <= -1.22) tmp = Float64(x * Float64(Float64(Float64(1.0 / x) + -1.0) / tan(B))); elseif (x <= 3000.0) tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B)); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (x <= -1.22) tmp = x * (((1.0 / x) + -1.0) / tan(B)); elseif (x <= 3000.0) tmp = (1.0 / sin(B)) - (x / B); else tmp = -x / tan(B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -1.22], N[(x * N[(N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3000.0], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.22:\\
\;\;\;\;x \cdot \frac{\frac{1}{x} + -1}{\tan B}\\
\mathbf{elif}\;x \leq 3000:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if x < -1.21999999999999997Initial program 99.6%
+-commutative99.6%
div-inv99.7%
sub-neg99.7%
clear-num99.6%
frac-sub89.6%
*-un-lft-identity89.6%
*-commutative89.6%
*-un-lft-identity89.6%
Applied egg-rr89.6%
associate-/r*99.5%
associate-/r/99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in B around 0 98.4%
if -1.21999999999999997 < x < 3e3Initial program 99.8%
Taylor expanded in B around 0 98.5%
if 3e3 < x Initial program 99.7%
+-commutative99.7%
div-inv99.8%
sub-neg99.8%
clear-num99.6%
frac-sub92.1%
*-un-lft-identity92.1%
*-commutative92.1%
*-un-lft-identity92.1%
Applied egg-rr92.1%
associate-/r*99.6%
associate-/r/99.7%
div-sub99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in x around inf 98.4%
mul-1-neg98.4%
Simplified98.4%
associate-/l*98.4%
tan-quot98.5%
expm1-log1p-u45.2%
expm1-udef45.2%
Applied egg-rr45.2%
expm1-def45.2%
expm1-log1p98.5%
Simplified98.5%
Final simplification98.5%
(FPCore (B x) :precision binary64 (if (or (<= x -1.8) (not (<= x 1.15))) (/ (- x) (tan B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.8) || !(x <= 1.15)) {
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.8d0)) .or. (.not. (x <= 1.15d0))) 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.8) || !(x <= 1.15)) {
tmp = -x / Math.tan(B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.8) or not (x <= 1.15): tmp = -x / math.tan(B) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.8) || !(x <= 1.15)) 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.8) || ~((x <= 1.15))) tmp = -x / tan(B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.8], N[Not[LessEqual[x, 1.15]], $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.8 \lor \neg \left(x \leq 1.15\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.80000000000000004 or 1.1499999999999999 < x Initial program 99.6%
+-commutative99.6%
div-inv99.8%
sub-neg99.8%
clear-num99.6%
frac-sub90.8%
*-un-lft-identity90.8%
*-commutative90.8%
*-un-lft-identity90.8%
Applied egg-rr90.8%
associate-/r*99.5%
associate-/r/99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
Simplified97.7%
associate-/l*97.8%
tan-quot97.8%
expm1-log1p-u49.4%
expm1-udef49.4%
Applied egg-rr49.4%
expm1-def49.4%
expm1-log1p97.8%
Simplified97.8%
if -1.80000000000000004 < x < 1.1499999999999999Initial program 99.8%
Taylor expanded in x around 0 98.3%
Final simplification98.0%
(FPCore (B x) :precision binary64 (if (<= B 1.35e-9) (/ (- 1.0 x) B) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if (B <= 1.35e-9) {
tmp = (1.0 - x) / 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 (b <= 1.35d-9) then
tmp = (1.0d0 - x) / b
else
tmp = 1.0d0 / sin(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (B <= 1.35e-9) {
tmp = (1.0 - x) / B;
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if B <= 1.35e-9: tmp = (1.0 - x) / B else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if (B <= 1.35e-9) tmp = Float64(Float64(1.0 - x) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (B <= 1.35e-9) tmp = (1.0 - x) / B; else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[B, 1.35e-9], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.35 \cdot 10^{-9}:\\
\;\;\;\;\frac{1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if B < 1.3500000000000001e-9Initial program 99.8%
Taylor expanded in B around 0 62.6%
if 1.3500000000000001e-9 < B Initial program 99.6%
Taylor expanded in x around 0 59.1%
Final simplification61.7%
(FPCore (B x) :precision binary64 (if (or (<= x -820000.0) (not (<= x 265000.0))) (/ (- x) B) (/ (+ 1.0 x) B)))
double code(double B, double x) {
double tmp;
if ((x <= -820000.0) || !(x <= 265000.0)) {
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 <= (-820000.0d0)) .or. (.not. (x <= 265000.0d0))) 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 <= -820000.0) || !(x <= 265000.0)) {
tmp = -x / B;
} else {
tmp = (1.0 + x) / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -820000.0) or not (x <= 265000.0): tmp = -x / B else: tmp = (1.0 + x) / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -820000.0) || !(x <= 265000.0)) 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 <= -820000.0) || ~((x <= 265000.0))) tmp = -x / B; else tmp = (1.0 + x) / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -820000.0], N[Not[LessEqual[x, 265000.0]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(N[(1.0 + x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -820000 \lor \neg \left(x \leq 265000\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + x}{B}\\
\end{array}
\end{array}
if x < -8.2e5 or 265000 < x Initial program 99.6%
Taylor expanded in B around 0 48.2%
Taylor expanded in x around inf 47.4%
neg-mul-147.4%
distribute-neg-frac47.4%
Simplified47.4%
if -8.2e5 < x < 265000Initial 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%
Taylor expanded in B around 0 45.1%
add-sqr-sqrt26.6%
sqrt-unprod39.1%
sqr-neg39.1%
div-inv39.1%
div-inv39.1%
sqrt-unprod18.5%
add-sqr-sqrt44.9%
div-inv44.9%
neg-mul-144.9%
*-commutative44.9%
Applied egg-rr44.9%
Taylor expanded in B around 0 45.1%
sub-neg45.1%
mul-1-neg45.1%
remove-double-neg45.1%
Simplified45.1%
Final simplification46.2%
(FPCore (B x) :precision binary64 (if (or (<= x -820000.0) (not (<= x 265000.0))) (/ (- x) B) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -820000.0) || !(x <= 265000.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 <= (-820000.0d0)) .or. (.not. (x <= 265000.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 <= -820000.0) || !(x <= 265000.0)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -820000.0) or not (x <= 265000.0): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -820000.0) || !(x <= 265000.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 <= -820000.0) || ~((x <= 265000.0))) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -820000.0], N[Not[LessEqual[x, 265000.0]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -820000 \lor \neg \left(x \leq 265000\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -8.2e5 or 265000 < x Initial program 99.6%
Taylor expanded in B around 0 48.2%
Taylor expanded in x around inf 47.4%
neg-mul-147.4%
distribute-neg-frac47.4%
Simplified47.4%
if -8.2e5 < x < 265000Initial program 99.8%
Taylor expanded in B around 0 45.2%
Taylor expanded in x around 0 45.0%
Final simplification46.2%
(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%
cancel-sign-sub-inv99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
add-sqr-sqrt45.8%
pow245.8%
inv-pow45.8%
sqrt-pow145.8%
metadata-eval45.8%
Applied egg-rr45.8%
Taylor expanded in B around 0 46.8%
neg-mul-146.8%
+-commutative46.8%
associate-+r+46.8%
+-commutative46.8%
sub-neg46.8%
div-sub46.8%
*-commutative46.8%
*-commutative46.8%
associate-*l*46.8%
Simplified46.8%
Final simplification46.8%
(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%
Taylor expanded in B around 0 46.7%
Final simplification46.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%
cancel-sign-sub-inv99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in B around 0 59.5%
add-sqr-sqrt32.8%
sqrt-unprod31.8%
sqr-neg31.8%
div-inv31.8%
div-inv31.8%
sqrt-unprod9.7%
add-sqr-sqrt23.6%
div-inv23.6%
neg-mul-123.6%
*-commutative23.6%
Applied egg-rr23.6%
Taylor expanded in B around inf 3.2%
*-commutative3.2%
Simplified3.2%
Final simplification3.2%
(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%
Taylor expanded in B around 0 46.7%
Taylor expanded in x around 0 24.5%
Final simplification24.5%
herbie shell --seed 2024017
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))