Average Error: 0.2 → 0.2
Time: 3.4s
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(1, \frac{m \cdot \left(1 - m\right)}{v}, -1\right) \]
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m
m \cdot \mathsf{fma}\left(1, \frac{m \cdot \left(1 - m\right)}{v}, -1\right)
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) m))
(FPCore (m v) :precision binary64 (* m (fma 1.0 (/ (* m (- 1.0 m)) v) -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(1.0, ((m * (1.0 - m)) / v), -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. Applied *-un-lft-identity_binary640.2

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

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

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

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

Reproduce

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