
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) m))
double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * m;
}
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
public static double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * m;
}
def code(m, v): return (((m * (1.0 - m)) / v) - 1.0) * m
function code(m, v) return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * m) end
function tmp = code(m, v) tmp = (((m * (1.0 - m)) / v) - 1.0) * m; end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * m), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) m))
double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * m;
}
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
public static double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * m;
}
def code(m, v): return (((m * (1.0 - m)) / v) - 1.0) * m
function code(m, v) return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * m) end
function tmp = code(m, v) tmp = (((m * (1.0 - m)) / v) - 1.0) * m; end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * m), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot m
\end{array}
(FPCore (m v) :precision binary64 (if (<= m 6.3e-46) (* m (+ (/ m v) -1.0)) (/ m (/ (/ v (- 1.0 m)) m))))
double code(double m, double v) {
double tmp;
if (m <= 6.3e-46) {
tmp = m * ((m / v) + -1.0);
} else {
tmp = m / ((v / (1.0 - m)) / m);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 6.3d-46) then
tmp = m * ((m / v) + (-1.0d0))
else
tmp = m / ((v / (1.0d0 - m)) / m)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 6.3e-46) {
tmp = m * ((m / v) + -1.0);
} else {
tmp = m / ((v / (1.0 - m)) / m);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6.3e-46: tmp = m * ((m / v) + -1.0) else: tmp = m / ((v / (1.0 - m)) / m) return tmp
function code(m, v) tmp = 0.0 if (m <= 6.3e-46) tmp = Float64(m * Float64(Float64(m / v) + -1.0)); else tmp = Float64(m / Float64(Float64(v / Float64(1.0 - m)) / m)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 6.3e-46) tmp = m * ((m / v) + -1.0); else tmp = m / ((v / (1.0 - m)) / m); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6.3e-46], N[(m * N[(N[(m / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(m / N[(N[(v / N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.3 \cdot 10^{-46}:\\
\;\;\;\;m \cdot \left(\frac{m}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{\frac{\frac{v}{1 - m}}{m}}\\
\end{array}
\end{array}
if m < 6.30000000000000001e-46Initial program 99.8%
Taylor expanded in m around 0 99.8%
if 6.30000000000000001e-46 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*r/99.8%
fma-def99.8%
metadata-eval99.8%
Simplified99.8%
metadata-eval99.8%
fma-neg99.8%
associate-*r/99.9%
*-commutative99.9%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.9%
unpow299.9%
associate-/l*99.9%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (m v)
:precision binary64
(if (<= m 5.5e-205)
(- m)
(if (<= m 1.8e-195)
(/ m (/ v m))
(if (<= m 1.5e-160)
(- m)
(if (<= m 1.0) (* m (/ m v)) (* m (/ (- m) v)))))))
double code(double m, double v) {
double tmp;
if (m <= 5.5e-205) {
tmp = -m;
} else if (m <= 1.8e-195) {
tmp = m / (v / m);
} else if (m <= 1.5e-160) {
tmp = -m;
} else if (m <= 1.0) {
tmp = m * (m / v);
} else {
tmp = m * (-m / v);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 5.5d-205) then
tmp = -m
else if (m <= 1.8d-195) then
tmp = m / (v / m)
else if (m <= 1.5d-160) then
tmp = -m
else if (m <= 1.0d0) then
tmp = m * (m / v)
else
tmp = m * (-m / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 5.5e-205) {
tmp = -m;
} else if (m <= 1.8e-195) {
tmp = m / (v / m);
} else if (m <= 1.5e-160) {
tmp = -m;
} else if (m <= 1.0) {
tmp = m * (m / v);
} else {
tmp = m * (-m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 5.5e-205: tmp = -m elif m <= 1.8e-195: tmp = m / (v / m) elif m <= 1.5e-160: tmp = -m elif m <= 1.0: tmp = m * (m / v) else: tmp = m * (-m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 5.5e-205) tmp = Float64(-m); elseif (m <= 1.8e-195) tmp = Float64(m / Float64(v / m)); elseif (m <= 1.5e-160) tmp = Float64(-m); elseif (m <= 1.0) tmp = Float64(m * Float64(m / v)); else tmp = Float64(m * Float64(Float64(-m) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 5.5e-205) tmp = -m; elseif (m <= 1.8e-195) tmp = m / (v / m); elseif (m <= 1.5e-160) tmp = -m; elseif (m <= 1.0) tmp = m * (m / v); else tmp = m * (-m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 5.5e-205], (-m), If[LessEqual[m, 1.8e-195], N[(m / N[(v / m), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.5e-160], (-m), If[LessEqual[m, 1.0], N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision], N[(m * N[((-m) / v), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.5 \cdot 10^{-205}:\\
\;\;\;\;-m\\
\mathbf{elif}\;m \leq 1.8 \cdot 10^{-195}:\\
\;\;\;\;\frac{m}{\frac{v}{m}}\\
\mathbf{elif}\;m \leq 1.5 \cdot 10^{-160}:\\
\;\;\;\;-m\\
\mathbf{elif}\;m \leq 1:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{-m}{v}\\
\end{array}
\end{array}
if m < 5.4999999999999996e-205 or 1.8e-195 < m < 1.49999999999999998e-160Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l/77.8%
associate-*r/99.9%
*-lft-identity99.9%
associate-*l/99.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-out99.9%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 77.8%
neg-mul-177.8%
Simplified77.8%
if 5.4999999999999996e-205 < m < 1.8e-195Initial program 99.7%
*-commutative99.7%
sub-neg99.7%
distribute-lft-in99.4%
*-commutative99.4%
associate-*l/3.4%
associate-*r/99.4%
*-lft-identity99.4%
associate-*l/99.4%
associate-*r*99.4%
*-commutative99.4%
distribute-rgt-out99.4%
associate-*r/99.7%
associate-/l*99.7%
/-rgt-identity99.7%
associate-*l/99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 4.5%
associate-/l*4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in m around 0 4.5%
unpow24.5%
associate-*r/99.2%
Simplified99.2%
Taylor expanded in m around 0 4.5%
unpow24.5%
associate-/l*99.4%
Simplified99.4%
if 1.49999999999999998e-160 < m < 1Initial program 99.7%
*-commutative99.7%
sub-neg99.7%
distribute-lft-in99.8%
*-commutative99.8%
associate-*l/98.7%
associate-*r/99.7%
*-lft-identity99.7%
associate-*l/99.6%
associate-*r*99.7%
*-commutative99.7%
distribute-rgt-out99.7%
associate-*r/99.7%
associate-/l*99.7%
/-rgt-identity99.7%
associate-*l/99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 64.9%
associate-/l*64.9%
unpow264.9%
Simplified64.9%
Taylor expanded in m around 0 63.8%
unpow263.8%
associate-*r/64.9%
Simplified64.9%
if 1 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l/99.9%
associate-*r/99.9%
*-lft-identity99.9%
associate-*l/99.9%
associate-*r*99.9%
*-commutative99.9%
distribute-rgt-out99.9%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 99.9%
associate-/l*99.9%
unpow299.9%
Simplified99.9%
Taylor expanded in m around 0 0.1%
unpow20.1%
associate-*r/0.1%
Simplified0.1%
Taylor expanded in m around 0 0.1%
unpow20.1%
associate-/l*0.1%
Simplified0.1%
div-inv0.1%
add-sqr-sqrt0.1%
sqrt-prod0.1%
sqr-neg0.1%
sqrt-unprod0.0%
add-sqr-sqrt72.4%
clear-num72.4%
distribute-lft-neg-out72.4%
Applied egg-rr72.4%
Final simplification72.7%
(FPCore (m v) :precision binary64 (if (or (<= v 1.8e-204) (and (not (<= v 4.2e-129)) (<= v 3.8e-116))) (* m (/ m v)) (- m)))
double code(double m, double v) {
double tmp;
if ((v <= 1.8e-204) || (!(v <= 4.2e-129) && (v <= 3.8e-116))) {
tmp = m * (m / v);
} else {
tmp = -m;
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if ((v <= 1.8d-204) .or. (.not. (v <= 4.2d-129)) .and. (v <= 3.8d-116)) then
tmp = m * (m / v)
else
tmp = -m
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if ((v <= 1.8e-204) || (!(v <= 4.2e-129) && (v <= 3.8e-116))) {
tmp = m * (m / v);
} else {
tmp = -m;
}
return tmp;
}
def code(m, v): tmp = 0 if (v <= 1.8e-204) or (not (v <= 4.2e-129) and (v <= 3.8e-116)): tmp = m * (m / v) else: tmp = -m return tmp
function code(m, v) tmp = 0.0 if ((v <= 1.8e-204) || (!(v <= 4.2e-129) && (v <= 3.8e-116))) tmp = Float64(m * Float64(m / v)); else tmp = Float64(-m); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if ((v <= 1.8e-204) || (~((v <= 4.2e-129)) && (v <= 3.8e-116))) tmp = m * (m / v); else tmp = -m; end tmp_2 = tmp; end
code[m_, v_] := If[Or[LessEqual[v, 1.8e-204], And[N[Not[LessEqual[v, 4.2e-129]], $MachinePrecision], LessEqual[v, 3.8e-116]]], N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision], (-m)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 1.8 \cdot 10^{-204} \lor \neg \left(v \leq 4.2 \cdot 10^{-129}\right) \land v \leq 3.8 \cdot 10^{-116}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;-m\\
\end{array}
\end{array}
if v < 1.79999999999999982e-204 or 4.2e-129 < v < 3.8000000000000001e-116Initial program 99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in99.8%
*-commutative99.8%
associate-*l/79.5%
associate-*r/99.7%
*-lft-identity99.7%
associate-*l/99.7%
associate-*r*99.7%
*-commutative99.7%
distribute-rgt-out99.8%
associate-*r/99.8%
associate-/l*99.8%
/-rgt-identity99.8%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 71.6%
associate-/l*71.6%
unpow271.6%
Simplified71.6%
Taylor expanded in m around 0 25.7%
unpow225.7%
associate-*r/42.9%
Simplified42.9%
if 1.79999999999999982e-204 < v < 4.2e-129 or 3.8000000000000001e-116 < v Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l/99.3%
associate-*r/99.9%
*-lft-identity99.9%
associate-*l/99.9%
associate-*r*99.9%
*-commutative99.9%
distribute-rgt-out99.9%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 40.4%
neg-mul-140.4%
Simplified40.4%
Final simplification41.4%
(FPCore (m v) :precision binary64 (if (<= v 2.2e-204) (* m (/ m v)) (if (<= v 1.75e-128) (- m) (if (<= v 3.7e-112) (/ m (/ v m)) (- m)))))
double code(double m, double v) {
double tmp;
if (v <= 2.2e-204) {
tmp = m * (m / v);
} else if (v <= 1.75e-128) {
tmp = -m;
} else if (v <= 3.7e-112) {
tmp = m / (v / m);
} else {
tmp = -m;
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (v <= 2.2d-204) then
tmp = m * (m / v)
else if (v <= 1.75d-128) then
tmp = -m
else if (v <= 3.7d-112) then
tmp = m / (v / m)
else
tmp = -m
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (v <= 2.2e-204) {
tmp = m * (m / v);
} else if (v <= 1.75e-128) {
tmp = -m;
} else if (v <= 3.7e-112) {
tmp = m / (v / m);
} else {
tmp = -m;
}
return tmp;
}
def code(m, v): tmp = 0 if v <= 2.2e-204: tmp = m * (m / v) elif v <= 1.75e-128: tmp = -m elif v <= 3.7e-112: tmp = m / (v / m) else: tmp = -m return tmp
function code(m, v) tmp = 0.0 if (v <= 2.2e-204) tmp = Float64(m * Float64(m / v)); elseif (v <= 1.75e-128) tmp = Float64(-m); elseif (v <= 3.7e-112) tmp = Float64(m / Float64(v / m)); else tmp = Float64(-m); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (v <= 2.2e-204) tmp = m * (m / v); elseif (v <= 1.75e-128) tmp = -m; elseif (v <= 3.7e-112) tmp = m / (v / m); else tmp = -m; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[v, 2.2e-204], N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 1.75e-128], (-m), If[LessEqual[v, 3.7e-112], N[(m / N[(v / m), $MachinePrecision]), $MachinePrecision], (-m)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 2.2 \cdot 10^{-204}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\mathbf{elif}\;v \leq 1.75 \cdot 10^{-128}:\\
\;\;\;\;-m\\
\mathbf{elif}\;v \leq 3.7 \cdot 10^{-112}:\\
\;\;\;\;\frac{m}{\frac{v}{m}}\\
\mathbf{else}:\\
\;\;\;\;-m\\
\end{array}
\end{array}
if v < 2.1999999999999998e-204Initial program 99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in99.8%
*-commutative99.8%
associate-*l/75.4%
associate-*r/99.7%
*-lft-identity99.7%
associate-*l/99.7%
associate-*r*99.7%
*-commutative99.7%
distribute-rgt-out99.7%
associate-*r/99.8%
associate-/l*99.8%
/-rgt-identity99.8%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 70.2%
associate-/l*70.2%
unpow270.2%
Simplified70.2%
Taylor expanded in m around 0 22.6%
unpow222.6%
associate-*r/43.3%
Simplified43.3%
if 2.1999999999999998e-204 < v < 1.75e-128 or 3.6999999999999998e-112 < v Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l/99.3%
associate-*r/99.9%
*-lft-identity99.9%
associate-*l/99.9%
associate-*r*99.9%
*-commutative99.9%
distribute-rgt-out99.9%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 40.8%
neg-mul-140.8%
Simplified40.8%
if 1.75e-128 < v < 3.6999999999999998e-112Initial program 99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in99.8%
*-commutative99.8%
associate-*l/99.9%
associate-*r/99.8%
*-lft-identity99.8%
associate-*l/99.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-out99.8%
associate-*r/99.8%
associate-/l*99.8%
/-rgt-identity99.8%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 78.4%
associate-/l*78.3%
unpow278.3%
Simplified78.3%
Taylor expanded in m around 0 38.4%
unpow238.4%
associate-*r/38.3%
Simplified38.3%
Taylor expanded in m around 0 38.4%
unpow238.4%
associate-/l*38.4%
Simplified38.4%
Final simplification41.4%
(FPCore (m v) :precision binary64 (if (<= m 6.3e-46) (* m (+ (/ m v) -1.0)) (* (* m m) (/ (- 1.0 m) v))))
double code(double m, double v) {
double tmp;
if (m <= 6.3e-46) {
tmp = m * ((m / v) + -1.0);
} 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
real(8) :: tmp
if (m <= 6.3d-46) then
tmp = m * ((m / v) + (-1.0d0))
else
tmp = (m * m) * ((1.0d0 - m) / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 6.3e-46) {
tmp = m * ((m / v) + -1.0);
} else {
tmp = (m * m) * ((1.0 - m) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6.3e-46: tmp = m * ((m / v) + -1.0) else: tmp = (m * m) * ((1.0 - m) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 6.3e-46) tmp = Float64(m * Float64(Float64(m / v) + -1.0)); else tmp = Float64(Float64(m * m) * Float64(Float64(1.0 - m) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 6.3e-46) tmp = m * ((m / v) + -1.0); else tmp = (m * m) * ((1.0 - m) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6.3e-46], N[(m * N[(N[(m / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(m * m), $MachinePrecision] * N[(N[(1.0 - m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.3 \cdot 10^{-46}:\\
\;\;\;\;m \cdot \left(\frac{m}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot m\right) \cdot \frac{1 - m}{v}\\
\end{array}
\end{array}
if m < 6.30000000000000001e-46Initial program 99.8%
Taylor expanded in m around 0 99.8%
if 6.30000000000000001e-46 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l/99.9%
associate-*r/99.9%
*-lft-identity99.9%
associate-*l/99.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-out99.8%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 99.9%
unpow299.9%
associate-*r*99.9%
associate-*r/99.9%
associate-*r/99.8%
associate-*r*99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (m v) :precision binary64 (* m (+ (/ (* m (- 1.0 m)) v) -1.0)))
double code(double m, double v) {
return m * (((m * (1.0 - m)) / v) + -1.0);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = m * (((m * (1.0d0 - m)) / v) + (-1.0d0))
end function
public static double code(double m, double v) {
return m * (((m * (1.0 - m)) / v) + -1.0);
}
def code(m, v): return m * (((m * (1.0 - m)) / v) + -1.0)
function code(m, v) return Float64(m * Float64(Float64(Float64(m * Float64(1.0 - m)) / v) + -1.0)) end
function tmp = code(m, v) tmp = m * (((m * (1.0 - m)) / v) + -1.0); end
code[m_, v_] := N[(m * N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
m \cdot \left(\frac{m \cdot \left(1 - m\right)}{v} + -1\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (m v) :precision binary64 (* m (+ (* (- 1.0 m) (/ m v)) -1.0)))
double code(double m, double v) {
return m * (((1.0 - m) * (m / v)) + -1.0);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = m * (((1.0d0 - m) * (m / v)) + (-1.0d0))
end function
public static double code(double m, double v) {
return m * (((1.0 - m) * (m / v)) + -1.0);
}
def code(m, v): return m * (((1.0 - m) * (m / v)) + -1.0)
function code(m, v) return Float64(m * Float64(Float64(Float64(1.0 - m) * Float64(m / v)) + -1.0)) end
function tmp = code(m, v) tmp = m * (((1.0 - m) * (m / v)) + -1.0); end
code[m_, v_] := N[(m * N[(N[(N[(1.0 - m), $MachinePrecision] * N[(m / v), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
m \cdot \left(\left(1 - m\right) \cdot \frac{m}{v} + -1\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.8%
*-commutative99.8%
associate-*l/91.8%
associate-*r/99.8%
*-lft-identity99.8%
associate-*l/99.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-out99.8%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* m (+ (/ m v) -1.0)) (* (* m m) (/ (- m) v))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = m * ((m / v) + -1.0);
} else {
tmp = (m * m) * (-m / v);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 1.0d0) then
tmp = m * ((m / v) + (-1.0d0))
else
tmp = (m * m) * (-m / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = m * ((m / v) + -1.0);
} else {
tmp = (m * m) * (-m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = m * ((m / v) + -1.0) else: tmp = (m * m) * (-m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.0) tmp = Float64(m * Float64(Float64(m / v) + -1.0)); else tmp = Float64(Float64(m * m) * Float64(Float64(-m) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.0) tmp = m * ((m / v) + -1.0); else tmp = (m * m) * (-m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.0], N[(m * N[(N[(m / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(m * m), $MachinePrecision] * N[((-m) / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;m \cdot \left(\frac{m}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot m\right) \cdot \frac{-m}{v}\\
\end{array}
\end{array}
if m < 1Initial program 99.8%
Taylor expanded in m around 0 99.3%
if 1 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l/99.9%
associate-*r/99.9%
*-lft-identity99.9%
associate-*l/99.9%
associate-*r*99.9%
*-commutative99.9%
distribute-rgt-out99.9%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 99.9%
associate-/l*99.9%
unpow299.9%
Simplified99.9%
Taylor expanded in m around inf 98.2%
associate-*r/98.2%
neg-mul-198.2%
Simplified98.2%
frac-2neg98.2%
div-inv98.2%
distribute-rgt-neg-in98.2%
distribute-frac-neg98.2%
remove-double-neg98.2%
clear-num98.2%
Applied egg-rr98.2%
Final simplification98.8%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* m (+ (/ m v) -1.0)) (* m (/ (- m) v))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = m * ((m / v) + -1.0);
} else {
tmp = m * (-m / v);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 1.0d0) then
tmp = m * ((m / v) + (-1.0d0))
else
tmp = m * (-m / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = m * ((m / v) + -1.0);
} else {
tmp = m * (-m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = m * ((m / v) + -1.0) else: tmp = m * (-m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.0) tmp = Float64(m * Float64(Float64(m / v) + -1.0)); else tmp = Float64(m * Float64(Float64(-m) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.0) tmp = m * ((m / v) + -1.0); else tmp = m * (-m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.0], N[(m * N[(N[(m / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(m * N[((-m) / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;m \cdot \left(\frac{m}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{-m}{v}\\
\end{array}
\end{array}
if m < 1Initial program 99.8%
Taylor expanded in m around 0 99.3%
if 1 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l/99.9%
associate-*r/99.9%
*-lft-identity99.9%
associate-*l/99.9%
associate-*r*99.9%
*-commutative99.9%
distribute-rgt-out99.9%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 99.9%
associate-/l*99.9%
unpow299.9%
Simplified99.9%
Taylor expanded in m around 0 0.1%
unpow20.1%
associate-*r/0.1%
Simplified0.1%
Taylor expanded in m around 0 0.1%
unpow20.1%
associate-/l*0.1%
Simplified0.1%
div-inv0.1%
add-sqr-sqrt0.1%
sqrt-prod0.1%
sqr-neg0.1%
sqrt-unprod0.0%
add-sqr-sqrt72.4%
clear-num72.4%
distribute-lft-neg-out72.4%
Applied egg-rr72.4%
Final simplification86.2%
(FPCore (m v) :precision binary64 (- m))
double code(double m, double v) {
return -m;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = -m
end function
public static double code(double m, double v) {
return -m;
}
def code(m, v): return -m
function code(m, v) return Float64(-m) end
function tmp = code(m, v) tmp = -m; end
code[m_, v_] := (-m)
\begin{array}{l}
\\
-m
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.8%
*-commutative99.8%
associate-*l/91.8%
associate-*r/99.8%
*-lft-identity99.8%
associate-*l/99.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-out99.8%
associate-*r/99.9%
associate-/l*99.9%
/-rgt-identity99.9%
associate-*l/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 29.2%
neg-mul-129.2%
Simplified29.2%
Final simplification29.2%
herbie shell --seed 2023238
(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))