
(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 (* (cos B) x)) (sin B)))
double code(double B, double x) {
return (1.0 - (cos(B) * x)) / sin(B);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (1.0d0 - (cos(b) * x)) / sin(b)
end function
public static double code(double B, double x) {
return (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
def code(B, x): return (1.0 - (math.cos(B) * x)) / math.sin(B)
function code(B, x) return Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)) end
function tmp = code(B, x) tmp = (1.0 - (cos(B) * x)) / sin(B); end
code[B_, x_] := N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - \cos B \cdot x}{\sin B}
\end{array}
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%
sub-div99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (B x)
:precision binary64
(if (<= x -390000000.0)
(/ (* (cos B) (- x)) (sin B))
(if (<= x 1.35)
(/ (- 1.0 x) (sin B))
(* x (/ (+ (/ 1.0 x) -1.0) (tan B))))))
double code(double B, double x) {
double tmp;
if (x <= -390000000.0) {
tmp = (cos(B) * -x) / sin(B);
} else if (x <= 1.35) {
tmp = (1.0 - x) / 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 <= (-390000000.0d0)) then
tmp = (cos(b) * -x) / sin(b)
else if (x <= 1.35d0) then
tmp = (1.0d0 - x) / 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 <= -390000000.0) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else if (x <= 1.35) {
tmp = (1.0 - x) / Math.sin(B);
} else {
tmp = x * (((1.0 / x) + -1.0) / Math.tan(B));
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -390000000.0: tmp = (math.cos(B) * -x) / math.sin(B) elif x <= 1.35: tmp = (1.0 - x) / 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 <= -390000000.0) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); elseif (x <= 1.35) tmp = Float64(Float64(1.0 - x) / 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 <= -390000000.0) tmp = (cos(B) * -x) / sin(B); elseif (x <= 1.35) tmp = (1.0 - x) / sin(B); else tmp = x * (((1.0 / x) + -1.0) / tan(B)); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -390000000.0], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35], N[(N[(1.0 - x), $MachinePrecision] / 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 -390000000:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{elif}\;x \leq 1.35:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{x} + -1}{\tan B}\\
\end{array}
\end{array}
if x < -3.9e8Initial program 99.6%
+-commutative99.6%
unsub-neg99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
sub-div99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 99.7%
associate-*r/99.7%
neg-mul-199.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
if -3.9e8 < x < 1.3500000000000001Initial program 99.8%
+-commutative99.8%
unsub-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
sub-div99.8%
Applied egg-rr99.8%
Taylor expanded in B around 0 99.2%
if 1.3500000000000001 < x Initial program 99.7%
distribute-lft-neg-in99.7%
Simplified99.7%
+-commutative99.7%
cancel-sign-sub-inv99.7%
div-inv99.7%
clear-num99.6%
frac-sub84.5%
*-un-lft-identity84.5%
*-commutative84.5%
*-un-lft-identity84.5%
Applied egg-rr84.5%
associate-/r*99.6%
associate-/r/99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in B around 0 98.8%
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%
+-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 -12.0) (not (<= x 1.05))) (* x (/ (+ (/ 1.0 x) -1.0) (tan B))) (/ (- 1.0 x) (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -12.0) || !(x <= 1.05)) {
tmp = x * (((1.0 / x) + -1.0) / tan(B));
} else {
tmp = (1.0 - x) / 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 <= (-12.0d0)) .or. (.not. (x <= 1.05d0))) then
tmp = x * (((1.0d0 / x) + (-1.0d0)) / tan(b))
else
tmp = (1.0d0 - x) / sin(b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if ((x <= -12.0) || !(x <= 1.05)) {
tmp = x * (((1.0 / x) + -1.0) / Math.tan(B));
} else {
tmp = (1.0 - x) / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -12.0) or not (x <= 1.05): tmp = x * (((1.0 / x) + -1.0) / math.tan(B)) else: tmp = (1.0 - x) / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -12.0) || !(x <= 1.05)) tmp = Float64(x * Float64(Float64(Float64(1.0 / x) + -1.0) / tan(B))); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if ((x <= -12.0) || ~((x <= 1.05))) tmp = x * (((1.0 / x) + -1.0) / tan(B)); else tmp = (1.0 - x) / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -12.0], N[Not[LessEqual[x, 1.05]], $MachinePrecision]], N[(x * N[(N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -12 \lor \neg \left(x \leq 1.05\right):\\
\;\;\;\;x \cdot \frac{\frac{1}{x} + -1}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if x < -12 or 1.05000000000000004 < x Initial program 99.7%
distribute-lft-neg-in99.7%
Simplified99.7%
+-commutative99.7%
cancel-sign-sub-inv99.7%
div-inv99.7%
clear-num99.6%
frac-sub85.8%
*-un-lft-identity85.8%
*-commutative85.8%
*-un-lft-identity85.8%
Applied egg-rr85.8%
associate-/r*99.6%
associate-/r/99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in B around 0 99.1%
if -12 < x < 1.05000000000000004Initial program 99.8%
+-commutative99.8%
unsub-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
sub-div99.8%
Applied egg-rr99.8%
Taylor expanded in B around 0 99.2%
Final simplification99.2%
(FPCore (B x)
:precision binary64
(let* ((t_0 (/ (- 1.0 x) B)))
(if (<= x -4e-7)
(+ (* 0.3333333333333333 (* B x)) t_0)
(if (<= x 900.0) (/ 1.0 (sin B)) (+ t_0 (* B 0.16666666666666666))))))
double code(double B, double x) {
double t_0 = (1.0 - x) / B;
double tmp;
if (x <= -4e-7) {
tmp = (0.3333333333333333 * (B * x)) + t_0;
} else if (x <= 900.0) {
tmp = 1.0 / sin(B);
} else {
tmp = t_0 + (B * 0.16666666666666666);
}
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 <= (-4d-7)) then
tmp = (0.3333333333333333d0 * (b * x)) + t_0
else if (x <= 900.0d0) then
tmp = 1.0d0 / sin(b)
else
tmp = t_0 + (b * 0.16666666666666666d0)
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 <= -4e-7) {
tmp = (0.3333333333333333 * (B * x)) + t_0;
} else if (x <= 900.0) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = t_0 + (B * 0.16666666666666666);
}
return tmp;
}
def code(B, x): t_0 = (1.0 - x) / B tmp = 0 if x <= -4e-7: tmp = (0.3333333333333333 * (B * x)) + t_0 elif x <= 900.0: tmp = 1.0 / math.sin(B) else: tmp = t_0 + (B * 0.16666666666666666) return tmp
function code(B, x) t_0 = Float64(Float64(1.0 - x) / B) tmp = 0.0 if (x <= -4e-7) tmp = Float64(Float64(0.3333333333333333 * Float64(B * x)) + t_0); elseif (x <= 900.0) tmp = Float64(1.0 / sin(B)); else tmp = Float64(t_0 + Float64(B * 0.16666666666666666)); end return tmp end
function tmp_2 = code(B, x) t_0 = (1.0 - x) / B; tmp = 0.0; if (x <= -4e-7) tmp = (0.3333333333333333 * (B * x)) + t_0; elseif (x <= 900.0) tmp = 1.0 / sin(B); else tmp = t_0 + (B * 0.16666666666666666); end tmp_2 = tmp; end
code[B_, x_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[x, -4e-7], N[(N[(0.3333333333333333 * N[(B * x), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x, 900.0], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(B * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{B}\\
\mathbf{if}\;x \leq -4 \cdot 10^{-7}:\\
\;\;\;\;0.3333333333333333 \cdot \left(B \cdot x\right) + t_0\\
\mathbf{elif}\;x \leq 900:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t_0 + B \cdot 0.16666666666666666\\
\end{array}
\end{array}
if x < -3.9999999999999998e-7Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
Taylor expanded in B around 0 48.9%
+-commutative48.9%
mul-1-neg48.9%
sub-neg48.9%
associate--l+48.9%
*-commutative48.9%
*-commutative48.9%
div-sub48.9%
Simplified48.9%
Taylor expanded in x around inf 48.9%
if -3.9999999999999998e-7 < x < 900Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 98.4%
if 900 < x Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 74.3%
Taylor expanded in B around 0 51.5%
associate--l+51.5%
*-commutative51.5%
sub-div51.5%
Applied egg-rr51.5%
Final simplification72.7%
(FPCore (B x) :precision binary64 (/ (- 1.0 x) (sin B)))
double code(double B, double x) {
return (1.0 - x) / sin(B);
}
real(8) function code(b, x)
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (1.0d0 - x) / sin(b)
end function
public static double code(double B, double x) {
return (1.0 - x) / Math.sin(B);
}
def code(B, x): return (1.0 - x) / math.sin(B)
function code(B, x) return Float64(Float64(1.0 - x) / sin(B)) end
function tmp = code(B, x) tmp = (1.0 - x) / sin(B); end
code[B_, x_] := N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{\sin B}
\end{array}
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%
sub-div99.8%
Applied egg-rr99.8%
Taylor expanded in B around 0 75.2%
Final simplification75.2%
(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%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 58.6%
Taylor expanded in B around 0 47.1%
associate--l+47.1%
*-commutative47.1%
sub-div47.1%
Applied egg-rr47.1%
Final simplification47.1%
(FPCore (B x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.95e-18))) (/ (- x) B) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.95e-18)) {
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.95d-18))) 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.95e-18)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.0) or not (x <= 1.95e-18): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.95e-18)) 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.95e-18))) 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.95e-18]], $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.95 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -1 or 1.95000000000000002e-18 < x Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in B around 0 69.9%
Taylor expanded in B around 0 48.8%
Taylor expanded in x around inf 46.5%
neg-mul-146.5%
distribute-neg-frac46.5%
Simplified46.5%
if -1 < x < 1.95000000000000002e-18Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
+-commutative99.8%
cancel-sign-sub-inv99.8%
div-inv99.8%
clear-num99.8%
frac-sub87.9%
*-un-lft-identity87.9%
*-commutative87.9%
*-un-lft-identity87.9%
Applied egg-rr87.9%
associate-/r*99.6%
associate-/r/84.3%
div-sub84.3%
*-inverses84.3%
Simplified84.3%
Taylor expanded in x around 0 83.8%
Taylor expanded in B around 0 44.8%
Final simplification45.7%
(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.0%
mul-1-neg47.0%
sub-neg47.0%
Simplified47.0%
Final simplification47.0%
(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 58.6%
Taylor expanded in B around 0 47.1%
Taylor expanded in B around inf 3.1%
*-commutative3.1%
Simplified3.1%
Final simplification3.1%
(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%
+-commutative99.7%
cancel-sign-sub-inv99.7%
div-inv99.7%
clear-num99.7%
frac-sub86.6%
*-un-lft-identity86.6%
*-commutative86.6%
*-un-lft-identity86.6%
Applied egg-rr86.6%
associate-/r*99.6%
associate-/r/92.6%
div-sub92.6%
*-inverses92.6%
Simplified92.6%
Taylor expanded in x around 0 40.4%
Taylor expanded in B around 0 21.8%
Final simplification21.8%
herbie shell --seed 2023172
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))