
(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%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (B x) :precision binary64 (if (or (<= x -1.25e+64) (not (<= x 1.8e+20))) (- (+ (* B 0.16666666666666666) (/ 1.0 B)) (/ x (tan B))) (- (/ 1.0 (sin B)) (/ x B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.25e+64) || !(x <= 1.8e+20)) {
tmp = ((B * 0.16666666666666666) + (1.0 / B)) - (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 <= (-1.25d+64)) .or. (.not. (x <= 1.8d+20))) then
tmp = ((b * 0.16666666666666666d0) + (1.0d0 / b)) - (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 <= -1.25e+64) || !(x <= 1.8e+20)) {
tmp = ((B * 0.16666666666666666) + (1.0 / B)) - (x / Math.tan(B));
} else {
tmp = (1.0 / Math.sin(B)) - (x / B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.25e+64) or not (x <= 1.8e+20): tmp = ((B * 0.16666666666666666) + (1.0 / B)) - (x / math.tan(B)) else: tmp = (1.0 / math.sin(B)) - (x / B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.25e+64) || !(x <= 1.8e+20)) tmp = Float64(Float64(Float64(B * 0.16666666666666666) + Float64(1.0 / B)) - 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 <= -1.25e+64) || ~((x <= 1.8e+20))) tmp = ((B * 0.16666666666666666) + (1.0 / B)) - (x / tan(B)); else tmp = (1.0 / sin(B)) - (x / B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.25e+64], N[Not[LessEqual[x, 1.8e+20]], $MachinePrecision]], N[(N[(N[(B * 0.16666666666666666), $MachinePrecision] + N[(1.0 / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $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 -1.25 \cdot 10^{+64} \lor \neg \left(x \leq 1.8 \cdot 10^{+20}\right):\\
\;\;\;\;\left(B \cdot 0.16666666666666666 + \frac{1}{B}\right) - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -1.25e64 or 1.8e20 < 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 76.8%
if -1.25e64 < x < 1.8e20Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 95.0%
Final simplification88.3%
(FPCore (B x)
:precision binary64
(let* ((t_0 (+ (* B 0.16666666666666666) (/ 1.0 B))))
(if (<= x -1.05e+64)
(+ (/ -1.0 (/ (tan B) x)) t_0)
(if (<= x 7.5e+19) (- (/ 1.0 (sin B)) (/ x B)) (- t_0 (/ x (tan B)))))))
double code(double B, double x) {
double t_0 = (B * 0.16666666666666666) + (1.0 / B);
double tmp;
if (x <= -1.05e+64) {
tmp = (-1.0 / (tan(B) / x)) + t_0;
} else if (x <= 7.5e+19) {
tmp = (1.0 / sin(B)) - (x / B);
} else {
tmp = t_0 - (x / tan(B));
}
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 = (b * 0.16666666666666666d0) + (1.0d0 / b)
if (x <= (-1.05d+64)) then
tmp = ((-1.0d0) / (tan(b) / x)) + t_0
else if (x <= 7.5d+19) then
tmp = (1.0d0 / sin(b)) - (x / b)
else
tmp = t_0 - (x / tan(b))
end if
code = tmp
end function
public static double code(double B, double x) {
double t_0 = (B * 0.16666666666666666) + (1.0 / B);
double tmp;
if (x <= -1.05e+64) {
tmp = (-1.0 / (Math.tan(B) / x)) + t_0;
} else if (x <= 7.5e+19) {
tmp = (1.0 / Math.sin(B)) - (x / B);
} else {
tmp = t_0 - (x / Math.tan(B));
}
return tmp;
}
def code(B, x): t_0 = (B * 0.16666666666666666) + (1.0 / B) tmp = 0 if x <= -1.05e+64: tmp = (-1.0 / (math.tan(B) / x)) + t_0 elif x <= 7.5e+19: tmp = (1.0 / math.sin(B)) - (x / B) else: tmp = t_0 - (x / math.tan(B)) return tmp
function code(B, x) t_0 = Float64(Float64(B * 0.16666666666666666) + Float64(1.0 / B)) tmp = 0.0 if (x <= -1.05e+64) tmp = Float64(Float64(-1.0 / Float64(tan(B) / x)) + t_0); elseif (x <= 7.5e+19) tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B)); else tmp = Float64(t_0 - Float64(x / tan(B))); end return tmp end
function tmp_2 = code(B, x) t_0 = (B * 0.16666666666666666) + (1.0 / B); tmp = 0.0; if (x <= -1.05e+64) tmp = (-1.0 / (tan(B) / x)) + t_0; elseif (x <= 7.5e+19) tmp = (1.0 / sin(B)) - (x / B); else tmp = t_0 - (x / tan(B)); end tmp_2 = tmp; end
code[B_, x_] := Block[{t$95$0 = N[(N[(B * 0.16666666666666666), $MachinePrecision] + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.05e+64], N[(N[(-1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x, 7.5e+19], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := B \cdot 0.16666666666666666 + \frac{1}{B}\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{+64}:\\
\;\;\;\;\frac{-1}{\frac{\tan B}{x}} + t_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+19}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;t_0 - \frac{x}{\tan B}\\
\end{array}
\end{array}
if x < -1.05e64Initial program 99.5%
distribute-lft-neg-in99.5%
Simplified99.5%
un-div-inv99.6%
neg-mul-199.6%
associate-/l*99.6%
Applied egg-rr99.6%
Taylor expanded in B around 0 81.9%
if -1.05e64 < x < 7.5e19Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 95.0%
if 7.5e19 < x Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.9%
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in B around 0 73.1%
Final simplification88.3%
(FPCore (B x) :precision binary64 (/ (/ (- B (* B x)) (sin B)) B))
double code(double B, double x) {
return ((B - (B * x)) / sin(B)) / B;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = ((b - (b * x)) / sin(b)) / b
end function
public static double code(double B, double x) {
return ((B - (B * x)) / Math.sin(B)) / B;
}
def code(B, x): return ((B - (B * x)) / math.sin(B)) / B
function code(B, x) return Float64(Float64(Float64(B - Float64(B * x)) / sin(B)) / B) end
function tmp = code(B, x) tmp = ((B - (B * x)) / sin(B)) / B; end
code[B_, x_] := N[(N[(N[(B - N[(B * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{B - B \cdot x}{\sin B}}{B}
\end{array}
Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 78.9%
frac-sub61.8%
associate-/r*78.5%
*-un-lft-identity78.5%
*-commutative78.5%
Applied egg-rr78.5%
Taylor expanded in B around 0 79.5%
Final simplification79.5%
(FPCore (B x)
:precision binary64
(let* ((t_0 (/ (- 1.0 x) B)))
(if (<= x -58000000.0)
(+ (* B (+ 0.16666666666666666 (* x 0.3333333333333333))) t_0)
(if (<= x 7.8e-13) (/ 1.0 (sin B)) (+ (* B 0.16666666666666666) t_0)))))
double code(double B, double x) {
double t_0 = (1.0 - x) / B;
double tmp;
if (x <= -58000000.0) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0;
} else if (x <= 7.8e-13) {
tmp = 1.0 / sin(B);
} else {
tmp = (B * 0.16666666666666666) + t_0;
}
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 <= (-58000000.0d0)) then
tmp = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + t_0
else if (x <= 7.8d-13) then
tmp = 1.0d0 / sin(b)
else
tmp = (b * 0.16666666666666666d0) + t_0
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 <= -58000000.0) {
tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0;
} else if (x <= 7.8e-13) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = (B * 0.16666666666666666) + t_0;
}
return tmp;
}
def code(B, x): t_0 = (1.0 - x) / B tmp = 0 if x <= -58000000.0: tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0 elif x <= 7.8e-13: tmp = 1.0 / math.sin(B) else: tmp = (B * 0.16666666666666666) + t_0 return tmp
function code(B, x) t_0 = Float64(Float64(1.0 - x) / B) tmp = 0.0 if (x <= -58000000.0) tmp = Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + t_0); elseif (x <= 7.8e-13) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(B * 0.16666666666666666) + t_0); end return tmp end
function tmp_2 = code(B, x) t_0 = (1.0 - x) / B; tmp = 0.0; if (x <= -58000000.0) tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + t_0; elseif (x <= 7.8e-13) tmp = 1.0 / sin(B); else tmp = (B * 0.16666666666666666) + t_0; end tmp_2 = tmp; end
code[B_, x_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[x, -58000000.0], N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x, 7.8e-13], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(B * 0.16666666666666666), $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{B}\\
\mathbf{if}\;x \leq -58000000:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + t_0\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;B \cdot 0.16666666666666666 + t_0\\
\end{array}
\end{array}
if x < -5.8e7Initial program 99.5%
+-commutative99.5%
unsub-neg99.5%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 55.6%
*-commutative55.6%
Simplified55.6%
Taylor expanded in B around 0 55.6%
associate--l+55.6%
*-commutative55.6%
sub-neg55.6%
*-commutative55.6%
distribute-rgt-neg-in55.6%
metadata-eval55.6%
div-sub55.6%
Simplified55.6%
if -5.8e7 < x < 7.80000000000000009e-13Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 98.4%
Taylor expanded in B around inf 98.3%
if 7.80000000000000009e-13 < x Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.9%
*-rgt-identity99.9%
Simplified99.9%
Taylor expanded in B around 0 52.2%
Taylor expanded in B around 0 52.3%
associate--l+52.3%
*-commutative52.3%
div-sub52.3%
Simplified52.3%
Final simplification79.2%
(FPCore (B x) :precision binary64 (- (/ 1.0 (sin B)) (/ x B)))
double code(double B, double x) {
return (1.0 / sin(B)) - (x / B);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (1.0d0 / sin(b)) - (x / b)
end function
public static double code(double B, double x) {
return (1.0 / Math.sin(B)) - (x / B);
}
def code(B, x): return (1.0 / math.sin(B)) - (x / B)
function code(B, x) return Float64(Float64(1.0 / sin(B)) - Float64(x / B)) end
function tmp = code(B, x) tmp = (1.0 / sin(B)) - (x / B); end
code[B_, x_] := N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sin B} - \frac{x}{B}
\end{array}
Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 78.9%
Final simplification78.9%
(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%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 62.4%
*-commutative62.4%
Simplified62.4%
Taylor expanded in B around 0 53.9%
associate--l+53.9%
*-commutative53.9%
sub-neg53.9%
*-commutative53.9%
distribute-rgt-neg-in53.9%
metadata-eval53.9%
div-sub53.9%
Simplified53.9%
Final simplification53.9%
(FPCore (B x) :precision binary64 (+ (* B 0.16666666666666666) (/ (- 1.0 x) B)))
double code(double B, double x) {
return (B * 0.16666666666666666) + ((1.0 - x) / B);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (b * 0.16666666666666666d0) + ((1.0d0 - x) / b)
end function
public static double code(double B, double x) {
return (B * 0.16666666666666666) + ((1.0 - x) / B);
}
def code(B, x): return (B * 0.16666666666666666) + ((1.0 - x) / B)
function code(B, x) return Float64(Float64(B * 0.16666666666666666) + Float64(Float64(1.0 - x) / B)) end
function tmp = code(B, x) tmp = (B * 0.16666666666666666) + ((1.0 - x) / B); end
code[B_, x_] := N[(N[(B * 0.16666666666666666), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
B \cdot 0.16666666666666666 + \frac{1 - x}{B}
\end{array}
Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 78.9%
Taylor expanded in B around 0 53.8%
associate--l+53.8%
*-commutative53.8%
div-sub53.8%
Simplified53.8%
Final simplification53.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%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 78.9%
Taylor expanded in B around 0 53.6%
Final simplification53.6%
(FPCore (B x) :precision binary64 (/ (- x) B))
double code(double B, double x) {
return -x / B;
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -x / b
end function
public static double code(double B, double x) {
return -x / B;
}
def code(B, x): return -x / B
function code(B, x) return Float64(Float64(-x) / B) end
function tmp = code(B, x) tmp = -x / B; end
code[B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{B}
\end{array}
Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 78.9%
Taylor expanded in x around inf 23.8%
mul-1-neg23.8%
distribute-frac-neg23.8%
Simplified23.8%
Final simplification23.8%
(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%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 78.9%
Taylor expanded in B around 0 53.8%
associate--l+53.8%
*-commutative53.8%
div-sub53.8%
Simplified53.8%
clear-num53.8%
inv-pow53.8%
sub-neg53.8%
add-sqr-sqrt24.6%
sqrt-unprod42.2%
sqr-neg42.2%
sqrt-unprod18.0%
add-sqr-sqrt32.3%
Applied egg-rr32.3%
unpow-132.3%
+-commutative32.3%
Simplified32.3%
Taylor expanded in B around inf 3.1%
*-commutative3.1%
Simplified3.1%
Final simplification3.1%
herbie shell --seed 2023200
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))