
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -1.5e+96)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 180000000.0)
(- (/ F (* (sin B) (sqrt (fma F F 2.0)))) t_0)
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -1.5e+96) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 180000000.0) {
tmp = (F / (sin(B) * sqrt(fma(F, F, 2.0)))) - t_0;
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -1.5e+96) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 180000000.0) tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(F, F, 2.0)))) - t_0); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.5e+96], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 180000000.0], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1.5 \cdot 10^{+96}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 180000000:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(F, F, 2\right)}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.5e96Initial program 50.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites62.6%
Applied rewrites62.7%
Taylor expanded in F around -inf
Applied rewrites99.9%
if -1.5e96 < F < 1.8e8Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites99.6%
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.7
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
lower-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6499.7
Applied rewrites99.7%
if 1.8e8 < F Initial program 62.3%
Taylor expanded in F around inf
lower--.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Applied rewrites99.8%
Final simplification99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0))))
(if (<= F -1e+146)
(/ (- -1.0 x) B)
(if (<= F 3000000000.0)
(/
(fma
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* B B)
(fma t_0 F (- x)))
B)
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double t_0 = sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0));
double tmp;
if (F <= -1e+146) {
tmp = (-1.0 - x) / B;
} else if (F <= 3000000000.0) {
tmp = fma(fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (B * B), fma(t_0, F, -x)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)) tmp = 0.0 if (F <= -1e+146) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3000000000.0) tmp = Float64(fma(fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(B * B), fma(t_0, F, Float64(-x))) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[F, -1e+146], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3000000000.0], N[(N[(N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(t$95$0 * F + (-x)), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}}\\
\mathbf{if}\;F \leq -1 \cdot 10^{+146}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), B \cdot B, \mathsf{fma}\left(t\_0, F, -x\right)\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -9.99999999999999934e145Initial program 41.8%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6424.6
Applied rewrites24.6%
Taylor expanded in F around -inf
Applied rewrites48.9%
if -9.99999999999999934e145 < F < 3e9Initial program 98.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites99.6%
Applied rewrites99.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.4%
if 3e9 < F Initial program 62.3%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6435.5
Applied rewrites35.5%
Taylor expanded in F around inf
Applied rewrites49.3%
Final simplification50.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= F -4e+132)
(+ t_0 (/ (fma -0.16666666666666666 (* B B) -1.0) B))
(if (<= F -6.2e-26)
(- (/ (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) (sin B)) (/ x B))
(if (<= F 80.0)
(+ t_0 (* (/ F B) (sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (F <= -4e+132) {
tmp = t_0 + (fma(-0.16666666666666666, (B * B), -1.0) / B);
} else if (F <= -6.2e-26) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)) - (x / B);
} else if (F <= 80.0) {
tmp = t_0 + ((F / B) * sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0)));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (F <= -4e+132) tmp = Float64(t_0 + Float64(fma(-0.16666666666666666, Float64(B * B), -1.0) / B)); elseif (F <= -6.2e-26) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)) - Float64(x / B)); elseif (F <= 80.0) tmp = Float64(t_0 + Float64(Float64(F / B) * sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4e+132], N[(t$95$0 + N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + -1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -6.2e-26], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 80.0], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -4 \cdot 10^{+132}:\\
\;\;\;\;t\_0 + \frac{\mathsf{fma}\left(-0.16666666666666666, B \cdot B, -1\right)}{B}\\
\mathbf{elif}\;F \leq -6.2 \cdot 10^{-26}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 80:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -3.99999999999999996e132Initial program 44.9%
Taylor expanded in B around 0
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites26.9%
Taylor expanded in F around -inf
Applied rewrites55.0%
if -3.99999999999999996e132 < F < -6.19999999999999966e-26Initial program 95.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites99.6%
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f6484.8
Applied rewrites84.8%
if -6.19999999999999966e-26 < F < 80Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6486.1
Applied rewrites86.1%
if 80 < F Initial program 62.3%
Taylor expanded in F around inf
lower--.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Applied rewrites99.8%
Final simplification82.5%
(FPCore (F B x)
:precision binary64
(if (<= F -2.6)
(- (/ -1.0 (sin B)) (/ x (tan B)))
(if (<= F 80.0)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.6) {
tmp = (-1.0 / sin(B)) - (x / tan(B));
} else if (F <= 80.0) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0)));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.6) tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B))); elseif (F <= 80.0) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.6], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 80.0], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.6:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 80:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2.60000000000000009Initial program 60.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites70.0%
Applied rewrites70.1%
Taylor expanded in F around -inf
Applied rewrites99.9%
if -2.60000000000000009 < F < 80Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6485.5
Applied rewrites85.5%
if 80 < F Initial program 62.3%
Taylor expanded in F around inf
lower--.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Applied rewrites99.8%
Final simplification93.5%
(FPCore (F B x) :precision binary64 (if (or (<= x -1.65e-111) (not (<= x 7e-132))) (/ (- x) (tan B)) (* (sqrt (pow (fma F F 2.0) -1.0)) (/ F (sin B)))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -1.65e-111) || !(x <= 7e-132)) {
tmp = -x / tan(B);
} else {
tmp = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -1.65e-111) || !(x <= 7e-132)) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / sin(B))); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -1.65e-111], N[Not[LessEqual[x, 7e-132]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-111} \lor \neg \left(x \leq 7 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B}\\
\end{array}
\end{array}
if x < -1.65e-111 or 6.9999999999999999e-132 < x Initial program 84.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites91.9%
Taylor expanded in F around 0
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6483.8
Applied rewrites83.8%
Applied rewrites84.0%
if -1.65e-111 < x < 6.9999999999999999e-132Initial program 67.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f6454.9
Applied rewrites54.9%
Final simplification73.7%
(FPCore (F B x)
:precision binary64
(if (<= F -9e+145)
(/ (- -1.0 x) B)
(if (<= F 3000000000.0)
(/
(fma
(sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0))
(fma (* (* B B) F) 0.16666666666666666 F)
(fma 0.3333333333333333 (* (* B B) x) (- x)))
B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -9e+145) {
tmp = (-1.0 - x) / B;
} else if (F <= 3000000000.0) {
tmp = fma(sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0)), fma(((B * B) * F), 0.16666666666666666, F), fma(0.3333333333333333, ((B * B) * x), -x)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -9e+145) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3000000000.0) tmp = Float64(fma(sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)), fma(Float64(Float64(B * B) * F), 0.16666666666666666, F), fma(0.3333333333333333, Float64(Float64(B * B) * x), Float64(-x))) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -9e+145], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3000000000.0], N[(N[(N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision] * 0.16666666666666666 + F), $MachinePrecision] + N[(0.3333333333333333 * N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] + (-x)), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -9 \cdot 10^{+145}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}}, \mathsf{fma}\left(\left(B \cdot B\right) \cdot F, 0.16666666666666666, F\right), \mathsf{fma}\left(0.3333333333333333, \left(B \cdot B\right) \cdot x, -x\right)\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -8.9999999999999996e145Initial program 41.8%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6424.6
Applied rewrites24.6%
Taylor expanded in F around -inf
Applied rewrites48.9%
if -8.9999999999999996e145 < F < 3e9Initial program 98.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.1%
if 3e9 < F Initial program 62.3%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6435.5
Applied rewrites35.5%
Taylor expanded in F around inf
Applied rewrites49.3%
Final simplification50.2%
(FPCore (F B x) :precision binary64 (if (or (<= x -3.6e-31) (not (<= x 1.85e-85))) (/ (- x) (tan B)) (- (/ F (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0))))) (/ x B))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -3.6e-31) || !(x <= 1.85e-85)) {
tmp = -x / tan(B);
} else {
tmp = (F / (sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -3.6e-31) || !(x <= 1.85e-85)) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -3.6e-31], N[Not[LessEqual[x, 1.85e-85]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-31} \lor \neg \left(x \leq 1.85 \cdot 10^{-85}\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -3.60000000000000004e-31 or 1.84999999999999992e-85 < x Initial program 89.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites97.3%
Taylor expanded in F around 0
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6494.5
Applied rewrites94.5%
Applied rewrites94.8%
if -3.60000000000000004e-31 < x < 1.84999999999999992e-85Initial program 66.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites69.4%
Applied rewrites69.5%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6469.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6469.6
Applied rewrites69.6%
Taylor expanded in B around 0
lower-/.f6462.3
Applied rewrites62.3%
Final simplification79.3%
(FPCore (F B x)
:precision binary64
(if (<= F -4.6)
(/ (- -1.0 x) B)
(if (<= F 1.7e-15)
(/ (fma (sqrt (pow (fma 2.0 x 2.0) -1.0)) F (- x)) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.6) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.7e-15) {
tmp = fma(sqrt(pow(fma(2.0, x, 2.0), -1.0)), F, -x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4.6) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.7e-15) tmp = Float64(fma(sqrt((fma(2.0, x, 2.0) ^ -1.0)), F, Float64(-x)) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4.6], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.7e-15], N[(N[(N[Sqrt[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F + (-x)), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.6:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.7 \cdot 10^{-15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}}, F, -x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -4.5999999999999996Initial program 59.6%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6432.2
Applied rewrites32.2%
Taylor expanded in F around -inf
Applied rewrites48.5%
if -4.5999999999999996 < F < 1.7e-15Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6450.9
Applied rewrites50.9%
Taylor expanded in F around 0
Applied rewrites50.9%
if 1.7e-15 < F Initial program 64.0%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6437.0
Applied rewrites37.0%
Taylor expanded in F around inf
Applied rewrites49.1%
Final simplification49.7%
(FPCore (F B x)
:precision binary64
(if (<= B 0.00065)
(+
(/
(fma
(fma
(fma
x
0.022222222222222223
(*
(fma
-0.3333333333333333
(* x 0.022222222222222223)
(* x 0.009523809523809525))
(* B B)))
(* B B)
(* 0.3333333333333333 x))
(* B B)
(- x))
B)
(/
(fma 0.16666666666666666 (* (* B B) F) F)
(* (sqrt (fma 2.0 x (fma F F 2.0))) B)))
(/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.00065) {
tmp = (fma(fma(fma(x, 0.022222222222222223, (fma(-0.3333333333333333, (x * 0.022222222222222223), (x * 0.009523809523809525)) * (B * B))), (B * B), (0.3333333333333333 * x)), (B * B), -x) / B) + (fma(0.16666666666666666, ((B * B) * F), F) / (sqrt(fma(2.0, x, fma(F, F, 2.0))) * B));
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.00065) tmp = Float64(Float64(fma(fma(fma(x, 0.022222222222222223, Float64(fma(-0.3333333333333333, Float64(x * 0.022222222222222223), Float64(x * 0.009523809523809525)) * Float64(B * B))), Float64(B * B), Float64(0.3333333333333333 * x)), Float64(B * B), Float64(-x)) / B) + Float64(fma(0.16666666666666666, Float64(Float64(B * B) * F), F) / Float64(sqrt(fma(2.0, x, fma(F, F, 2.0))) * B))); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.00065], N[(N[(N[(N[(N[(x * 0.022222222222222223 + N[(N[(-0.3333333333333333 * N[(x * 0.022222222222222223), $MachinePrecision] + N[(x * 0.009523809523809525), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] / B), $MachinePrecision] + N[(N[(0.16666666666666666 * N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision] + F), $MachinePrecision] / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.00065:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x, 0.022222222222222223, \mathsf{fma}\left(-0.3333333333333333, x \cdot 0.022222222222222223, x \cdot 0.009523809523809525\right) \cdot \left(B \cdot B\right)\right), B \cdot B, 0.3333333333333333 \cdot x\right), B \cdot B, -x\right)}{B} + \frac{\mathsf{fma}\left(0.16666666666666666, \left(B \cdot B\right) \cdot F, F\right)}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 6.4999999999999997e-4Initial program 75.1%
Taylor expanded in B around 0
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites62.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites53.8%
Applied rewrites53.8%
if 6.4999999999999997e-4 < B Initial program 86.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites86.8%
Taylor expanded in F around 0
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6456.3
Applied rewrites56.3%
Applied rewrites56.5%
Final simplification54.5%
(FPCore (F B x) :precision binary64 (if (<= B 1.5e-11) (/ (- (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) x) B) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 1.5e-11) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B;
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 1.5e-11) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 1.5e-11], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.5 \cdot 10^{-11}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 1.5e-11Initial program 74.9%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6453.5
Applied rewrites53.5%
Applied rewrites53.5%
if 1.5e-11 < B Initial program 87.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites87.2%
Taylor expanded in F around 0
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6457.6
Applied rewrites57.6%
Applied rewrites57.8%
Final simplification54.6%
(FPCore (F B x) :precision binary64 (if (<= F -3.2e-28) (/ (- -1.0 x) B) (if (<= F 8.0) (/ (- x) B) (pow B -1.0))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 8.0) {
tmp = -x / B;
} else {
tmp = pow(B, -1.0);
}
return tmp;
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.2d-28)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 8.0d0) then
tmp = -x / b
else
tmp = b ** (-1.0d0)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 8.0) {
tmp = -x / B;
} else {
tmp = Math.pow(B, -1.0);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.2e-28: tmp = (-1.0 - x) / B elif F <= 8.0: tmp = -x / B else: tmp = math.pow(B, -1.0) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.2e-28) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 8.0) tmp = Float64(Float64(-x) / B); else tmp = B ^ -1.0; end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.2e-28) tmp = (-1.0 - x) / B; elseif (F <= 8.0) tmp = -x / B; else tmp = B ^ -1.0; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.2e-28], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 8.0], N[((-x) / B), $MachinePrecision], N[Power[B, -1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 8:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;{B}^{-1}\\
\end{array}
\end{array}
if F < -3.19999999999999982e-28Initial program 61.5%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6434.3
Applied rewrites34.3%
Taylor expanded in F around -inf
Applied rewrites47.7%
if -3.19999999999999982e-28 < F < 8Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6450.0
Applied rewrites50.0%
Taylor expanded in F around 0
Applied rewrites37.4%
if 8 < F Initial program 62.9%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6436.5
Applied rewrites36.5%
Taylor expanded in x around 0
Applied rewrites15.5%
Taylor expanded in F around inf
Applied rewrites31.3%
Final simplification39.2%
(FPCore (F B x) :precision binary64 (if (<= F -3.2e+268) (/ -1.0 B) (if (<= F 8.0) (/ (- x) B) (pow B -1.0))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e+268) {
tmp = -1.0 / B;
} else if (F <= 8.0) {
tmp = -x / B;
} else {
tmp = pow(B, -1.0);
}
return tmp;
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.2d+268)) then
tmp = (-1.0d0) / b
else if (f <= 8.0d0) then
tmp = -x / b
else
tmp = b ** (-1.0d0)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e+268) {
tmp = -1.0 / B;
} else if (F <= 8.0) {
tmp = -x / B;
} else {
tmp = Math.pow(B, -1.0);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.2e+268: tmp = -1.0 / B elif F <= 8.0: tmp = -x / B else: tmp = math.pow(B, -1.0) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.2e+268) tmp = Float64(-1.0 / B); elseif (F <= 8.0) tmp = Float64(Float64(-x) / B); else tmp = B ^ -1.0; end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.2e+268) tmp = -1.0 / B; elseif (F <= 8.0) tmp = -x / B; else tmp = B ^ -1.0; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.2e+268], N[(-1.0 / B), $MachinePrecision], If[LessEqual[F, 8.0], N[((-x) / B), $MachinePrecision], N[Power[B, -1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{+268}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{elif}\;F \leq 8:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;{B}^{-1}\\
\end{array}
\end{array}
if F < -3.1999999999999999e268Initial program 25.7%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f642.4
Applied rewrites2.4%
Taylor expanded in F around -inf
Applied rewrites51.9%
Taylor expanded in x around 0
Applied rewrites51.6%
if -3.1999999999999999e268 < F < 8Initial program 86.8%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6446.0
Applied rewrites46.0%
Taylor expanded in F around 0
Applied rewrites34.5%
if 8 < F Initial program 62.9%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6436.5
Applied rewrites36.5%
Taylor expanded in x around 0
Applied rewrites15.5%
Taylor expanded in F around inf
Applied rewrites31.3%
Final simplification34.5%
(FPCore (F B x) :precision binary64 (if (<= F 2.3e-32) (/ -1.0 B) (pow B -1.0)))
double code(double F, double B, double x) {
double tmp;
if (F <= 2.3e-32) {
tmp = -1.0 / B;
} else {
tmp = pow(B, -1.0);
}
return tmp;
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= 2.3d-32) then
tmp = (-1.0d0) / b
else
tmp = b ** (-1.0d0)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 2.3e-32) {
tmp = -1.0 / B;
} else {
tmp = Math.pow(B, -1.0);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 2.3e-32: tmp = -1.0 / B else: tmp = math.pow(B, -1.0) return tmp
function code(F, B, x) tmp = 0.0 if (F <= 2.3e-32) tmp = Float64(-1.0 / B); else tmp = B ^ -1.0; end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 2.3e-32) tmp = -1.0 / B; else tmp = B ^ -1.0; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 2.3e-32], N[(-1.0 / B), $MachinePrecision], N[Power[B, -1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.3 \cdot 10^{-32}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;{B}^{-1}\\
\end{array}
\end{array}
if F < 2.3000000000000001e-32Initial program 82.6%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6442.2
Applied rewrites42.2%
Taylor expanded in F around -inf
Applied rewrites31.3%
Taylor expanded in x around 0
Applied rewrites13.2%
if 2.3000000000000001e-32 < F Initial program 65.6%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6439.7
Applied rewrites39.7%
Taylor expanded in x around 0
Applied rewrites18.7%
Taylor expanded in F around inf
Applied rewrites29.5%
Final simplification17.6%
(FPCore (F B x) :precision binary64 (pow B -1.0))
double code(double F, double B, double x) {
return pow(B, -1.0);
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = b ** (-1.0d0)
end function
public static double code(double F, double B, double x) {
return Math.pow(B, -1.0);
}
def code(F, B, x): return math.pow(B, -1.0)
function code(F, B, x) return B ^ -1.0 end
function tmp = code(F, B, x) tmp = B ^ -1.0; end
code[F_, B_, x_] := N[Power[B, -1.0], $MachinePrecision]
\begin{array}{l}
\\
{B}^{-1}
\end{array}
Initial program 78.0%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6441.5
Applied rewrites41.5%
Taylor expanded in x around 0
Applied rewrites13.9%
Taylor expanded in F around inf
Applied rewrites10.1%
Final simplification10.1%
(FPCore (F B x)
:precision binary64
(if (<= F -5e+158)
(/ (- -1.0 x) B)
(if (<= F 9e+153)
(/ (- (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) x) B)
(/
(- (fma (+ 0.16666666666666666 (* 0.3333333333333333 x)) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5e+158) {
tmp = (-1.0 - x) / B;
} else if (F <= 9e+153) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B;
} else {
tmp = (fma((0.16666666666666666 + (0.3333333333333333 * x)), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5e+158) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 9e+153) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(fma(Float64(0.16666666666666666 + Float64(0.3333333333333333 * x)), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5e+158], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 9e+153], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{+158}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 9 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.16666666666666666 + 0.3333333333333333 \cdot x, B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -4.9999999999999996e158Initial program 41.4%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6423.5
Applied rewrites23.5%
Taylor expanded in F around -inf
Applied rewrites48.8%
if -4.9999999999999996e158 < F < 9.0000000000000002e153Initial program 97.3%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6449.8
Applied rewrites49.8%
Applied rewrites49.8%
if 9.0000000000000002e153 < F Initial program 29.7%
Taylor expanded in F around inf
lower--.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites53.4%
Final simplification50.0%
(FPCore (F B x)
:precision binary64
(if (<= F -3.6e-28)
(/ (- -1.0 x) B)
(if (<= F 1.6e-32)
(/ (- (fma (* -0.3333333333333333 x) (* B B) x)) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.6e-32) {
tmp = -fma((-0.3333333333333333 * x), (B * B), x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.6e-28) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.6e-32) tmp = Float64(Float64(-fma(Float64(-0.3333333333333333 * x), Float64(B * B), x)) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.6e-28], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.6e-32], N[((-N[(N[(-0.3333333333333333 * x), $MachinePrecision] * N[(B * B), $MachinePrecision] + x), $MachinePrecision]) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.6 \cdot 10^{-32}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(-0.3333333333333333 \cdot x, B \cdot B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.5999999999999999e-28Initial program 61.5%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6434.3
Applied rewrites34.3%
Taylor expanded in F around -inf
Applied rewrites47.7%
if -3.5999999999999999e-28 < F < 1.6000000000000001e-32Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
div-invN/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in F around 0
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6475.5
Applied rewrites75.5%
Taylor expanded in B around 0
Applied rewrites38.8%
if 1.6000000000000001e-32 < F Initial program 65.6%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6439.7
Applied rewrites39.7%
Taylor expanded in F around inf
Applied rewrites47.4%
Final simplification44.0%
(FPCore (F B x) :precision binary64 (if (<= F -3.2e-28) (/ (- -1.0 x) B) (if (<= F 1.9e-49) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.9e-49) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.2d-28)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 1.9d-49) then
tmp = -x / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.9e-49) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.2e-28: tmp = (-1.0 - x) / B elif F <= 1.9e-49: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.2e-28) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.9e-49) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.2e-28) tmp = (-1.0 - x) / B; elseif (F <= 1.9e-49) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.2e-28], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.9e-49], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{-49}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.19999999999999982e-28Initial program 61.5%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6434.3
Applied rewrites34.3%
Taylor expanded in F around -inf
Applied rewrites47.7%
if -3.19999999999999982e-28 < F < 1.8999999999999999e-49Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6448.1
Applied rewrites48.1%
Taylor expanded in F around 0
Applied rewrites37.1%
if 1.8999999999999999e-49 < F Initial program 67.8%
Taylor expanded in B around 0
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f6441.0
Applied rewrites41.0%
Taylor expanded in F around inf
Applied rewrites48.2%
Final simplification43.7%
herbie shell --seed 2024324
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))