Average Error: 20.3 → 5.4
Time: 5.8s
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 r2497250 = x;
double r2497251 = 1.0;
double r2497252 = b;
double r2497253 = m;
double r2497254 = r2497252 / r2497253;
double r2497255 = r2497251 - r2497254;
double r2497256 = r2497250 * r2497255;
double r2497257 = floor(r2497256);
return r2497257;
}


double f(double x, double b, double m) {
double r2497258 = m;
double r2497259 = 0.0;
bool r2497260 = r2497258 <= r2497259;
double r2497261 = x;
double r2497262 = 1.0;
double r2497263 = sqrt(r2497262);
double r2497264 = b;
double r2497265 = sqrt(r2497264);
double r2497266 = sqrt(r2497258);
double r2497267 = r2497265 / r2497266;
double r2497268 = r2497263 + r2497267;
double r2497269 = r2497261 * r2497268;
double r2497270 = r2497263 - r2497267;
double r2497271 = r2497269 * r2497270;
double r2497272 = floor(r2497271);
double r2497273 = +inf.0;
bool r2497274 = r2497258 <= r2497273;
double r2497275 = sqrt(r2497261);
double r2497276 = r2497264 / r2497258;
double r2497277 = r2497262 - r2497276;
double r2497278 = sqrt(r2497277);
double r2497279 = r2497275 * r2497278;
double r2497280 = r2497279 * r2497279;
double r2497281 = floor(r2497280);
double r2497282 = r2497261 * r2497277;
double r2497283 = floor(r2497282);
double r2497284 = r2497274 ? r2497281 : r2497283;
double r2497285 = r2497260 ? r2497272 : r2497284;
return r2497285;
}



# Try it out

Your Program's Arguments

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
3. Applied add-sqr-sqrt2.6

$\leadsto \left\lfloorx \cdot \left(1 - \frac{b}{\color{blue}{\sqrt{m} \cdot \sqrt{m}}}\right)\right\rfloor$
4. Applied add-sqr-sqrt2.6

$\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$
6. Applied add-sqr-sqrt2.6

$\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
3. Applied add-sqr-sqrt0.1

$\leadsto \left\lfloorx \cdot \color{blue}{\left(\sqrt{1 - \frac{b}{m}} \cdot \sqrt{1 - \frac{b}{m}}\right)}\right\rfloor$
4. Applied add-sqr-sqrt9.3

$\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)))))