?

Average Error: 0.2 → 0.3
Time: 41.6s
Precision: binary64
Cost: 708

?

\[\left(0 < m \land 0 < v\right) \land v < 0.25\]
\[\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m \]
\[\begin{array}{l} \mathbf{if}\;m \leq 1.8 \cdot 10^{-17}:\\ \;\;\;\;\left(\left(\frac{m}{v} - 0.5\right) + -0.5\right) \cdot m\\ \mathbf{else}:\\ \;\;\;\;m \cdot \left(m \cdot \frac{1 - m}{v}\right)\\ \end{array} \]
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) m))
(FPCore (m v)
 :precision binary64
 (if (<= m 1.8e-17)
   (* (+ (- (/ m v) 0.5) -0.5) m)
   (* m (* m (/ (- 1.0 m) v)))))
double code(double m, double v) {
	return (((m * (1.0 - m)) / v) - 1.0) * m;
}
double code(double m, double v) {
	double tmp;
	if (m <= 1.8e-17) {
		tmp = (((m / v) - 0.5) + -0.5) * m;
	} else {
		tmp = m * (m * ((1.0 - m) / v));
	}
	return tmp;
}
real(8) function code(m, v)
    real(8), intent (in) :: m
    real(8), intent (in) :: v
    code = (((m * (1.0d0 - m)) / v) - 1.0d0) * m
end function
real(8) function code(m, v)
    real(8), intent (in) :: m
    real(8), intent (in) :: v
    real(8) :: tmp
    if (m <= 1.8d-17) then
        tmp = (((m / v) - 0.5d0) + (-0.5d0)) * m
    else
        tmp = m * (m * ((1.0d0 - m) / v))
    end if
    code = tmp
end function
public static double code(double m, double v) {
	return (((m * (1.0 - m)) / v) - 1.0) * m;
}
public static double code(double m, double v) {
	double tmp;
	if (m <= 1.8e-17) {
		tmp = (((m / v) - 0.5) + -0.5) * m;
	} else {
		tmp = m * (m * ((1.0 - m) / v));
	}
	return tmp;
}
def code(m, v):
	return (((m * (1.0 - m)) / v) - 1.0) * m
def code(m, v):
	tmp = 0
	if m <= 1.8e-17:
		tmp = (((m / v) - 0.5) + -0.5) * m
	else:
		tmp = m * (m * ((1.0 - m) / v))
	return tmp
function code(m, v)
	return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * m)
end
function code(m, v)
	tmp = 0.0
	if (m <= 1.8e-17)
		tmp = Float64(Float64(Float64(Float64(m / v) - 0.5) + -0.5) * m);
	else
		tmp = Float64(m * Float64(m * Float64(Float64(1.0 - m) / v)));
	end
	return tmp
end
function tmp = code(m, v)
	tmp = (((m * (1.0 - m)) / v) - 1.0) * m;
end
function tmp_2 = code(m, v)
	tmp = 0.0;
	if (m <= 1.8e-17)
		tmp = (((m / v) - 0.5) + -0.5) * m;
	else
		tmp = m * (m * ((1.0 - m) / v));
	end
	tmp_2 = tmp;
end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * m), $MachinePrecision]
code[m_, v_] := If[LessEqual[m, 1.8e-17], N[(N[(N[(N[(m / v), $MachinePrecision] - 0.5), $MachinePrecision] + -0.5), $MachinePrecision] * m), $MachinePrecision], N[(m * N[(m * N[(N[(1.0 - m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m
\begin{array}{l}
\mathbf{if}\;m \leq 1.8 \cdot 10^{-17}:\\
\;\;\;\;\left(\left(\frac{m}{v} - 0.5\right) + -0.5\right) \cdot m\\

\mathbf{else}:\\
\;\;\;\;m \cdot \left(m \cdot \frac{1 - m}{v}\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if m < 1.79999999999999997e-17

    1. Initial program 0.1

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

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

      \[\leadsto \left(\left(\color{blue}{\frac{m}{v}} - 0.5\right) + -0.5\right) \cdot m \]

    if 1.79999999999999997e-17 < m

    1. Initial program 0.4

      \[\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m \]
    2. Taylor expanded in v around 0 1.0

      \[\leadsto \color{blue}{\frac{m \cdot \left(1 - m\right)}{v}} \cdot m \]
    3. Applied egg-rr1.0

      \[\leadsto \color{blue}{m \cdot \left(\left(1 - m\right) \cdot \frac{m}{v}\right) + 0} \]
    4. Simplified1.0

      \[\leadsto \color{blue}{m \cdot \left(m \cdot \frac{1 - m}{v}\right)} \]
      Proof

      [Start]1.0

      \[ m \cdot \left(\left(1 - m\right) \cdot \frac{m}{v}\right) + 0 \]

      rational_best-simplify-3 [=>]1.0

      \[ \color{blue}{0 + m \cdot \left(\left(1 - m\right) \cdot \frac{m}{v}\right)} \]

      rational_best-simplify-6 [=>]1.0

      \[ \color{blue}{m \cdot \left(\left(1 - m\right) \cdot \frac{m}{v}\right)} \]

      rational_best-simplify-55 [=>]1.0

      \[ m \cdot \color{blue}{\left(m \cdot \frac{1 - m}{v}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq 1.8 \cdot 10^{-17}:\\ \;\;\;\;\left(\left(\frac{m}{v} - 0.5\right) + -0.5\right) \cdot m\\ \mathbf{else}:\\ \;\;\;\;m \cdot \left(m \cdot \frac{1 - m}{v}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.2
Cost832
\[\left(\left(\frac{m \cdot \left(1 - m\right)}{v} - 0.5\right) + -0.5\right) \cdot m \]
Alternative 2
Error24.3
Cost716
\[\begin{array}{l} t_0 := \frac{m}{v} \cdot m\\ \mathbf{if}\;v \leq 1.7 \cdot 10^{-210}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;v \leq 1.7 \cdot 10^{-199}:\\ \;\;\;\;-m\\ \mathbf{elif}\;v \leq 9.8 \cdot 10^{-138}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-m\\ \end{array} \]
Alternative 3
Error0.3
Cost708
\[\begin{array}{l} \mathbf{if}\;m \leq 1.8 \cdot 10^{-17}:\\ \;\;\;\;\left(\frac{m}{v} - 1\right) \cdot m\\ \mathbf{else}:\\ \;\;\;\;m \cdot \left(m \cdot \frac{1 - m}{v}\right)\\ \end{array} \]
Alternative 4
Error0.2
Cost704
\[m \cdot \left(-1 + m \cdot \frac{1 - m}{v}\right) \]
Alternative 5
Error0.2
Cost704
\[\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m \]
Alternative 6
Error10.1
Cost448
\[\left(\frac{m}{v} - 1\right) \cdot m \]
Alternative 7
Error36.3
Cost128
\[-m \]

Error

Reproduce?

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