Average Error: 0.2 → 0.2
Time: 5.7s
Precision: binary64
\[\left(0 < m \land 0 < v\right) \land v < 0.25\]
\[\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m \]
\[m \cdot \mathsf{fma}\left(\frac{m}{v}, 1 - m, -1\right) \]
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m
m \cdot \mathsf{fma}\left(\frac{m}{v}, 1 - m, -1\right)
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) m))
(FPCore (m v) :precision binary64 (* m (fma (/ m v) (- 1.0 m) -1.0)))
double code(double m, double v) {
	return (((m * (1.0 - m)) / v) - 1.0) * m;
}
double code(double m, double v) {
	return m * fma((m / v), (1.0 - m), -1.0);
}

Error

Bits error versus m

Bits error versus v

Derivation

  1. Initial program 0.2

    \[\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m \]
  2. Simplified0.2

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

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

    \[\leadsto \color{blue}{{m}^{1}} \cdot {\left(\mathsf{fma}\left(m, \frac{1 - m}{v}, -1\right)\right)}^{1} \]
  5. Applied pow-prod-down_binary640.2

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

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

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

Reproduce

herbie shell --seed 2022005 
(FPCore (m v)
  :name "a parameter of renormalized beta distribution"
  :precision binary64
  :pre (and (and (< 0.0 m) (< 0.0 v)) (< v 0.25))
  (* (- (/ (* m (- 1.0 m)) v) 1.0) m))