
(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 12 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 (- (pow (sin B) -1.0) (/ x (tan B))))
double code(double B, double x) {
return pow(sin(B), -1.0) - (x / tan(B));
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (sin(b) ** (-1.0d0)) - (x / tan(b))
end function
public static double code(double B, double x) {
return Math.pow(Math.sin(B), -1.0) - (x / Math.tan(B));
}
def code(B, x): return math.pow(math.sin(B), -1.0) - (x / math.tan(B))
function code(B, x) return Float64((sin(B) ^ -1.0) - Float64(x / tan(B))) end
function tmp = code(B, x) tmp = (sin(B) ^ -1.0) - (x / tan(B)); end
code[B_, x_] := N[(N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\sin B}^{-1} - \frac{x}{\tan B}
\end{array}
Initial program 99.7%
distribute-lft-neg-in99.7%
+-commutative99.7%
*-commutative99.7%
remove-double-neg99.7%
distribute-frac-neg299.7%
tan-neg99.7%
cancel-sign-sub-inv99.7%
*-commutative99.7%
associate-*r/99.8%
*-rgt-identity99.8%
tan-neg99.8%
distribute-neg-frac299.8%
distribute-neg-frac99.8%
remove-double-neg99.8%
Simplified99.8%
inv-pow99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (B x) :precision binary64 (if (<= x -27000000000.0) (/ x (- (tan B))) (if (<= x 280.0) (- (/ 1.0 (sin B)) (/ x B)) (- (sin B) (/ x (tan B))))))
double code(double B, double x) {
double tmp;
if (x <= -27000000000.0) {
tmp = x / -tan(B);
} else if (x <= 280.0) {
tmp = (1.0 / sin(B)) - (x / B);
} else {
tmp = sin(B) - (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 <= (-27000000000.0d0)) then
tmp = x / -tan(b)
else if (x <= 280.0d0) then
tmp = (1.0d0 / sin(b)) - (x / b)
else
tmp = sin(b) - (x / tan(b))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (x <= -27000000000.0) {
tmp = x / -Math.tan(B);
} else if (x <= 280.0) {
tmp = (1.0 / Math.sin(B)) - (x / B);
} else {
tmp = Math.sin(B) - (x / Math.tan(B));
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -27000000000.0: tmp = x / -math.tan(B) elif x <= 280.0: tmp = (1.0 / math.sin(B)) - (x / B) else: tmp = math.sin(B) - (x / math.tan(B)) return tmp
function code(B, x) tmp = 0.0 if (x <= -27000000000.0) tmp = Float64(x / Float64(-tan(B))); elseif (x <= 280.0) tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B)); else tmp = Float64(sin(B) - Float64(x / tan(B))); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (x <= -27000000000.0) tmp = x / -tan(B); elseif (x <= 280.0) tmp = (1.0 / sin(B)) - (x / B); else tmp = sin(B) - (x / tan(B)); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -27000000000.0], N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[x, 280.0], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[Sin[B], $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -27000000000:\\
\;\;\;\;\frac{x}{-\tan B}\\
\mathbf{elif}\;x \leq 280:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\sin B - \frac{x}{\tan B}\\
\end{array}
\end{array}
if x < -2.7e10Initial program 99.6%
+-commutative99.6%
div-inv99.8%
sub-neg99.8%
frac-sub97.0%
associate-/r*99.8%
*-un-lft-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 99.8%
neg-mul-199.8%
Simplified99.8%
if -2.7e10 < x < 280Initial program 99.8%
Taylor expanded in B around 0 99.1%
if 280 < x Initial program 99.6%
distribute-lft-neg-in99.6%
+-commutative99.6%
*-commutative99.6%
remove-double-neg99.6%
distribute-frac-neg299.6%
tan-neg99.6%
cancel-sign-sub-inv99.6%
*-commutative99.6%
associate-*r/99.8%
*-rgt-identity99.8%
tan-neg99.8%
distribute-neg-frac299.8%
distribute-neg-frac99.8%
remove-double-neg99.8%
Simplified99.8%
add-exp-log62.1%
log-rec62.1%
Applied egg-rr62.1%
add-sqr-sqrt62.1%
sqrt-unprod62.1%
sqr-neg62.1%
sqrt-unprod0.0%
add-sqr-sqrt61.0%
add-exp-log98.7%
*-un-lft-identity98.7%
*-commutative98.7%
Applied egg-rr98.7%
*-rgt-identity98.7%
Simplified98.7%
Final simplification99.2%
(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%
*-commutative99.7%
remove-double-neg99.7%
distribute-frac-neg299.7%
tan-neg99.7%
cancel-sign-sub-inv99.7%
*-commutative99.7%
associate-*r/99.8%
*-rgt-identity99.8%
tan-neg99.8%
distribute-neg-frac299.8%
distribute-neg-frac99.8%
remove-double-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (B x) :precision binary64 (if (<= x -26000000000.0) (/ x (- (tan B))) (if (<= x 1.75) (- (/ 1.0 (sin B)) (/ x B)) (/ (- 1.0 x) (tan B)))))
double code(double B, double x) {
double tmp;
if (x <= -26000000000.0) {
tmp = x / -tan(B);
} else if (x <= 1.75) {
tmp = (1.0 / sin(B)) - (x / B);
} else {
tmp = (1.0 - 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 <= (-26000000000.0d0)) then
tmp = x / -tan(b)
else if (x <= 1.75d0) then
tmp = (1.0d0 / sin(b)) - (x / b)
else
tmp = (1.0d0 - x) / tan(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (x <= -26000000000.0) {
tmp = x / -Math.tan(B);
} else if (x <= 1.75) {
tmp = (1.0 / Math.sin(B)) - (x / B);
} else {
tmp = (1.0 - x) / Math.tan(B);
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -26000000000.0: tmp = x / -math.tan(B) elif x <= 1.75: tmp = (1.0 / math.sin(B)) - (x / B) else: tmp = (1.0 - x) / math.tan(B) return tmp
function code(B, x) tmp = 0.0 if (x <= -26000000000.0) tmp = Float64(x / Float64(-tan(B))); elseif (x <= 1.75) tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B)); else tmp = Float64(Float64(1.0 - x) / tan(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (x <= -26000000000.0) tmp = x / -tan(B); elseif (x <= 1.75) tmp = (1.0 / sin(B)) - (x / B); else tmp = (1.0 - x) / tan(B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -26000000000.0], N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[x, 1.75], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -26000000000:\\
\;\;\;\;\frac{x}{-\tan B}\\
\mathbf{elif}\;x \leq 1.75:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\tan B}\\
\end{array}
\end{array}
if x < -2.6e10Initial program 99.6%
+-commutative99.6%
div-inv99.8%
sub-neg99.8%
frac-sub97.0%
associate-/r*99.8%
*-un-lft-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 99.8%
neg-mul-199.8%
Simplified99.8%
if -2.6e10 < x < 1.75Initial program 99.8%
Taylor expanded in B around 0 99.1%
if 1.75 < x Initial program 99.6%
+-commutative99.6%
div-inv99.8%
sub-neg99.8%
frac-sub93.8%
associate-/r*99.7%
*-un-lft-identity99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in B around 0 98.7%
Final simplification99.2%
(FPCore (B x) :precision binary64 (if (or (<= x -1.12e-8) (not (<= x 4.5e-8))) (/ (- 1.0 x) (tan B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.12e-8) || !(x <= 4.5e-8)) {
tmp = (1.0 - 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.12d-8)) .or. (.not. (x <= 4.5d-8))) then
tmp = (1.0d0 - 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.12e-8) || !(x <= 4.5e-8)) {
tmp = (1.0 - x) / Math.tan(B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.12e-8) or not (x <= 4.5e-8): tmp = (1.0 - x) / math.tan(B) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.12e-8) || !(x <= 4.5e-8)) tmp = Float64(Float64(1.0 - 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.12e-8) || ~((x <= 4.5e-8))) tmp = (1.0 - x) / tan(B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.12e-8], N[Not[LessEqual[x, 4.5e-8]], $MachinePrecision]], N[(N[(1.0 - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{-8} \lor \neg \left(x \leq 4.5 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{1 - x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.11999999999999994e-8 or 4.49999999999999993e-8 < x Initial program 99.6%
+-commutative99.6%
div-inv99.8%
sub-neg99.8%
frac-sub93.4%
associate-/r*99.7%
*-un-lft-identity99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in B around 0 98.6%
if -1.11999999999999994e-8 < x < 4.49999999999999993e-8Initial program 99.8%
Taylor expanded in x around 0 99.6%
Final simplification99.1%
(FPCore (B x) :precision binary64 (if (or (<= x -1.32) (not (<= x 1.0))) (/ x (- (tan B))) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.32) || !(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.32d0)) .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.32) || !(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.32) 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.32) || !(x <= 1.0)) tmp = Float64(x / Float64(-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.32) || ~((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.32], 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.32 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{x}{-\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.32000000000000006 or 1 < x Initial program 99.6%
+-commutative99.6%
div-inv99.8%
sub-neg99.8%
frac-sub94.7%
associate-/r*99.8%
*-un-lft-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 99.0%
neg-mul-199.0%
Simplified99.0%
if -1.32000000000000006 < x < 1Initial program 99.8%
Taylor expanded in x around 0 98.2%
Final simplification98.6%
(FPCore (B x) :precision binary64 (if (<= B 0.00011) (+ (* B (+ 0.16666666666666666 (* x 0.3333333333333333))) (/ (- 1.0 x) B)) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if (B <= 0.00011) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((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 <= 0.00011d0) then
tmp = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + ((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 <= 0.00011) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if B <= 0.00011: tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if (B <= 0.00011) tmp = Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + 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 <= 0.00011) tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[B, 0.00011], N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.00011:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if B < 1.10000000000000004e-4Initial program 99.8%
Taylor expanded in B around 0 64.4%
associate--l+64.4%
*-commutative64.4%
div-sub64.4%
Simplified64.4%
if 1.10000000000000004e-4 < B Initial program 99.5%
Taylor expanded in x around 0 56.3%
Final simplification62.6%
(FPCore (B x) :precision binary64 (if (or (<= x -1.6e-24) (not (<= x 285.0))) (/ x (- B)) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -1.6e-24) || !(x <= 285.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.6d-24)) .or. (.not. (x <= 285.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.6e-24) || !(x <= 285.0)) {
tmp = x / -B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.6e-24) or not (x <= 285.0): tmp = x / -B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.6e-24) || !(x <= 285.0)) tmp = Float64(x / Float64(-B)); else tmp = Float64(1.0 / B); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -1.6e-24) || ~((x <= 285.0))) tmp = x / -B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.6e-24], N[Not[LessEqual[x, 285.0]], $MachinePrecision]], N[(x / (-B)), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-24} \lor \neg \left(x \leq 285\right):\\
\;\;\;\;\frac{x}{-B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -1.60000000000000006e-24 or 285 < x Initial program 99.6%
Taylor expanded in B around 0 53.3%
Taylor expanded in x around inf 53.1%
neg-mul-153.1%
distribute-neg-frac253.1%
Simplified53.1%
if -1.60000000000000006e-24 < x < 285Initial program 99.8%
Taylor expanded in B around 0 48.8%
clear-num48.8%
associate-/r/48.8%
Applied egg-rr48.8%
Taylor expanded in x around 0 47.9%
Final simplification50.5%
(FPCore (B x) :precision binary64 (+ (* B (+ 0.16666666666666666 (* x 0.3333333333333333))) (/ (- 1.0 x) B)))
double code(double B, double x) {
return (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + ((1.0d0 - x) / b)
end function
public static double code(double B, double x) {
return (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
}
def code(B, x): return (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B)
function code(B, x) return Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + Float64(Float64(1.0 - x) / B)) end
function tmp = code(B, x) tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B); end
code[B_, x_] := N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}
\end{array}
Initial program 99.7%
Taylor expanded in B around 0 51.3%
associate--l+51.3%
*-commutative51.3%
div-sub51.3%
Simplified51.3%
Final simplification51.3%
(FPCore (B x) :precision binary64 (- (+ (* B 0.16666666666666666) (/ 1.0 B)) (/ x B)))
double code(double B, double x) {
return ((B * 0.16666666666666666) + (1.0 / B)) - (x / B);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = ((b * 0.16666666666666666d0) + (1.0d0 / b)) - (x / b)
end function
public static double code(double B, double x) {
return ((B * 0.16666666666666666) + (1.0 / B)) - (x / B);
}
def code(B, x): return ((B * 0.16666666666666666) + (1.0 / B)) - (x / B)
function code(B, x) return Float64(Float64(Float64(B * 0.16666666666666666) + Float64(1.0 / B)) - Float64(x / B)) end
function tmp = code(B, x) tmp = ((B * 0.16666666666666666) + (1.0 / B)) - (x / B); end
code[B_, x_] := N[(N[(N[(B * 0.16666666666666666), $MachinePrecision] + N[(1.0 / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(B \cdot 0.16666666666666666 + \frac{1}{B}\right) - \frac{x}{B}
\end{array}
Initial program 99.7%
div-inv99.8%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in B around 0 63.6%
Taylor expanded in B around 0 51.3%
Final simplification51.3%
(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 51.0%
Final simplification51.0%
(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 51.0%
clear-num51.0%
associate-/r/51.0%
Applied egg-rr51.0%
Taylor expanded in x around 0 25.7%
Final simplification25.7%
herbie shell --seed 2024039
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))