
(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 -5e+71)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 500000.0)
(- (/ F (* (sqrt (fma F F 2.0)) (sin B))) t_0)
(- (/ 1.0 (sin B)) t_0)))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -5e+71) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 500000.0) {
tmp = (F / (sqrt(fma(F, F, 2.0)) * sin(B))) - t_0;
} else {
tmp = (1.0 / sin(B)) - t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -5e+71) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 500000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(F, F, 2.0)) * sin(B))) - t_0); else tmp = Float64(Float64(1.0 / sin(B)) - t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e+71], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 500000.0], N[(N[(F / N[(N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{+71}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 500000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)} \cdot \sin B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
\end{array}
if F < -4.99999999999999972e71Initial program 45.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 rewrites56.7%
Applied rewrites56.8%
Taylor expanded in F around -inf
Applied rewrites99.8%
if -4.99999999999999972e71 < F < 5e5Initial 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 5e5 < F Initial program 53.8%
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.8
Applied rewrites99.8%
Applied rewrites99.8%
Final simplification99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(-
(* (pow (+ (* x 2.0) (+ (* F F) 2.0)) (/ -1.0 2.0)) (/ F (sin B)))
(* (/ 1.0 (tan B)) x)))
(t_1 (sqrt (fma 2.0 x (fma F F 2.0))))
(t_2 (- (/ F (* t_1 B)) (/ x (tan B)))))
(if (<= t_0 1e-200)
t_2
(if (<= t_0 1000000.0)
(- (/ (/ F t_1) (sin B)) (/ x B))
(if (<= t_0 5e+292)
t_2
(/ (- (fma (/ -0.5 F) (/ (fma 2.0 x 2.0) F) 1.0) x) B))))))
double code(double F, double B, double x) {
double t_0 = (pow(((x * 2.0) + ((F * F) + 2.0)), (-1.0 / 2.0)) * (F / sin(B))) - ((1.0 / tan(B)) * x);
double t_1 = sqrt(fma(2.0, x, fma(F, F, 2.0)));
double t_2 = (F / (t_1 * B)) - (x / tan(B));
double tmp;
if (t_0 <= 1e-200) {
tmp = t_2;
} else if (t_0 <= 1000000.0) {
tmp = ((F / t_1) / sin(B)) - (x / B);
} else if (t_0 <= 5e+292) {
tmp = t_2;
} else {
tmp = (fma((-0.5 / F), (fma(2.0, x, 2.0) / F), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64((Float64(Float64(x * 2.0) + Float64(Float64(F * F) + 2.0)) ^ Float64(-1.0 / 2.0)) * Float64(F / sin(B))) - Float64(Float64(1.0 / tan(B)) * x)) t_1 = sqrt(fma(2.0, x, fma(F, F, 2.0))) t_2 = Float64(Float64(F / Float64(t_1 * B)) - Float64(x / tan(B))) tmp = 0.0 if (t_0 <= 1e-200) tmp = t_2; elseif (t_0 <= 1000000.0) tmp = Float64(Float64(Float64(F / t_1) / sin(B)) - Float64(x / B)); elseif (t_0 <= 5e+292) tmp = t_2; else tmp = Float64(Float64(fma(Float64(-0.5 / F), Float64(fma(2.0, x, 2.0) / F), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[Power[N[(N[(x * 2.0), $MachinePrecision] + N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(F / N[(t$95$1 * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-200], t$95$2, If[LessEqual[t$95$0, 1000000.0], N[(N[(N[(F / t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+292], t$95$2, N[(N[(N[(N[(-0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x \cdot 2 + \left(F \cdot F + 2\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot \frac{F}{\sin B} - \frac{1}{\tan B} \cdot x\\
t_1 := \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\\
t_2 := \frac{F}{t\_1 \cdot B} - \frac{x}{\tan B}\\
\mathbf{if}\;t\_0 \leq 10^{-200}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 1000000:\\
\;\;\;\;\frac{\frac{F}{t\_1}}{\sin B} - \frac{x}{B}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\
\end{array}
\end{array}
if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 9.9999999999999998e-201 or 1e6 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 4.9999999999999996e292Initial program 88.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 rewrites90.3%
Applied rewrites90.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6490.4
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6490.4
Applied rewrites90.4%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6482.7
Applied rewrites82.7%
if 9.9999999999999998e-201 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1e6Initial program 79.2%
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 rewrites79.5%
Applied rewrites79.5%
Taylor expanded in B around 0
lower-/.f6451.7
Applied rewrites51.7%
if 4.9999999999999996e292 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) Initial program 21.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6450.5
Applied rewrites50.5%
Taylor expanded in F around inf
Applied rewrites83.0%
Final simplification77.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(-
(* (pow (+ (* x 2.0) (+ (* F F) 2.0)) (/ -1.0 2.0)) (/ F (sin B)))
(* (/ 1.0 (tan B)) x)))
(t_1 (- (/ F (* (sqrt (fma 2.0 x (fma F F 2.0))) B)) (/ x (tan B)))))
(if (<= t_0 1e-200)
t_1
(if (<= t_0 1000000.0)
(- (/ F (* (sqrt (fma x 2.0 (fma F F 2.0))) (sin B))) (/ x B))
(if (<= t_0 5e+292)
t_1
(/ (- (fma (/ -0.5 F) (/ (fma 2.0 x 2.0) F) 1.0) x) B))))))
double code(double F, double B, double x) {
double t_0 = (pow(((x * 2.0) + ((F * F) + 2.0)), (-1.0 / 2.0)) * (F / sin(B))) - ((1.0 / tan(B)) * x);
double t_1 = (F / (sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - (x / tan(B));
double tmp;
if (t_0 <= 1e-200) {
tmp = t_1;
} else if (t_0 <= 1000000.0) {
tmp = (F / (sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - (x / B);
} else if (t_0 <= 5e+292) {
tmp = t_1;
} else {
tmp = (fma((-0.5 / F), (fma(2.0, x, 2.0) / F), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64((Float64(Float64(x * 2.0) + Float64(Float64(F * F) + 2.0)) ^ Float64(-1.0 / 2.0)) * Float64(F / sin(B))) - Float64(Float64(1.0 / tan(B)) * x)) t_1 = Float64(Float64(F / Float64(sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - Float64(x / tan(B))) tmp = 0.0 if (t_0 <= 1e-200) tmp = t_1; elseif (t_0 <= 1000000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - Float64(x / B)); elseif (t_0 <= 5e+292) tmp = t_1; else tmp = Float64(Float64(fma(Float64(-0.5 / F), Float64(fma(2.0, x, 2.0) / F), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[Power[N[(N[(x * 2.0), $MachinePrecision] + N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(F / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-200], t$95$1, If[LessEqual[t$95$0, 1000000.0], N[(N[(F / N[(N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+292], t$95$1, N[(N[(N[(N[(-0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x \cdot 2 + \left(F \cdot F + 2\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot \frac{F}{\sin B} - \frac{1}{\tan B} \cdot x\\
t_1 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot B} - \frac{x}{\tan B}\\
\mathbf{if}\;t\_0 \leq 10^{-200}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 1000000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B} - \frac{x}{B}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\
\end{array}
\end{array}
if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 9.9999999999999998e-201 or 1e6 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 4.9999999999999996e292Initial program 88.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 rewrites90.3%
Applied rewrites90.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6490.4
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6490.4
Applied rewrites90.4%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6482.7
Applied rewrites82.7%
if 9.9999999999999998e-201 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1e6Initial program 79.2%
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 rewrites79.5%
Applied rewrites79.5%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6479.5
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6479.5
Applied rewrites79.5%
Taylor expanded in B around 0
lower-/.f6451.7
Applied rewrites51.7%
if 4.9999999999999996e292 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) Initial program 21.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6450.5
Applied rewrites50.5%
Taylor expanded in F around inf
Applied rewrites83.0%
Final simplification77.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sin B)))
(t_1
(-
(* (pow (+ (* x 2.0) (+ (* F F) 2.0)) (/ -1.0 2.0)) t_0)
(* (/ 1.0 (tan B)) x)))
(t_2 (- (/ F (* (sqrt (fma 2.0 x (fma F F 2.0))) B)) (/ x (tan B)))))
(if (<= t_1 1e-7)
t_2
(if (<= t_1 1000000.0)
(* (sqrt (/ 1.0 (fma F F 2.0))) t_0)
(if (<= t_1 5e+292)
t_2
(/ (- (fma (/ -0.5 F) (/ (fma 2.0 x 2.0) F) 1.0) x) B))))))
double code(double F, double B, double x) {
double t_0 = F / sin(B);
double t_1 = (pow(((x * 2.0) + ((F * F) + 2.0)), (-1.0 / 2.0)) * t_0) - ((1.0 / tan(B)) * x);
double t_2 = (F / (sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - (x / tan(B));
double tmp;
if (t_1 <= 1e-7) {
tmp = t_2;
} else if (t_1 <= 1000000.0) {
tmp = sqrt((1.0 / fma(F, F, 2.0))) * t_0;
} else if (t_1 <= 5e+292) {
tmp = t_2;
} else {
tmp = (fma((-0.5 / F), (fma(2.0, x, 2.0) / F), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sin(B)) t_1 = Float64(Float64((Float64(Float64(x * 2.0) + Float64(Float64(F * F) + 2.0)) ^ Float64(-1.0 / 2.0)) * t_0) - Float64(Float64(1.0 / tan(B)) * x)) t_2 = Float64(Float64(F / Float64(sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - Float64(x / tan(B))) tmp = 0.0 if (t_1 <= 1e-7) tmp = t_2; elseif (t_1 <= 1000000.0) tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * t_0); elseif (t_1 <= 5e+292) tmp = t_2; else tmp = Float64(Float64(fma(Float64(-0.5 / F), Float64(fma(2.0, x, 2.0) / F), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(N[(x * 2.0), $MachinePrecision] + N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] - N[(N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(F / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-7], t$95$2, If[LessEqual[t$95$1, 1000000.0], N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 5e+292], t$95$2, N[(N[(N[(N[(-0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sin B}\\
t_1 := {\left(x \cdot 2 + \left(F \cdot F + 2\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot t\_0 - \frac{1}{\tan B} \cdot x\\
t_2 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot B} - \frac{x}{\tan B}\\
\mathbf{if}\;t\_1 \leq 10^{-7}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 1000000:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\
\end{array}
\end{array}
if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 9.9999999999999995e-8 or 1e6 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 4.9999999999999996e292Initial program 86.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 rewrites88.0%
Applied rewrites88.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6488.1
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6488.1
Applied rewrites88.1%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6479.4
Applied rewrites79.4%
if 9.9999999999999995e-8 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1e6Initial program 90.3%
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.f6485.4
Applied rewrites85.4%
if 4.9999999999999996e292 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) Initial program 21.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6450.5
Applied rewrites50.5%
Taylor expanded in F around inf
Applied rewrites83.0%
Final simplification80.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -38000000000000.0)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 420000.0)
(- (/ F (* (sqrt (fma 2.0 x (fma F F 2.0))) B)) t_0)
(- (/ 1.0 (sin B)) t_0)))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -38000000000000.0) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 420000.0) {
tmp = (F / (sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - t_0;
} else {
tmp = (1.0 / sin(B)) - t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -38000000000000.0) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 420000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - t_0); else tmp = Float64(Float64(1.0 / sin(B)) - t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -38000000000000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 420000.0], N[(N[(F / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -38000000000000:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 420000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
\end{array}
if F < -3.8e13Initial program 54.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 rewrites64.2%
Applied rewrites64.2%
Taylor expanded in F around -inf
Applied rewrites99.8%
if -3.8e13 < F < 4.2e5Initial 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 B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6489.5
Applied rewrites89.5%
if 4.2e5 < F Initial program 53.8%
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.8
Applied rewrites99.8%
Applied rewrites99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F 420000.0)
(- (/ F (* (sqrt (fma 2.0 x (fma F F 2.0))) B)) t_0)
(- (/ 1.0 (sin B)) t_0))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= 420000.0) {
tmp = (F / (sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - t_0;
} else {
tmp = (1.0 / sin(B)) - t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= 420000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - t_0); else tmp = Float64(Float64(1.0 / sin(B)) - t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 420000.0], N[(N[(F / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq 420000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
\end{array}
if F < 4.2e5Initial program 83.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 rewrites87.1%
Applied rewrites87.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6487.2
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6487.2
Applied rewrites87.2%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6476.2
Applied rewrites76.2%
if 4.2e5 < F Initial program 53.8%
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.8
Applied rewrites99.8%
Applied rewrites99.8%
(FPCore (F B x) :precision binary64 (if (<= F 420000.0) (- (/ F (* (sqrt (fma 2.0 x (fma F F 2.0))) B)) (/ x (tan B))) (/ (- 1.0 (* (cos B) x)) (sin B))))
double code(double F, double B, double x) {
double tmp;
if (F <= 420000.0) {
tmp = (F / (sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - (x / tan(B));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= 420000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(2.0, x, fma(F, F, 2.0))) * B)) - Float64(x / tan(B))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, 420000.0], N[(N[(F / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $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 420000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < 4.2e5Initial program 83.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 rewrites87.1%
Applied rewrites87.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6487.2
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6487.2
Applied rewrites87.2%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6476.2
Applied rewrites76.2%
if 4.2e5 < F Initial program 53.8%
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.8
Applied rewrites99.8%
Applied rewrites99.7%
(FPCore (F B x)
:precision binary64
(if (<= B 122.0)
(/
(fma
(sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))
(fma (* (* B B) F) 0.16666666666666666 F)
(fma 0.3333333333333333 (* (* B B) x) (- x)))
B)
(- (* (/ 1.0 F) (/ F B)) (/ x (tan B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 122.0) {
tmp = fma(sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))), fma(((B * B) * F), 0.16666666666666666, F), fma(0.3333333333333333, ((B * B) * x), -x)) / B;
} else {
tmp = ((1.0 / F) * (F / B)) - (x / tan(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 122.0) tmp = Float64(fma(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.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(Float64(1.0 / F) * Float64(F / B)) - Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 122.0], N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $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[(N[(1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 122:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \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}{F} \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if B < 122Initial program 76.0%
Taylor expanded in B around 0
Applied rewrites57.6%
if 122 < B Initial program 79.5%
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 rewrites79.6%
Applied rewrites79.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6458.6
Applied rewrites58.6%
Taylor expanded in F around inf
Applied rewrites58.6%
Final simplification57.8%
(FPCore (F B x)
:precision binary64
(if (<= B 122.0)
(/
(fma
(sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))
(fma (* (* B B) F) 0.16666666666666666 F)
(fma 0.3333333333333333 (* (* B B) x) (- x)))
B)
(- (* (/ -1.0 F) (/ F B)) (/ x (tan B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 122.0) {
tmp = fma(sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))), fma(((B * B) * F), 0.16666666666666666, F), fma(0.3333333333333333, ((B * B) * x), -x)) / B;
} else {
tmp = ((-1.0 / F) * (F / B)) - (x / tan(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 122.0) tmp = Float64(fma(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.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(Float64(-1.0 / F) * Float64(F / B)) - Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 122.0], N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $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[(N[(-1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 122:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \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}{F} \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if B < 122Initial program 76.0%
Taylor expanded in B around 0
Applied rewrites57.6%
if 122 < B Initial program 79.5%
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 rewrites79.6%
Applied rewrites79.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6458.6
Applied rewrites58.6%
Taylor expanded in F around -inf
Applied rewrites58.6%
Final simplification57.8%
(FPCore (F B x)
:precision binary64
(if (<= B 122.0)
(/
(fma
(sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))
(fma (* (* B B) F) 0.16666666666666666 F)
(fma 0.3333333333333333 (* (* B B) x) (- x)))
B)
(- (/ 1.0 B) (/ x (tan B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 122.0) {
tmp = fma(sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))), fma(((B * B) * F), 0.16666666666666666, F), fma(0.3333333333333333, ((B * B) * x), -x)) / B;
} else {
tmp = (1.0 / B) - (x / tan(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 122.0) tmp = Float64(fma(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.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 / B) - Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 122.0], N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $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 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 122:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \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}{B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if B < 122Initial program 76.0%
Taylor expanded in B around 0
Applied rewrites57.6%
if 122 < B Initial program 79.5%
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.f6453.7
Applied rewrites53.7%
Taylor expanded in B around 0
Applied rewrites56.6%
Applied rewrites56.8%
(FPCore (F B x)
:precision binary64
(if (<= F -1.35e+154)
(/ (/ 1.0 (/ (+ -1.0 x) (* (- -1.0 x) (+ -1.0 x)))) B)
(if (<= F 3.3e+30)
(/ (- (/ F (sqrt (fma F F 2.0))) x) B)
(if (<= F 3.1e+168) (/ 1.0 (sin B)) (- (/ 1.0 B) (/ x B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.35e+154) {
tmp = (1.0 / ((-1.0 + x) / ((-1.0 - x) * (-1.0 + x)))) / B;
} else if (F <= 3.3e+30) {
tmp = ((F / sqrt(fma(F, F, 2.0))) - x) / B;
} else if (F <= 3.1e+168) {
tmp = 1.0 / sin(B);
} else {
tmp = (1.0 / B) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.35e+154) tmp = Float64(Float64(1.0 / Float64(Float64(-1.0 + x) / Float64(Float64(-1.0 - x) * Float64(-1.0 + x)))) / B); elseif (F <= 3.3e+30) tmp = Float64(Float64(Float64(F / sqrt(fma(F, F, 2.0))) - x) / B); elseif (F <= 3.1e+168) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(1.0 / B) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.35e+154], N[(N[(1.0 / N[(N[(-1.0 + x), $MachinePrecision] / N[(N[(-1.0 - x), $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.3e+30], N[(N[(N[(F / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.1e+168], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{1}{\frac{-1 + x}{\left(-1 - x\right) \cdot \left(-1 + x\right)}}}{B}\\
\mathbf{elif}\;F \leq 3.3 \cdot 10^{+30}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - x}{B}\\
\mathbf{elif}\;F \leq 3.1 \cdot 10^{+168}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{B}\\
\end{array}
\end{array}
if F < -1.35000000000000003e154Initial program 23.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6412.2
Applied rewrites12.2%
Applied rewrites12.2%
Taylor expanded in F around -inf
Applied rewrites32.0%
Applied rewrites32.0%
if -1.35000000000000003e154 < F < 3.30000000000000026e30Initial program 97.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6458.7
Applied rewrites58.7%
Applied rewrites58.8%
Taylor expanded in x around 0
Applied rewrites58.8%
if 3.30000000000000026e30 < F < 3.09999999999999996e168Initial program 75.0%
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 x around 0
Applied rewrites61.0%
if 3.09999999999999996e168 < F Initial program 32.4%
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.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites87.6%
Taylor expanded in B around 0
Applied rewrites68.9%
Final simplification56.4%
(FPCore (F B x)
:precision binary64
(if (<= F -1.35e+154)
(/ (/ 1.0 (/ (+ -1.0 x) (* (- -1.0 x) (+ -1.0 x)))) B)
(if (<= F 1.9e+62)
(/ (- (/ F (sqrt (fma F F 2.0))) x) B)
(/
(- (fma (+ (* 0.3333333333333333 x) 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.35e+154) {
tmp = (1.0 / ((-1.0 + x) / ((-1.0 - x) * (-1.0 + x)))) / B;
} else if (F <= 1.9e+62) {
tmp = ((F / sqrt(fma(F, F, 2.0))) - x) / B;
} else {
tmp = (fma(((0.3333333333333333 * x) + 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.35e+154) tmp = Float64(Float64(1.0 / Float64(Float64(-1.0 + x) / Float64(Float64(-1.0 - x) * Float64(-1.0 + x)))) / B); elseif (F <= 1.9e+62) tmp = Float64(Float64(Float64(F / sqrt(fma(F, F, 2.0))) - x) / B); else tmp = Float64(Float64(fma(Float64(Float64(0.3333333333333333 * x) + 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.35e+154], N[(N[(1.0 / N[(N[(-1.0 + x), $MachinePrecision] / N[(N[(-1.0 - x), $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.9e+62], N[(N[(N[(F / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{1}{\frac{-1 + x}{\left(-1 - x\right) \cdot \left(-1 + x\right)}}}{B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{+62}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333 \cdot x + 0.16666666666666666, B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.35000000000000003e154Initial program 23.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6412.2
Applied rewrites12.2%
Applied rewrites12.2%
Taylor expanded in F around -inf
Applied rewrites32.0%
Applied rewrites32.0%
if -1.35000000000000003e154 < F < 1.89999999999999992e62Initial 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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6457.9
Applied rewrites57.9%
Applied rewrites58.0%
Taylor expanded in x around 0
Applied rewrites58.0%
if 1.89999999999999992e62 < F Initial program 48.6%
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.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites59.5%
Final simplification54.5%
(FPCore (F B x)
:precision binary64
(if (<= F -4e+129)
(/ (- -1.0 x) B)
(if (<= F 1.9e+62)
(/ (- (/ F (sqrt (fma F F 2.0))) x) B)
(/
(- (fma (+ (* 0.3333333333333333 x) 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4e+129) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.9e+62) {
tmp = ((F / sqrt(fma(F, F, 2.0))) - x) / B;
} else {
tmp = (fma(((0.3333333333333333 * x) + 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4e+129) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.9e+62) tmp = Float64(Float64(Float64(F / sqrt(fma(F, F, 2.0))) - x) / B); else tmp = Float64(Float64(fma(Float64(Float64(0.3333333333333333 * x) + 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4e+129], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.9e+62], N[(N[(N[(F / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4 \cdot 10^{+129}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{+62}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333 \cdot x + 0.16666666666666666, B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -4e129Initial program 32.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6418.0
Applied rewrites18.0%
Taylor expanded in F around -inf
Applied rewrites35.4%
if -4e129 < F < 1.89999999999999992e62Initial program 97.2%
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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6457.8
Applied rewrites57.8%
Applied rewrites57.9%
Taylor expanded in x around 0
Applied rewrites57.9%
if 1.89999999999999992e62 < F Initial program 48.6%
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.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites59.5%
Final simplification54.5%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4)
(/ (- -1.0 x) B)
(if (<= F 22.5)
(/ (- (/ F (sqrt 2.0)) x) B)
(/
(- (fma (+ (* 0.3333333333333333 x) 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4) {
tmp = (-1.0 - x) / B;
} else if (F <= 22.5) {
tmp = ((F / sqrt(2.0)) - x) / B;
} else {
tmp = (fma(((0.3333333333333333 * x) + 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 22.5) tmp = Float64(Float64(Float64(F / sqrt(2.0)) - x) / B); else tmp = Float64(Float64(fma(Float64(Float64(0.3333333333333333 * x) + 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 22.5], N[(N[(N[(F / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 22.5:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333 \cdot x + 0.16666666666666666, B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.3999999999999999Initial program 56.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6432.0
Applied rewrites32.0%
Taylor expanded in F around -inf
Applied rewrites42.1%
if -1.3999999999999999 < F < 22.5Initial 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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6460.0
Applied rewrites60.0%
Applied rewrites60.1%
Taylor expanded in x around 0
Applied rewrites60.1%
Taylor expanded in F around 0
Applied rewrites59.6%
if 22.5 < F Initial program 55.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.f6498.7
Applied rewrites98.7%
Taylor expanded in B around 0
Applied rewrites56.9%
Final simplification54.0%
(FPCore (F B x) :precision binary64 (if (<= F -7.6e-193) (/ (- -1.0 x) B) (if (<= F 6.2e-90) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.6e-193) {
tmp = (-1.0 - x) / B;
} else if (F <= 6.2e-90) {
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 <= (-7.6d-193)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 6.2d-90) 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 <= -7.6e-193) {
tmp = (-1.0 - x) / B;
} else if (F <= 6.2e-90) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -7.6e-193: tmp = (-1.0 - x) / B elif F <= 6.2e-90: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -7.6e-193) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 6.2e-90) 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 <= -7.6e-193) tmp = (-1.0 - x) / B; elseif (F <= 6.2e-90) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -7.6e-193], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 6.2e-90], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.6 \cdot 10^{-193}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 6.2 \cdot 10^{-90}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -7.60000000000000007e-193Initial program 70.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6438.2
Applied rewrites38.2%
Taylor expanded in F around -inf
Applied rewrites33.9%
if -7.60000000000000007e-193 < F < 6.2000000000000003e-90Initial program 99.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6465.1
Applied rewrites65.1%
Taylor expanded in F around 0
Applied rewrites53.1%
if 6.2000000000000003e-90 < F Initial program 66.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6443.0
Applied rewrites43.0%
Taylor expanded in F around inf
Applied rewrites46.8%
(FPCore (F B x) :precision binary64 (if (<= F -7.6e-193) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.6e-193) {
tmp = (-1.0 - x) / B;
} else {
tmp = -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 <= (-7.6d-193)) then
tmp = ((-1.0d0) - x) / b
else
tmp = -x / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -7.6e-193) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -7.6e-193: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -7.6e-193) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(Float64(-x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -7.6e-193) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -7.6e-193], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.6 \cdot 10^{-193}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -7.60000000000000007e-193Initial program 70.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6438.2
Applied rewrites38.2%
Taylor expanded in F around -inf
Applied rewrites33.9%
if -7.60000000000000007e-193 < F Initial program 80.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6452.6
Applied rewrites52.6%
Taylor expanded in F around 0
Applied rewrites34.3%
(FPCore (F B x) :precision binary64 (/ (- x) B))
double code(double F, double B, double x) {
return -x / B;
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -x / b
end function
public static double code(double F, double B, double x) {
return -x / B;
}
def code(F, B, x): return -x / B
function code(F, B, x) return Float64(Float64(-x) / B) end
function tmp = code(F, B, x) tmp = -x / B; end
code[F_, B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{B}
\end{array}
Initial program 76.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in F around 0
Applied rewrites26.5%
herbie shell --seed 2024276
(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))))))