
(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 9 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%
*-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%
(FPCore (B x)
:precision binary64
(let* ((t_0 (/ x (- (tan B)))))
(if (<= x -650000000.0)
t_0
(if (<= x 7.4e-6)
(/ 1.0 (sin B))
(if (<= x 490000000000.0) (* (/ x B) (+ -1.0 (/ 1.0 x))) t_0)))))
double code(double B, double x) {
double t_0 = x / -tan(B);
double tmp;
if (x <= -650000000.0) {
tmp = t_0;
} else if (x <= 7.4e-6) {
tmp = 1.0 / sin(B);
} else if (x <= 490000000000.0) {
tmp = (x / B) * (-1.0 + (1.0 / x));
} else {
tmp = 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 = x / -tan(b)
if (x <= (-650000000.0d0)) then
tmp = t_0
else if (x <= 7.4d-6) then
tmp = 1.0d0 / sin(b)
else if (x <= 490000000000.0d0) then
tmp = (x / b) * ((-1.0d0) + (1.0d0 / x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double B, double x) {
double t_0 = x / -Math.tan(B);
double tmp;
if (x <= -650000000.0) {
tmp = t_0;
} else if (x <= 7.4e-6) {
tmp = 1.0 / Math.sin(B);
} else if (x <= 490000000000.0) {
tmp = (x / B) * (-1.0 + (1.0 / x));
} else {
tmp = t_0;
}
return tmp;
}
def code(B, x): t_0 = x / -math.tan(B) tmp = 0 if x <= -650000000.0: tmp = t_0 elif x <= 7.4e-6: tmp = 1.0 / math.sin(B) elif x <= 490000000000.0: tmp = (x / B) * (-1.0 + (1.0 / x)) else: tmp = t_0 return tmp
function code(B, x) t_0 = Float64(x / Float64(-tan(B))) tmp = 0.0 if (x <= -650000000.0) tmp = t_0; elseif (x <= 7.4e-6) tmp = Float64(1.0 / sin(B)); elseif (x <= 490000000000.0) tmp = Float64(Float64(x / B) * Float64(-1.0 + Float64(1.0 / x))); else tmp = t_0; end return tmp end
function tmp_2 = code(B, x) t_0 = x / -tan(B); tmp = 0.0; if (x <= -650000000.0) tmp = t_0; elseif (x <= 7.4e-6) tmp = 1.0 / sin(B); elseif (x <= 490000000000.0) tmp = (x / B) * (-1.0 + (1.0 / x)); else tmp = t_0; end tmp_2 = tmp; end
code[B_, x_] := Block[{t$95$0 = N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[x, -650000000.0], t$95$0, If[LessEqual[x, 7.4e-6], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 490000000000.0], N[(N[(x / B), $MachinePrecision] * N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{-\tan B}\\
\mathbf{if}\;x \leq -650000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{elif}\;x \leq 490000000000:\\
\;\;\;\;\frac{x}{B} \cdot \left(-1 + \frac{1}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.5e8 or 4.9e11 < x Initial program 99.5%
Taylor expanded in x around inf 99.6%
mul-1-neg99.6%
associate-/l*99.3%
distribute-lft-neg-in99.3%
Simplified99.3%
*-un-lft-identity99.3%
clear-num99.3%
tan-quot99.3%
Applied egg-rr99.3%
*-lft-identity99.3%
Simplified99.3%
distribute-lft-neg-out99.3%
neg-sub099.3%
un-div-inv99.6%
Applied egg-rr99.6%
neg-sub099.6%
distribute-frac-neg299.6%
Simplified99.6%
if -6.5e8 < x < 7.4000000000000003e-6Initial program 99.8%
Taylor expanded in x around 0 95.3%
if 7.4000000000000003e-6 < x < 4.9e11Initial program 99.1%
Taylor expanded in B around 0 84.7%
Taylor expanded in x around inf 84.8%
sub-neg84.8%
associate-/r*84.4%
distribute-neg-frac84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in B around 0 83.7%
*-commutative83.7%
associate-/l*84.0%
sub-neg84.0%
metadata-eval84.0%
+-commutative84.0%
Simplified84.0%
Final simplification97.0%
(FPCore (B x) :precision binary64 (if (or (<= x -1.2e-5) (not (<= x 6e-29))) (- (/ 1.0 B) (/ x (tan B))) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if ((x <= -1.2e-5) || !(x <= 6e-29)) {
tmp = (1.0 / B) - (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.2d-5)) .or. (.not. (x <= 6d-29))) then
tmp = (1.0d0 / b) - (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.2e-5) || !(x <= 6e-29)) {
tmp = (1.0 / B) - (x / Math.tan(B));
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -1.2e-5) or not (x <= 6e-29): tmp = (1.0 / B) - (x / math.tan(B)) else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if ((x <= -1.2e-5) || !(x <= 6e-29)) tmp = Float64(Float64(1.0 / B) - 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.2e-5) || ~((x <= 6e-29))) tmp = (1.0 / B) - (x / tan(B)); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -1.2e-5], N[Not[LessEqual[x, 6e-29]], $MachinePrecision]], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-5} \lor \neg \left(x \leq 6 \cdot 10^{-29}\right):\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if x < -1.2e-5 or 6.0000000000000005e-29 < x Initial program 99.5%
distribute-lft-neg-in99.5%
+-commutative99.5%
*-commutative99.5%
remove-double-neg99.5%
distribute-frac-neg299.5%
tan-neg99.5%
cancel-sign-sub-inv99.5%
*-commutative99.5%
associate-*r/99.7%
*-rgt-identity99.7%
tan-neg99.7%
distribute-neg-frac299.7%
distribute-neg-frac99.7%
remove-double-neg99.7%
Simplified99.7%
inv-pow99.7%
add-sqr-sqrt45.0%
unpow-prod-down45.0%
Applied egg-rr45.0%
pow-sqr45.0%
metadata-eval45.0%
Simplified45.0%
Taylor expanded in B around 0 95.8%
if -1.2e-5 < x < 6.0000000000000005e-29Initial program 99.9%
Taylor expanded in x around 0 99.0%
Final simplification97.3%
(FPCore (B x)
:precision binary64
(if (<= x -3200000000000.0)
(/ x (- (tan B)))
(if (<= x 2.15e-13)
(- (/ 1.0 (sin B)) (/ x B))
(- (/ 1.0 B) (/ x (tan B))))))
double code(double B, double x) {
double tmp;
if (x <= -3200000000000.0) {
tmp = x / -tan(B);
} else if (x <= 2.15e-13) {
tmp = (1.0 / sin(B)) - (x / B);
} else {
tmp = (1.0 / 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 <= (-3200000000000.0d0)) then
tmp = x / -tan(b)
else if (x <= 2.15d-13) then
tmp = (1.0d0 / sin(b)) - (x / b)
else
tmp = (1.0d0 / b) - (x / tan(b))
end if
code = tmp
end function
public static double code(double B, double x) {
double tmp;
if (x <= -3200000000000.0) {
tmp = x / -Math.tan(B);
} else if (x <= 2.15e-13) {
tmp = (1.0 / Math.sin(B)) - (x / B);
} else {
tmp = (1.0 / B) - (x / Math.tan(B));
}
return tmp;
}
def code(B, x): tmp = 0 if x <= -3200000000000.0: tmp = x / -math.tan(B) elif x <= 2.15e-13: tmp = (1.0 / math.sin(B)) - (x / B) else: tmp = (1.0 / B) - (x / math.tan(B)) return tmp
function code(B, x) tmp = 0.0 if (x <= -3200000000000.0) tmp = Float64(x / Float64(-tan(B))); elseif (x <= 2.15e-13) tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B)); else tmp = Float64(Float64(1.0 / B) - Float64(x / tan(B))); end return tmp end
function tmp_2 = code(B, x) tmp = 0.0; if (x <= -3200000000000.0) tmp = x / -tan(B); elseif (x <= 2.15e-13) tmp = (1.0 / sin(B)) - (x / B); else tmp = (1.0 / B) - (x / tan(B)); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[x, -3200000000000.0], N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[x, 2.15e-13], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3200000000000:\\
\;\;\;\;\frac{x}{-\tan B}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-13}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if x < -3.2e12Initial program 99.4%
Taylor expanded in x around inf 99.7%
mul-1-neg99.7%
associate-/l*99.4%
distribute-lft-neg-in99.4%
Simplified99.4%
*-un-lft-identity99.4%
clear-num99.4%
tan-quot99.4%
Applied egg-rr99.4%
*-lft-identity99.4%
Simplified99.4%
distribute-lft-neg-out99.4%
neg-sub099.4%
un-div-inv99.7%
Applied egg-rr99.7%
neg-sub099.7%
distribute-frac-neg299.7%
Simplified99.7%
if -3.2e12 < x < 2.1499999999999999e-13Initial program 99.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
*-commutative99.8%
remove-double-neg99.8%
distribute-frac-neg299.8%
tan-neg99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
associate-*r/99.8%
*-rgt-identity99.8%
tan-neg99.8%
distribute-neg-frac299.8%
distribute-neg-frac99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in B around 0 98.7%
if 2.1499999999999999e-13 < x Initial program 99.5%
distribute-lft-neg-in99.5%
+-commutative99.5%
*-commutative99.5%
remove-double-neg99.5%
distribute-frac-neg299.5%
tan-neg99.5%
cancel-sign-sub-inv99.5%
*-commutative99.5%
associate-*r/99.7%
*-rgt-identity99.7%
tan-neg99.7%
distribute-neg-frac299.7%
distribute-neg-frac99.7%
remove-double-neg99.7%
Simplified99.7%
inv-pow99.7%
add-sqr-sqrt43.3%
unpow-prod-down43.3%
Applied egg-rr43.3%
pow-sqr43.3%
metadata-eval43.3%
Simplified43.3%
Taylor expanded in B around 0 96.3%
(FPCore (B x) :precision binary64 (if (<= B 2.1e-5) (/ (- 1.0 x) B) (/ 1.0 (sin B))))
double code(double B, double x) {
double tmp;
if (B <= 2.1e-5) {
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 <= 2.1d-5) 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 <= 2.1e-5) {
tmp = (1.0 - x) / B;
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(B, x): tmp = 0 if B <= 2.1e-5: tmp = (1.0 - x) / B else: tmp = 1.0 / math.sin(B) return tmp
function code(B, x) tmp = 0.0 if (B <= 2.1e-5) 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 <= 2.1e-5) tmp = (1.0 - x) / B; else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[B_, x_] := If[LessEqual[B, 2.1e-5], 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 2.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if B < 2.09999999999999988e-5Initial program 99.7%
Taylor expanded in B around 0 65.5%
if 2.09999999999999988e-5 < B Initial program 99.6%
Taylor expanded in x around 0 57.6%
(FPCore (B x) :precision binary64 (if (or (<= x -3e+40) (not (<= x 3.3e-19))) (/ x (- B)) (/ 1.0 B)))
double code(double B, double x) {
double tmp;
if ((x <= -3e+40) || !(x <= 3.3e-19)) {
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 <= (-3d+40)) .or. (.not. (x <= 3.3d-19))) 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 <= -3e+40) || !(x <= 3.3e-19)) {
tmp = x / -B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(B, x): tmp = 0 if (x <= -3e+40) or not (x <= 3.3e-19): tmp = x / -B else: tmp = 1.0 / B return tmp
function code(B, x) tmp = 0.0 if ((x <= -3e+40) || !(x <= 3.3e-19)) 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 <= -3e+40) || ~((x <= 3.3e-19))) tmp = x / -B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[B_, x_] := If[Or[LessEqual[x, -3e+40], N[Not[LessEqual[x, 3.3e-19]], $MachinePrecision]], N[(x / (-B)), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+40} \lor \neg \left(x \leq 3.3 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{x}{-B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -3.0000000000000002e40 or 3.2999999999999998e-19 < x Initial program 99.5%
Taylor expanded in B around 0 57.7%
Taylor expanded in x around inf 51.9%
neg-mul-151.9%
distribute-frac-neg251.9%
Simplified51.9%
if -3.0000000000000002e40 < x < 3.2999999999999998e-19Initial program 99.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
*-commutative99.8%
remove-double-neg99.8%
distribute-frac-neg299.8%
tan-neg99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
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%
add-sqr-sqrt48.9%
unpow-prod-down48.7%
Applied egg-rr48.7%
pow-sqr48.9%
metadata-eval48.9%
Simplified48.9%
Taylor expanded in B around 0 46.1%
Taylor expanded in x around 0 38.3%
Final simplification44.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%
Taylor expanded in B around 0 48.5%
(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%
+-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%
add-sqr-sqrt46.6%
unpow-prod-down46.5%
Applied egg-rr46.5%
pow-sqr46.6%
metadata-eval46.6%
Simplified46.6%
Taylor expanded in B around 0 70.0%
Taylor expanded in x around 0 22.5%
(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 77.7%
Taylor expanded in x around inf 67.6%
sub-neg67.6%
associate-/r*67.7%
distribute-neg-frac67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in B around 0 48.5%
*-commutative48.5%
associate-/l*48.4%
sub-neg48.4%
metadata-eval48.4%
+-commutative48.4%
Simplified48.4%
associate-*r/48.5%
frac-2neg48.5%
*-commutative48.5%
add-sqr-sqrt26.5%
sqrt-unprod22.2%
sqr-neg22.2%
sqrt-unprod1.2%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
distribute-lft-neg-in2.2%
associate-/l*2.1%
Simplified2.1%
Taylor expanded in x around 0 3.0%
herbie shell --seed 2024105
(FPCore (B x)
:name "VandenBroeck and Keller, Equation (24)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))