
(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%
unsub-neg99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (B x)
:precision binary64
(if (<= x -4.5e+15)
(/ (* (- x) (cos B)) (sin B))
(if (<= x 1.85)
(- (/ 1.0 (sin B)) (/ x B))
(* x (/ (+ (/ 1.0 x) -1.0) (tan B))))))
double code(double B, double x) {
double tmp;
if (x <= -4.5e+15) {
tmp = (-x * cos(B)) / sin(B);
} else if (x <= 1.85) {
tmp = (1.0 / sin(B)) - (x / 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 <= (-4.5d+15)) then
tmp = (-x * cos(b)) / sin(b)
else if (x <= 1.85d0) then
tmp = (1.0d0 / sin(b)) - (x / 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 <= -4.5e+15) {
tmp = (-x * Math.cos(B)) / Math.sin(B);
} else if (x <= 1.85) {
tmp = (1.0 / Math.sin(B)) - (x / B);
} else {
tmp = x * (((1.0 / x) + -1.0) / Math.tan(B));
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -4.5e+15: tmp = (-x * math.cos(B)) / math.sin(B) elif x <= 1.85: tmp = (1.0 / math.sin(B)) - (x / B) else: tmp = x * (((1.0 / x) + -1.0) / math.tan(B)) return tmp
function code(B, x) tmp = 0.0 if (x <= -4.5e+15) tmp = Float64(Float64(Float64(-x) * cos(B)) / sin(B)); elseif (x <= 1.85) tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / 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 <= -4.5e+15) tmp = (-x * cos(B)) / sin(B); elseif (x <= 1.85) tmp = (1.0 / sin(B)) - (x / B); else tmp = x * (((1.0 / x) + -1.0) / tan(B)); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -4.5e+15], N[(N[((-x) * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.85], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / 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 -4.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\left(-x\right) \cdot \cos B}{\sin B}\\
\mathbf{elif}\;x \leq 1.85:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{x} + -1}{\tan B}\\
\end{array}
\end{array}
if x < -4.5e15Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
un-div-inv99.7%
add-sqr-sqrt99.3%
sqrt-unprod70.3%
sqr-neg70.3%
sqrt-unprod0.0%
add-sqr-sqrt0.5%
frac-2neg0.5%
div-inv0.5%
fma-def0.5%
add-sqr-sqrt0.5%
sqrt-unprod0.4%
sqr-neg0.4%
sqrt-unprod0.0%
add-sqr-sqrt99.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 99.6%
associate-*r/99.6%
*-commutative99.6%
associate-*r*99.6%
mul-1-neg99.6%
Simplified99.6%
if -4.5e15 < x < 1.8500000000000001Initial program 99.8%
+-commutative99.8%
unsub-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in B around 0 97.2%
if 1.8500000000000001 < x Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
+-commutative99.6%
cancel-sign-sub-inv99.6%
div-inv99.8%
clear-num99.5%
frac-sub84.0%
*-un-lft-identity84.0%
*-commutative84.0%
*-un-lft-identity84.0%
Applied egg-rr84.0%
associate-/r*99.5%
associate-/r/99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in B around 0 99.6%
Final simplification98.3%
(FPCore (B x) :precision binary64 (if (or (<= x -4.5e+15) (not (<= x 1.35))) (* x (/ (+ (/ 1.0 x) -1.0) (tan B))) (- (/ 1.0 (sin B)) (/ x B))))
double code(double B, double x) {
double tmp;
if ((x <= -4.5e+15) || !(x <= 1.35)) {
tmp = x * (((1.0 / x) + -1.0) / 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 <= (-4.5d+15)) .or. (.not. (x <= 1.35d0))) then
tmp = x * (((1.0d0 / x) + (-1.0d0)) / 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 <= -4.5e+15) || !(x <= 1.35)) {
tmp = x * (((1.0 / x) + -1.0) / Math.tan(B));
} else {
tmp = (1.0 / Math.sin(B)) - (x / B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -4.5e+15) or not (x <= 1.35): tmp = x * (((1.0 / x) + -1.0) / math.tan(B)) else: tmp = (1.0 / math.sin(B)) - (x / B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -4.5e+15) || !(x <= 1.35)) tmp = Float64(x * Float64(Float64(Float64(1.0 / x) + -1.0) / 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 <= -4.5e+15) || ~((x <= 1.35))) tmp = x * (((1.0 / x) + -1.0) / tan(B)); else tmp = (1.0 / sin(B)) - (x / B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -4.5e+15], N[Not[LessEqual[x, 1.35]], $MachinePrecision]], N[(x * N[(N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision] / 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 -4.5 \cdot 10^{+15} \lor \neg \left(x \leq 1.35\right):\\
\;\;\;\;x \cdot \frac{\frac{1}{x} + -1}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -4.5e15 or 1.3500000000000001 < x Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
+-commutative99.6%
cancel-sign-sub-inv99.6%
div-inv99.7%
clear-num99.5%
frac-sub87.0%
*-un-lft-identity87.0%
*-commutative87.0%
*-un-lft-identity87.0%
Applied egg-rr87.0%
associate-/r*99.5%
associate-/r/99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in B around 0 99.6%
if -4.5e15 < x < 1.3500000000000001Initial program 99.8%
+-commutative99.8%
unsub-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in B around 0 97.2%
Final simplification98.2%
(FPCore (B x)
:precision binary64
(if (<= x -0.0215)
(+ (* B 0.16666666666666666) (- (/ 1.0 B) (/ x B)))
(if (<= x 1.15e-5)
(/ 1.0 (sin B))
(+ (* B (* x 0.3333333333333333)) (/ (- 1.0 x) B)))))
double code(double B, double x) {
double tmp;
if (x <= -0.0215) {
tmp = (B * 0.16666666666666666) + ((1.0 / B) - (x / B));
} else if (x <= 1.15e-5) {
tmp = 1.0 / sin(B);
} else {
tmp = (B * (x * 0.3333333333333333)) + ((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 <= (-0.0215d0)) then
tmp = (b * 0.16666666666666666d0) + ((1.0d0 / b) - (x / b))
else if (x <= 1.15d-5) then
tmp = 1.0d0 / sin(b)
else
tmp = (b * (x * 0.3333333333333333d0)) + ((1.0d0 - x) / b)
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (x <= -0.0215) {
tmp = (B * 0.16666666666666666) + ((1.0 / B) - (x / B));
} else if (x <= 1.15e-5) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = (B * (x * 0.3333333333333333)) + ((1.0 - x) / B);
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -0.0215: tmp = (B * 0.16666666666666666) + ((1.0 / B) - (x / B)) elif x <= 1.15e-5: tmp = 1.0 / math.sin(B) else: tmp = (B * (x * 0.3333333333333333)) + ((1.0 - x) / B) return tmp
function code(B, x) tmp = 0.0 if (x <= -0.0215) tmp = Float64(Float64(B * 0.16666666666666666) + Float64(Float64(1.0 / B) - Float64(x / B))); elseif (x <= 1.15e-5) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(B * Float64(x * 0.3333333333333333)) + Float64(Float64(1.0 - x) / B)); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (x <= -0.0215) tmp = (B * 0.16666666666666666) + ((1.0 / B) - (x / B)); elseif (x <= 1.15e-5) tmp = 1.0 / sin(B); else tmp = (B * (x * 0.3333333333333333)) + ((1.0 - x) / B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -0.0215], N[(N[(B * 0.16666666666666666), $MachinePrecision] + N[(N[(1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.15e-5], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(B * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0215:\\
\;\;\;\;B \cdot 0.16666666666666666 + \left(\frac{1}{B} - \frac{x}{B}\right)\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;B \cdot \left(x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\
\end{array}
\end{array}
if x < -0.021499999999999998Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
Taylor expanded in B around 0 50.7%
Taylor expanded in B around 0 51.0%
if -0.021499999999999998 < x < 1.15e-5Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 97.0%
if 1.15e-5 < x Initial program 99.6%
+-commutative99.6%
unsub-neg99.6%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in B around 0 48.5%
Taylor expanded in x around inf 48.5%
associate-*r*48.5%
*-commutative48.5%
Simplified48.5%
associate--l+48.5%
*-commutative48.5%
sub-div48.5%
Applied egg-rr48.5%
Final simplification75.5%
(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.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in B around 0 75.3%
Final simplification75.3%
(FPCore (B x) :precision binary64 (+ (* B (* x 0.3333333333333333)) (/ (- 1.0 x) B)))
double code(double B, double x) {
return (B * (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 * (x * 0.3333333333333333d0)) + ((1.0d0 - x) / b)
end function
public static double code(double B, double x) {
return (B * (x * 0.3333333333333333)) + ((1.0 - x) / B);
}
def code(B, x): return (B * (x * 0.3333333333333333)) + ((1.0 - x) / B)
function code(B, x) return Float64(Float64(B * Float64(x * 0.3333333333333333)) + Float64(Float64(1.0 - x) / B)) end
function tmp = code(B, x) tmp = (B * (x * 0.3333333333333333)) + ((1.0 - x) / B); end
code[B_, x_] := N[(N[(B * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
B \cdot \left(x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}
\end{array}
Initial program 99.7%
+-commutative99.7%
unsub-neg99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in B around 0 51.4%
Taylor expanded in x around inf 51.8%
associate-*r*51.8%
*-commutative51.8%
Simplified51.8%
associate--l+51.8%
*-commutative51.8%
sub-div51.8%
Applied egg-rr51.8%
Final simplification51.8%
(FPCore (B x) :precision binary64 (if (or (<= x -0.0195) (not (<= x 1.0))) (/ (- x) B) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -0.0195) || !(x <= 1.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 <= (-0.0195d0)) .or. (.not. (x <= 1.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 <= -0.0195) || !(x <= 1.0)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -0.0195) or not (x <= 1.0): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -0.0195) || !(x <= 1.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 <= -0.0195) || ~((x <= 1.0))) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -0.0195], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0195 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -0.0195 or 1 < x Initial program 99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
Taylor expanded in B around 0 48.7%
mul-1-neg48.7%
sub-neg48.7%
Simplified48.7%
Taylor expanded in x around inf 47.0%
neg-mul-147.0%
distribute-neg-frac47.0%
Simplified47.0%
if -0.0195 < x < 1Initial program 99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Taylor expanded in B around 0 53.5%
mul-1-neg53.5%
sub-neg53.5%
Simplified53.5%
Taylor expanded in x around 0 53.4%
Final simplification50.5%
(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 51.3%
mul-1-neg51.3%
sub-neg51.3%
Simplified51.3%
Final simplification51.3%
(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%
Simplified99.7%
Taylor expanded in B around 0 63.6%
add-log-exp26.0%
*-un-lft-identity26.0%
log-prod26.0%
metadata-eval26.0%
add-log-exp63.6%
add-sqr-sqrt33.0%
sqrt-unprod42.6%
sqr-neg42.6%
sqrt-unprod14.8%
add-sqr-sqrt29.2%
div-inv29.2%
Applied egg-rr29.2%
+-lft-identity29.2%
Simplified29.2%
Taylor expanded in B around inf 3.3%
*-commutative3.3%
Simplified3.3%
Final simplification3.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%
Simplified99.7%
Taylor expanded in B around 0 51.3%
mul-1-neg51.3%
sub-neg51.3%
Simplified51.3%
Taylor expanded in x around 0 30.3%
Final simplification30.3%
herbie shell --seed 2023175
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))