Average Error: 20.3 → 5.4
Time: 5.9s
Precision: 64
$b \lt m$
$\left\lfloorx \cdot \left(1 - \frac{b}{m}\right)\right\rfloor$
$\begin{array}{l} \mathbf{if}\;m \le 0.0:\\ \;\;\;\;\left\lfloor\left(x \cdot \left(\sqrt{1} + \frac{\sqrt{b}}{\sqrt{m}}\right)\right) \cdot \left(\sqrt{1} - \frac{\sqrt{b}}{\sqrt{m}}\right)\right\rfloor\\ \mathbf{elif}\;m \le +\infty:\\ \;\;\;\;\left\lfloor\left(\sqrt{x} \cdot \sqrt{1 - \frac{b}{m}}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 - \frac{b}{m}}\right)\right\rfloor\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorx \cdot \left(1 - \frac{b}{m}\right)\right\rfloor\\ \end{array}$
\left\lfloorx \cdot \left(1 - \frac{b}{m}\right)\right\rfloor
\begin{array}{l}
\mathbf{if}\;m \le 0.0:\\
\;\;\;\;\left\lfloor\left(x \cdot \left(\sqrt{1} + \frac{\sqrt{b}}{\sqrt{m}}\right)\right) \cdot \left(\sqrt{1} - \frac{\sqrt{b}}{\sqrt{m}}\right)\right\rfloor\\

\mathbf{elif}\;m \le +\infty:\\
\;\;\;\;\left\lfloor\left(\sqrt{x} \cdot \sqrt{1 - \frac{b}{m}}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 - \frac{b}{m}}\right)\right\rfloor\\

\mathbf{else}:\\
\;\;\;\;\left\lfloorx \cdot \left(1 - \frac{b}{m}\right)\right\rfloor\\

\end{array}
double f(double x, double b, double m) {
double r2495178 = x;
double r2495179 = 1.0;
double r2495180 = b;
double r2495181 = m;
double r2495182 = r2495180 / r2495181;
double r2495183 = r2495179 - r2495182;
double r2495184 = r2495178 * r2495183;
double r2495185 = floor(r2495184);
return r2495185;
}


double f(double x, double b, double m) {
double r2495186 = m;
double r2495187 = 0.0;
bool r2495188 = r2495186 <= r2495187;
double r2495189 = x;
double r2495190 = 1.0;
double r2495191 = sqrt(r2495190);
double r2495192 = b;
double r2495193 = sqrt(r2495192);
double r2495194 = sqrt(r2495186);
double r2495195 = r2495193 / r2495194;
double r2495196 = r2495191 + r2495195;
double r2495197 = r2495189 * r2495196;
double r2495198 = r2495191 - r2495195;
double r2495199 = r2495197 * r2495198;
double r2495200 = floor(r2495199);
double r2495201 = +inf.0;
bool r2495202 = r2495186 <= r2495201;
double r2495203 = sqrt(r2495189);
double r2495204 = r2495192 / r2495186;
double r2495205 = r2495190 - r2495204;
double r2495206 = sqrt(r2495205);
double r2495207 = r2495203 * r2495206;
double r2495208 = r2495207 * r2495207;
double r2495209 = floor(r2495208);
double r2495210 = r2495189 * r2495205;
double r2495211 = floor(r2495210);
double r2495212 = r2495202 ? r2495209 : r2495211;
double r2495213 = r2495188 ? r2495200 : r2495212;
return r2495213;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if m < 0.0

1. Initial program 26.5

$\left\lfloorx \cdot \left(1 - \frac{b}{m}\right)\right\rfloor$
2. Using strategy rm

$\leadsto \left\lfloorx \cdot \left(1 - \frac{b}{\color{blue}{\sqrt{m} \cdot \sqrt{m}}}\right)\right\rfloor$

$\leadsto \left\lfloorx \cdot \left(1 - \frac{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}{\sqrt{m} \cdot \sqrt{m}}\right)\right\rfloor$
5. Applied times-frac2.6

$\leadsto \left\lfloorx \cdot \left(1 - \color{blue}{\frac{\sqrt{b}}{\sqrt{m}} \cdot \frac{\sqrt{b}}{\sqrt{m}}}\right)\right\rfloor$

$\leadsto \left\lfloorx \cdot \left(\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \frac{\sqrt{b}}{\sqrt{m}} \cdot \frac{\sqrt{b}}{\sqrt{m}}\right)\right\rfloor$
7. Applied difference-of-squares2.6

$\leadsto \left\lfloorx \cdot \color{blue}{\left(\left(\sqrt{1} + \frac{\sqrt{b}}{\sqrt{m}}\right) \cdot \left(\sqrt{1} - \frac{\sqrt{b}}{\sqrt{m}}\right)\right)}\right\rfloor$
8. Applied associate-*r*2.6

$\leadsto \left\lfloor\color{blue}{\left(x \cdot \left(\sqrt{1} + \frac{\sqrt{b}}{\sqrt{m}}\right)\right) \cdot \left(\sqrt{1} - \frac{\sqrt{b}}{\sqrt{m}}\right)}\right\rfloor$

## if 0.0 < m < +inf.0

1. Initial program 11.6

$\left\lfloorx \cdot \left(1 - \frac{b}{m}\right)\right\rfloor$
2. Using strategy rm

$\leadsto \left\lfloorx \cdot \color{blue}{\left(\sqrt{1 - \frac{b}{m}} \cdot \sqrt{1 - \frac{b}{m}}\right)}\right\rfloor$

$\leadsto \left\lfloor\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left(\sqrt{1 - \frac{b}{m}} \cdot \sqrt{1 - \frac{b}{m}}\right)\right\rfloor$
5. Applied unswap-sqr9.3

$\leadsto \left\lfloor\color{blue}{\left(\sqrt{x} \cdot \sqrt{1 - \frac{b}{m}}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 - \frac{b}{m}}\right)}\right\rfloor$

## if +inf.0 < m

1. Initial program 20.3

$\left\lfloorx \cdot \left(1 - \frac{b}{m}\right)\right\rfloor$
3. Recombined 3 regimes into one program.
4. Final simplification5.4

$\leadsto \begin{array}{l} \mathbf{if}\;m \le 0.0:\\ \;\;\;\;\left\lfloor\left(x \cdot \left(\sqrt{1} + \frac{\sqrt{b}}{\sqrt{m}}\right)\right) \cdot \left(\sqrt{1} - \frac{\sqrt{b}}{\sqrt{m}}\right)\right\rfloor\\ \mathbf{elif}\;m \le +\infty:\\ \;\;\;\;\left\lfloor\left(\sqrt{x} \cdot \sqrt{1 - \frac{b}{m}}\right) \cdot \left(\sqrt{x} \cdot \sqrt{1 - \frac{b}{m}}\right)\right\rfloor\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorx \cdot \left(1 - \frac{b}{m}\right)\right\rfloor\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x b m)
:name "floor(x * (1.0 - (b/m)))"
:precision binary32
:pre (< b m)
(floor (* x (- 1 (/ b m)))))