Average Error: 0.2 → 0.2
Time: 4.0s
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 *-un-lft-identity_binary640.2

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

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

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

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

Reproduce

herbie shell --seed 2022004 
(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))