
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) (- 1.0 m)))
double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (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) * (1.0d0 - m)
end function
public static double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
def code(m, v): return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m)
function code(m, v) return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * Float64(1.0 - m)) end
function tmp = code(m, v) tmp = (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m); end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) (- 1.0 m)))
double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (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) * (1.0d0 - m)
end function
public static double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
def code(m, v): return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m)
function code(m, v) return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * Float64(1.0 - m)) end
function tmp = code(m, v) tmp = (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m); end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)
\end{array}
(FPCore (m v) :precision binary64 (* (- 1.0 m) (+ (/ m (/ v (- 1.0 m))) -1.0)))
double code(double m, double v) {
return (1.0 - m) * ((m / (v / (1.0 - m))) + -1.0);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (1.0d0 - m) * ((m / (v / (1.0d0 - m))) + (-1.0d0))
end function
public static double code(double m, double v) {
return (1.0 - m) * ((m / (v / (1.0 - m))) + -1.0);
}
def code(m, v): return (1.0 - m) * ((m / (v / (1.0 - m))) + -1.0)
function code(m, v) return Float64(Float64(1.0 - m) * Float64(Float64(m / Float64(v / Float64(1.0 - m))) + -1.0)) end
function tmp = code(m, v) tmp = (1.0 - m) * ((m / (v / (1.0 - m))) + -1.0); end
code[m_, v_] := N[(N[(1.0 - m), $MachinePrecision] * N[(N[(m / N[(v / N[(1.0 - m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - m\right) \cdot \left(\frac{m}{\frac{v}{1 - m}} + -1\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 2.2e-173) -1.0 (if (<= m 1.0) (* (- 1.0 m) (/ m v)) (* (/ m v) (+ m -1.0)))))
double code(double m, double v) {
double tmp;
if (m <= 2.2e-173) {
tmp = -1.0;
} else if (m <= 1.0) {
tmp = (1.0 - m) * (m / v);
} else {
tmp = (m / v) * (m + -1.0);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 2.2d-173) then
tmp = -1.0d0
else if (m <= 1.0d0) then
tmp = (1.0d0 - m) * (m / v)
else
tmp = (m / v) * (m + (-1.0d0))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.2e-173) {
tmp = -1.0;
} else if (m <= 1.0) {
tmp = (1.0 - m) * (m / v);
} else {
tmp = (m / v) * (m + -1.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.2e-173: tmp = -1.0 elif m <= 1.0: tmp = (1.0 - m) * (m / v) else: tmp = (m / v) * (m + -1.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.2e-173) tmp = -1.0; elseif (m <= 1.0) tmp = Float64(Float64(1.0 - m) * Float64(m / v)); else tmp = Float64(Float64(m / v) * Float64(m + -1.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.2e-173) tmp = -1.0; elseif (m <= 1.0) tmp = (1.0 - m) * (m / v); else tmp = (m / v) * (m + -1.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.2e-173], -1.0, If[LessEqual[m, 1.0], N[(N[(1.0 - m), $MachinePrecision] * N[(m / v), $MachinePrecision]), $MachinePrecision], N[(N[(m / v), $MachinePrecision] * N[(m + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.2 \cdot 10^{-173}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1:\\
\;\;\;\;\left(1 - m\right) \cdot \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{v} \cdot \left(m + -1\right)\\
\end{array}
\end{array}
if m < 2.1999999999999999e-173Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 75.2%
if 2.1999999999999999e-173 < m < 1Initial program 99.9%
sub-neg99.9%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 75.7%
*-commutative75.7%
associate-/l*75.7%
mul-1-neg75.7%
*-rgt-identity75.7%
unpow275.7%
distribute-rgt-neg-in75.7%
distribute-lft-in75.6%
sub-neg75.6%
associate-/l*75.4%
Simplified75.4%
Taylor expanded in m around 0 71.7%
if 1 < m Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.8%
*-commutative99.8%
associate-/l*99.9%
mul-1-neg99.9%
*-rgt-identity99.9%
unpow299.9%
distribute-rgt-neg-in99.9%
distribute-lft-in99.9%
sub-neg99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in m around 0 0.1%
associate-*r/0.1%
*-commutative0.1%
clear-num0.1%
frac-2neg0.1%
metadata-eval0.1%
distribute-neg-frac0.1%
add-sqr-sqrt0.0%
sqrt-unprod70.4%
sqr-neg70.4%
sqrt-unprod69.8%
add-sqr-sqrt69.8%
*-commutative69.8%
associate-/r*69.8%
Applied egg-rr69.8%
associate-/r/69.8%
associate-*l/69.8%
neg-mul-169.8%
distribute-frac-neg69.8%
associate-/r/69.8%
*-commutative69.8%
distribute-lft-neg-out69.8%
neg-sub069.8%
associate--r-69.8%
metadata-eval69.8%
+-commutative69.8%
*-commutative69.8%
+-commutative69.8%
Simplified69.8%
Final simplification71.4%
(FPCore (m v) :precision binary64 (if (<= m 4e-22) (* (+ 1.0 m) (+ -1.0 (/ m v))) (* m (* (- 1.0 m) (/ (- 1.0 m) v)))))
double code(double m, double v) {
double tmp;
if (m <= 4e-22) {
tmp = (1.0 + m) * (-1.0 + (m / v));
} else {
tmp = m * ((1.0 - 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 <= 4d-22) then
tmp = (1.0d0 + m) * ((-1.0d0) + (m / v))
else
tmp = m * ((1.0d0 - m) * ((1.0d0 - m) / v))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 4e-22) {
tmp = (1.0 + m) * (-1.0 + (m / v));
} else {
tmp = m * ((1.0 - m) * ((1.0 - m) / v));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 4e-22: tmp = (1.0 + m) * (-1.0 + (m / v)) else: tmp = m * ((1.0 - m) * ((1.0 - m) / v)) return tmp
function code(m, v) tmp = 0.0 if (m <= 4e-22) tmp = Float64(Float64(1.0 + m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(m * Float64(Float64(1.0 - m) * Float64(Float64(1.0 - m) / v))); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 4e-22) tmp = (1.0 + m) * (-1.0 + (m / v)); else tmp = m * ((1.0 - m) * ((1.0 - m) / v)); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 4e-22], N[(N[(1.0 + m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(m * N[(N[(1.0 - m), $MachinePrecision] * N[(N[(1.0 - m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4 \cdot 10^{-22}:\\
\;\;\;\;\left(1 + m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;m \cdot \left(\left(1 - m\right) \cdot \frac{1 - m}{v}\right)\\
\end{array}
\end{array}
if m < 4.0000000000000002e-22Initial program 100.0%
Taylor expanded in m around 0 100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod100.0%
add-sqr-sqrt100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
distribute-rgt1-in100.0%
Simplified100.0%
if 4.0000000000000002e-22 < m Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.7%
*-commutative99.7%
associate-/l*99.8%
mul-1-neg99.8%
*-rgt-identity99.8%
unpow299.8%
distribute-rgt-neg-in99.8%
distribute-lft-in99.8%
sub-neg99.8%
associate-/l*99.8%
Simplified99.8%
associate-*r*99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
associate-/l*99.8%
*-commutative99.8%
div-inv99.8%
clear-num99.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 1e-26) (* (+ 1.0 m) (+ -1.0 (/ m v))) (* (* (/ m v) (+ m -1.0)) (+ m -1.0))))
double code(double m, double v) {
double tmp;
if (m <= 1e-26) {
tmp = (1.0 + m) * (-1.0 + (m / v));
} else {
tmp = ((m / v) * (m + -1.0)) * (m + -1.0);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 1d-26) then
tmp = (1.0d0 + m) * ((-1.0d0) + (m / v))
else
tmp = ((m / v) * (m + (-1.0d0))) * (m + (-1.0d0))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1e-26) {
tmp = (1.0 + m) * (-1.0 + (m / v));
} else {
tmp = ((m / v) * (m + -1.0)) * (m + -1.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1e-26: tmp = (1.0 + m) * (-1.0 + (m / v)) else: tmp = ((m / v) * (m + -1.0)) * (m + -1.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 1e-26) tmp = Float64(Float64(1.0 + m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(Float64(Float64(m / v) * Float64(m + -1.0)) * Float64(m + -1.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1e-26) tmp = (1.0 + m) * (-1.0 + (m / v)); else tmp = ((m / v) * (m + -1.0)) * (m + -1.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1e-26], N[(N[(1.0 + m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(m / v), $MachinePrecision] * N[(m + -1.0), $MachinePrecision]), $MachinePrecision] * N[(m + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 10^{-26}:\\
\;\;\;\;\left(1 + m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{m}{v} \cdot \left(m + -1\right)\right) \cdot \left(m + -1\right)\\
\end{array}
\end{array}
if m < 1e-26Initial program 100.0%
Taylor expanded in m around 0 100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod100.0%
add-sqr-sqrt100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
distribute-rgt1-in100.0%
Simplified100.0%
if 1e-26 < m Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.7%
*-commutative99.7%
associate-/l*99.8%
mul-1-neg99.8%
*-rgt-identity99.8%
unpow299.8%
distribute-rgt-neg-in99.8%
distribute-lft-in99.8%
sub-neg99.8%
associate-/l*99.8%
Simplified99.8%
associate-*r*99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
associate-/r/99.8%
*-commutative99.8%
associate-*r/99.8%
associate-*l*99.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 5e-28) (* (+ 1.0 m) (+ -1.0 (/ m v))) (/ (* m (- 1.0 m)) (/ v (- 1.0 m)))))
double code(double m, double v) {
double tmp;
if (m <= 5e-28) {
tmp = (1.0 + m) * (-1.0 + (m / v));
} else {
tmp = (m * (1.0 - m)) / (v / (1.0 - m));
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 5d-28) then
tmp = (1.0d0 + m) * ((-1.0d0) + (m / v))
else
tmp = (m * (1.0d0 - m)) / (v / (1.0d0 - m))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 5e-28) {
tmp = (1.0 + m) * (-1.0 + (m / v));
} else {
tmp = (m * (1.0 - m)) / (v / (1.0 - m));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 5e-28: tmp = (1.0 + m) * (-1.0 + (m / v)) else: tmp = (m * (1.0 - m)) / (v / (1.0 - m)) return tmp
function code(m, v) tmp = 0.0 if (m <= 5e-28) tmp = Float64(Float64(1.0 + m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(Float64(m * Float64(1.0 - m)) / Float64(v / Float64(1.0 - m))); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 5e-28) tmp = (1.0 + m) * (-1.0 + (m / v)); else tmp = (m * (1.0 - m)) / (v / (1.0 - m)); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 5e-28], N[(N[(1.0 + m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / N[(v / N[(1.0 - m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5 \cdot 10^{-28}:\\
\;\;\;\;\left(1 + m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m \cdot \left(1 - m\right)}{\frac{v}{1 - m}}\\
\end{array}
\end{array}
if m < 5.0000000000000002e-28Initial program 100.0%
Taylor expanded in m around 0 100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod100.0%
add-sqr-sqrt100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
distribute-rgt1-in100.0%
Simplified100.0%
if 5.0000000000000002e-28 < m Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.7%
*-commutative99.7%
associate-/l*99.8%
mul-1-neg99.8%
*-rgt-identity99.8%
unpow299.8%
distribute-rgt-neg-in99.8%
distribute-lft-in99.8%
sub-neg99.8%
associate-/l*99.8%
Simplified99.8%
associate-*r*99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ -1.0 (/ m v))) (* (* m (/ m v)) (+ m -1.0))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = (m * (m / v)) * (m + -1.0);
}
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 = (1.0d0 - m) * ((-1.0d0) + (m / v))
else
tmp = (m * (m / v)) * (m + (-1.0d0))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = (m * (m / v)) * (m + -1.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = (m * (m / v)) * (m + -1.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.0) tmp = Float64(Float64(1.0 - m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(Float64(m * Float64(m / v)) * Float64(m + -1.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.0) tmp = (1.0 - m) * (-1.0 + (m / v)); else tmp = (m * (m / v)) * (m + -1.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.0], N[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision] * N[(m + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;\left(1 - m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot \frac{m}{v}\right) \cdot \left(m + -1\right)\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
Taylor expanded in m around 0 97.6%
if 1 < m Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.8%
*-commutative99.8%
associate-/l*99.9%
mul-1-neg99.9%
*-rgt-identity99.9%
unpow299.9%
distribute-rgt-neg-in99.9%
distribute-lft-in99.9%
sub-neg99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in m around inf 98.2%
neg-mul-198.2%
distribute-neg-frac298.2%
Simplified98.2%
Final simplification97.9%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ -1.0 (/ m v))) (/ m (/ (/ v (+ m -1.0)) m))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = m / ((v / (m + -1.0)) / m);
}
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 = (1.0d0 - m) * ((-1.0d0) + (m / v))
else
tmp = m / ((v / (m + (-1.0d0))) / m)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = m / ((v / (m + -1.0)) / m);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = m / ((v / (m + -1.0)) / m) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.0) tmp = Float64(Float64(1.0 - m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(m / Float64(Float64(v / Float64(m + -1.0)) / m)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.0) tmp = (1.0 - m) * (-1.0 + (m / v)); else tmp = m / ((v / (m + -1.0)) / m); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.0], N[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(m / N[(N[(v / N[(m + -1.0), $MachinePrecision]), $MachinePrecision] / m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;\left(1 - m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{\frac{\frac{v}{m + -1}}{m}}\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
Taylor expanded in m around 0 97.6%
if 1 < m Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.8%
*-commutative99.8%
associate-/l*99.9%
mul-1-neg99.9%
*-rgt-identity99.9%
unpow299.9%
distribute-rgt-neg-in99.9%
distribute-lft-in99.9%
sub-neg99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in m around inf 98.2%
neg-mul-198.2%
distribute-neg-frac298.2%
Simplified98.2%
*-commutative98.2%
*-commutative98.2%
associate-*l*98.2%
add-sqr-sqrt0.0%
sqrt-unprod0.1%
sqr-neg0.1%
sqrt-unprod0.1%
add-sqr-sqrt0.1%
associate-/r/0.1%
frac-2neg0.1%
distribute-neg-frac0.1%
add-sqr-sqrt0.0%
sqrt-unprod96.6%
sqr-neg96.6%
sqrt-unprod98.1%
add-sqr-sqrt98.2%
*-commutative98.2%
associate-/r*98.2%
Applied egg-rr98.2%
Final simplification97.9%
(FPCore (m v) :precision binary64 (* (- 1.0 m) (+ -1.0 (* m (/ (- 1.0 m) v)))))
double code(double m, double v) {
return (1.0 - m) * (-1.0 + (m * ((1.0 - m) / v)));
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (1.0d0 - m) * ((-1.0d0) + (m * ((1.0d0 - m) / v)))
end function
public static double code(double m, double v) {
return (1.0 - m) * (-1.0 + (m * ((1.0 - m) / v)));
}
def code(m, v): return (1.0 - m) * (-1.0 + (m * ((1.0 - m) / v)))
function code(m, v) return Float64(Float64(1.0 - m) * Float64(-1.0 + Float64(m * Float64(Float64(1.0 - m) / v)))) end
function tmp = code(m, v) tmp = (1.0 - m) * (-1.0 + (m * ((1.0 - m) / v))); end
code[m_, v_] := N[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 + N[(m * N[(N[(1.0 - m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - m\right) \cdot \left(-1 + m \cdot \frac{1 - m}{v}\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (m v) :precision binary64 (if (<= m 5.6e-177) -1.0 (/ (* m (+ 1.0 m)) v)))
double code(double m, double v) {
double tmp;
if (m <= 5.6e-177) {
tmp = -1.0;
} else {
tmp = (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 <= 5.6d-177) then
tmp = -1.0d0
else
tmp = (m * (1.0d0 + m)) / v
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 5.6e-177) {
tmp = -1.0;
} else {
tmp = (m * (1.0 + m)) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 5.6e-177: tmp = -1.0 else: tmp = (m * (1.0 + m)) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 5.6e-177) tmp = -1.0; else tmp = Float64(Float64(m * Float64(1.0 + m)) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 5.6e-177) tmp = -1.0; else tmp = (m * (1.0 + m)) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 5.6e-177], -1.0, N[(N[(m * N[(1.0 + m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.6 \cdot 10^{-177}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\frac{m \cdot \left(1 + m\right)}{v}\\
\end{array}
\end{array}
if m < 5.59999999999999973e-177Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 75.2%
if 5.59999999999999973e-177 < m Initial program 99.9%
Taylor expanded in m around 0 34.1%
sub-neg34.1%
distribute-rgt-in34.1%
*-un-lft-identity34.1%
sub-neg34.1%
metadata-eval34.1%
add-sqr-sqrt0.0%
sqrt-unprod79.0%
sqr-neg79.0%
sqrt-unprod79.0%
add-sqr-sqrt79.0%
sub-neg79.0%
metadata-eval79.0%
Applied egg-rr79.0%
distribute-rgt1-in79.0%
Simplified79.0%
Taylor expanded in v around 0 70.4%
+-commutative70.4%
Simplified70.4%
Final simplification71.3%
(FPCore (m v) :precision binary64 (* (+ 1.0 m) (+ -1.0 (/ m v))))
double code(double m, double v) {
return (1.0 + m) * (-1.0 + (m / v));
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (1.0d0 + m) * ((-1.0d0) + (m / v))
end function
public static double code(double m, double v) {
return (1.0 + m) * (-1.0 + (m / v));
}
def code(m, v): return (1.0 + m) * (-1.0 + (m / v))
function code(m, v) return Float64(Float64(1.0 + m) * Float64(-1.0 + Float64(m / v))) end
function tmp = code(m, v) tmp = (1.0 + m) * (-1.0 + (m / v)); end
code[m_, v_] := N[(N[(1.0 + m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + m\right) \cdot \left(-1 + \frac{m}{v}\right)
\end{array}
Initial program 99.9%
Taylor expanded in m around 0 47.0%
sub-neg47.0%
distribute-rgt-in47.0%
*-un-lft-identity47.0%
sub-neg47.0%
metadata-eval47.0%
add-sqr-sqrt0.0%
sqrt-unprod83.1%
sqr-neg83.1%
sqrt-unprod83.1%
add-sqr-sqrt83.1%
sub-neg83.1%
metadata-eval83.1%
Applied egg-rr83.1%
distribute-rgt1-in83.1%
Simplified83.1%
Final simplification83.1%
(FPCore (m v) :precision binary64 (if (<= m 7.2e-173) -1.0 (/ m v)))
double code(double m, double v) {
double tmp;
if (m <= 7.2e-173) {
tmp = -1.0;
} else {
tmp = 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 <= 7.2d-173) then
tmp = -1.0d0
else
tmp = m / v
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 7.2e-173) {
tmp = -1.0;
} else {
tmp = m / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 7.2e-173: tmp = -1.0 else: tmp = m / v return tmp
function code(m, v) tmp = 0.0 if (m <= 7.2e-173) tmp = -1.0; else tmp = Float64(m / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 7.2e-173) tmp = -1.0; else tmp = m / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 7.2e-173], -1.0, N[(m / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7.2 \cdot 10^{-173}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{v}\\
\end{array}
\end{array}
if m < 7.19999999999999943e-173Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 75.2%
if 7.19999999999999943e-173 < m Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 91.2%
*-commutative91.2%
associate-/l*91.3%
mul-1-neg91.3%
*-rgt-identity91.3%
unpow291.3%
distribute-rgt-neg-in91.3%
distribute-lft-in91.3%
sub-neg91.3%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in m around 0 25.5%
Taylor expanded in m around 0 54.8%
Final simplification58.8%
(FPCore (m v) :precision binary64 (+ m -1.0))
double code(double m, double v) {
return m + -1.0;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = m + (-1.0d0)
end function
public static double code(double m, double v) {
return m + -1.0;
}
def code(m, v): return m + -1.0
function code(m, v) return Float64(m + -1.0) end
function tmp = code(m, v) tmp = m + -1.0; end
code[m_, v_] := N[(m + -1.0), $MachinePrecision]
\begin{array}{l}
\\
m + -1
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around inf 23.7%
neg-mul-123.7%
neg-sub023.7%
associate--r-23.7%
metadata-eval23.7%
Simplified23.7%
Final simplification23.7%
(FPCore (m v) :precision binary64 -1.0)
double code(double m, double v) {
return -1.0;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = -1.0d0
end function
public static double code(double m, double v) {
return -1.0;
}
def code(m, v): return -1.0
function code(m, v) return -1.0 end
function tmp = code(m, v) tmp = -1.0; end
code[m_, v_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 21.2%
Final simplification21.2%
herbie shell --seed 2024039
(FPCore (m v)
:name "b 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) (- 1.0 m)))