Average Error: 0.1 → 0.1
Time: 4.2s
Precision: 64
\[0.0 \lt m \land 0.0 \lt v \land v \lt 0.25\]
\[\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)\]
\[\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot 1 + \mathsf{fma}\left(m, 1, \mathsf{fma}\left({m}^{3}, \frac{1}{v}, -1 \cdot \frac{{m}^{2}}{v}\right)\right)\]
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot 1 + \mathsf{fma}\left(m, 1, \mathsf{fma}\left({m}^{3}, \frac{1}{v}, -1 \cdot \frac{{m}^{2}}{v}\right)\right)
double code(double m, double v) {
	return ((((m * (1.0 - m)) / v) - 1.0) * (1.0 - m));
}
double code(double m, double v) {
	return (((((m * (1.0 - m)) / v) - 1.0) * 1.0) + fma(m, 1.0, fma(pow(m, 3.0), (1.0 / v), -(1.0 * (pow(m, 2.0) / v)))));
}

Error

Bits error versus m

Bits error versus v

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.1

    \[\leadsto \left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \color{blue}{\left(1 + \left(-m\right)\right)}\]
  4. Applied distribute-lft-in0.1

    \[\leadsto \color{blue}{\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot 1 + \left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(-m\right)}\]
  5. Taylor expanded around 0 0.1

    \[\leadsto \left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot 1 + \color{blue}{\left(\left(1 \cdot m + \frac{{m}^{3}}{v}\right) - 1 \cdot \frac{{m}^{2}}{v}\right)}\]
  6. Simplified0.1

    \[\leadsto \left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot 1 + \color{blue}{\mathsf{fma}\left(m, 1, \frac{{m}^{3}}{v} - 1 \cdot \frac{{m}^{2}}{v}\right)}\]
  7. Using strategy rm
  8. Applied div-inv0.1

    \[\leadsto \left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot 1 + \mathsf{fma}\left(m, 1, \color{blue}{{m}^{3} \cdot \frac{1}{v}} - 1 \cdot \frac{{m}^{2}}{v}\right)\]
  9. Applied fma-neg0.1

    \[\leadsto \left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot 1 + \mathsf{fma}\left(m, 1, \color{blue}{\mathsf{fma}\left({m}^{3}, \frac{1}{v}, -1 \cdot \frac{{m}^{2}}{v}\right)}\right)\]
  10. Final simplification0.1

    \[\leadsto \left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot 1 + \mathsf{fma}\left(m, 1, \mathsf{fma}\left({m}^{3}, \frac{1}{v}, -1 \cdot \frac{{m}^{2}}{v}\right)\right)\]

Reproduce

herbie shell --seed 2020053 +o rules:numerics
(FPCore (m v)
  :name "b parameter of renormalized beta distribution"
  :precision binary64
  :pre (and (< 0.0 m) (< 0.0 v) (< v 0.25))
  (* (- (/ (* m (- 1 m)) v) 1) (- 1 m)))