
(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 14 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 (if (<= m 6.5e-41) (+ -1.0 (+ m (/ m v))) (/ (* m (- 1.0 m)) (/ v (- 1.0 m)))))
double code(double m, double v) {
double tmp;
if (m <= 6.5e-41) {
tmp = -1.0 + (m + (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 <= 6.5d-41) then
tmp = (-1.0d0) + (m + (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 <= 6.5e-41) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m * (1.0 - m)) / (v / (1.0 - m));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6.5e-41: tmp = -1.0 + (m + (m / v)) else: tmp = (m * (1.0 - m)) / (v / (1.0 - m)) return tmp
function code(m, v) tmp = 0.0 if (m <= 6.5e-41) tmp = Float64(-1.0 + Float64(m + 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 <= 6.5e-41) tmp = -1.0 + (m + (m / v)); else tmp = (m * (1.0 - m)) / (v / (1.0 - m)); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6.5e-41], N[(-1.0 + N[(m + 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 6.5 \cdot 10^{-41}:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m \cdot \left(1 - m\right)}{\frac{v}{1 - m}}\\
\end{array}
\end{array}
if m < 6.5000000000000004e-41Initial program 100.0%
*-commutative100.0%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
if 6.5000000000000004e-41 < m Initial program 99.8%
*-commutative99.8%
associate-/l*99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 99.8%
associate-*r/99.8%
Simplified99.8%
associate-*r*99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
(FPCore (m v)
:precision binary64
(if (<= m 6.8e-200)
-1.0
(if (<= m 1.2e-152)
(/ m v)
(if (<= m 9.2e-138)
-1.0
(if (<= m 1.0) (/ m v) (* m (/ (+ m -1.0) v)))))))
double code(double m, double v) {
double tmp;
if (m <= 6.8e-200) {
tmp = -1.0;
} else if (m <= 1.2e-152) {
tmp = m / v;
} else if (m <= 9.2e-138) {
tmp = -1.0;
} else if (m <= 1.0) {
tmp = m / v;
} else {
tmp = m * ((m + -1.0) / 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.8d-200) then
tmp = -1.0d0
else if (m <= 1.2d-152) then
tmp = m / v
else if (m <= 9.2d-138) then
tmp = -1.0d0
else if (m <= 1.0d0) then
tmp = m / v
else
tmp = m * ((m + (-1.0d0)) / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 6.8e-200) {
tmp = -1.0;
} else if (m <= 1.2e-152) {
tmp = m / v;
} else if (m <= 9.2e-138) {
tmp = -1.0;
} else if (m <= 1.0) {
tmp = m / v;
} else {
tmp = m * ((m + -1.0) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6.8e-200: tmp = -1.0 elif m <= 1.2e-152: tmp = m / v elif m <= 9.2e-138: tmp = -1.0 elif m <= 1.0: tmp = m / v else: tmp = m * ((m + -1.0) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 6.8e-200) tmp = -1.0; elseif (m <= 1.2e-152) tmp = Float64(m / v); elseif (m <= 9.2e-138) tmp = -1.0; elseif (m <= 1.0) tmp = Float64(m / v); else tmp = Float64(m * Float64(Float64(m + -1.0) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 6.8e-200) tmp = -1.0; elseif (m <= 1.2e-152) tmp = m / v; elseif (m <= 9.2e-138) tmp = -1.0; elseif (m <= 1.0) tmp = m / v; else tmp = m * ((m + -1.0) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6.8e-200], -1.0, If[LessEqual[m, 1.2e-152], N[(m / v), $MachinePrecision], If[LessEqual[m, 9.2e-138], -1.0, If[LessEqual[m, 1.0], N[(m / v), $MachinePrecision], N[(m * N[(N[(m + -1.0), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.8 \cdot 10^{-200}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1.2 \cdot 10^{-152}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{elif}\;m \leq 9.2 \cdot 10^{-138}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m + -1}{v}\\
\end{array}
\end{array}
if m < 6.8000000000000006e-200 or 1.2e-152 < m < 9.1999999999999996e-138Initial program 100.0%
associate-/l*100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in m around 0 86.4%
if 6.8000000000000006e-200 < m < 1.2e-152 or 9.1999999999999996e-138 < m < 1Initial program 99.9%
*-commutative99.9%
associate-/l*99.7%
fma-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 74.1%
associate-*r/73.9%
Simplified73.9%
associate-*r*73.9%
*-commutative73.9%
clear-num73.9%
un-div-inv74.1%
Applied egg-rr74.1%
Taylor expanded in m around 0 71.2%
if 1 < m Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in m around 0 0.1%
associate-*r*0.1%
*-commutative0.1%
div-inv0.1%
frac-2neg0.1%
distribute-rgt-neg-in0.1%
add-sqr-sqrt0.0%
sqrt-unprod77.6%
sqr-neg77.6%
sqrt-unprod77.7%
add-sqr-sqrt77.7%
Applied egg-rr77.7%
associate-/l*77.7%
neg-mul-177.7%
*-commutative77.7%
*-commutative77.7%
neg-mul-177.7%
neg-sub077.7%
associate--r-77.7%
metadata-eval77.7%
Simplified77.7%
Final simplification77.3%
(FPCore (m v)
:precision binary64
(if (<= m 8.3e-200)
-1.0
(if (<= m 1.25e-152)
(/ m v)
(if (<= m 2.85e-138) -1.0 (* m (/ (+ m 1.0) v))))))
double code(double m, double v) {
double tmp;
if (m <= 8.3e-200) {
tmp = -1.0;
} else if (m <= 1.25e-152) {
tmp = m / v;
} else if (m <= 2.85e-138) {
tmp = -1.0;
} else {
tmp = m * ((m + 1.0) / v);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 8.3d-200) then
tmp = -1.0d0
else if (m <= 1.25d-152) then
tmp = m / v
else if (m <= 2.85d-138) then
tmp = -1.0d0
else
tmp = m * ((m + 1.0d0) / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 8.3e-200) {
tmp = -1.0;
} else if (m <= 1.25e-152) {
tmp = m / v;
} else if (m <= 2.85e-138) {
tmp = -1.0;
} else {
tmp = m * ((m + 1.0) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 8.3e-200: tmp = -1.0 elif m <= 1.25e-152: tmp = m / v elif m <= 2.85e-138: tmp = -1.0 else: tmp = m * ((m + 1.0) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 8.3e-200) tmp = -1.0; elseif (m <= 1.25e-152) tmp = Float64(m / v); elseif (m <= 2.85e-138) tmp = -1.0; else tmp = Float64(m * Float64(Float64(m + 1.0) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 8.3e-200) tmp = -1.0; elseif (m <= 1.25e-152) tmp = m / v; elseif (m <= 2.85e-138) tmp = -1.0; else tmp = m * ((m + 1.0) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 8.3e-200], -1.0, If[LessEqual[m, 1.25e-152], N[(m / v), $MachinePrecision], If[LessEqual[m, 2.85e-138], -1.0, N[(m * N[(N[(m + 1.0), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 8.3 \cdot 10^{-200}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1.25 \cdot 10^{-152}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{elif}\;m \leq 2.85 \cdot 10^{-138}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m + 1}{v}\\
\end{array}
\end{array}
if m < 8.3000000000000003e-200 or 1.2499999999999999e-152 < m < 2.8499999999999999e-138Initial program 100.0%
associate-/l*100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in m around 0 86.4%
if 8.3000000000000003e-200 < m < 1.2499999999999999e-152Initial program 100.0%
*-commutative100.0%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 73.2%
associate-*r/73.1%
Simplified73.1%
associate-*r*73.1%
*-commutative73.1%
clear-num73.1%
un-div-inv73.2%
Applied egg-rr73.2%
Taylor expanded in m around 0 73.2%
if 2.8499999999999999e-138 < m Initial program 99.9%
*-commutative99.9%
associate-/l*99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 92.3%
associate-*r/92.2%
Simplified92.2%
Taylor expanded in m around 0 21.1%
un-div-inv21.2%
add-sqr-sqrt21.0%
sqrt-unprod7.1%
sqr-neg7.1%
sqrt-unprod0.0%
add-sqr-sqrt55.2%
clear-num55.2%
frac-2neg55.2%
metadata-eval55.2%
add-sqr-sqrt0.0%
sqrt-unprod7.1%
sqr-neg7.1%
sqrt-unprod21.0%
add-sqr-sqrt21.1%
distribute-frac-neg21.1%
add-sqr-sqrt0.0%
sqrt-unprod55.1%
sqr-neg55.1%
sqrt-unprod55.2%
add-sqr-sqrt55.2%
Applied egg-rr55.2%
associate-*r/55.2%
frac-2neg55.2%
associate-/r/55.2%
*-commutative55.2%
neg-mul-155.2%
frac-2neg55.2%
sub-neg55.2%
add-sqr-sqrt0.0%
sqrt-unprod0.8%
sqr-neg0.8%
sqrt-unprod0.8%
add-sqr-sqrt0.8%
add-sqr-sqrt0.0%
sqrt-unprod75.4%
sqr-neg75.4%
sqrt-unprod75.3%
add-sqr-sqrt75.4%
Applied egg-rr75.4%
Final simplification77.2%
(FPCore (m v) :precision binary64 (if (<= m 1.6e-14) (+ -1.0 (+ m (/ m v))) (* m (* (- 1.0 m) (/ (- 1.0 m) v)))))
double code(double m, double v) {
double tmp;
if (m <= 1.6e-14) {
tmp = -1.0 + (m + (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 <= 1.6d-14) then
tmp = (-1.0d0) + (m + (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 <= 1.6e-14) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = m * ((1.0 - m) * ((1.0 - m) / v));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.6e-14: tmp = -1.0 + (m + (m / v)) else: tmp = m * ((1.0 - m) * ((1.0 - m) / v)) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.6e-14) tmp = Float64(-1.0 + Float64(m + 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 <= 1.6e-14) tmp = -1.0 + (m + (m / v)); else tmp = m * ((1.0 - m) * ((1.0 - m) / v)); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.6e-14], N[(-1.0 + N[(m + 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 1.6 \cdot 10^{-14}:\\
\;\;\;\;-1 + \left(m + \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 < 1.6000000000000001e-14Initial program 100.0%
*-commutative100.0%
associate-/l*99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
distribute-lft-in99.8%
*-rgt-identity99.8%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
if 1.6000000000000001e-14 < m Initial program 99.8%
*-commutative99.8%
associate-/l*99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 99.8%
associate-*r/99.8%
Simplified99.8%
*-commutative99.8%
associate-*r*99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ -1.0 (/ m v))) (/ (* m (+ m -1.0)) (/ v m))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = (m * (m + -1.0)) / (v / 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 * (m + (-1.0d0))) / (v / 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 * (m + -1.0)) / (v / m);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = (m * (m + -1.0)) / (v / 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(Float64(m * Float64(m + -1.0)) / Float64(v / 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 * (m + -1.0)) / (v / 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[(N[(m * N[(m + -1.0), $MachinePrecision]), $MachinePrecision] / N[(v / 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 \cdot \left(m + -1\right)}{\frac{v}{m}}\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
Taylor expanded in m around 0 98.2%
if 1 < m Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
associate-*r/99.9%
Simplified99.9%
associate-*r*99.9%
*-commutative99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in m around inf 98.2%
mul-1-neg98.2%
distribute-neg-frac298.2%
Simplified98.2%
Final simplification98.2%
(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 98.2%
if 1 < m Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in m around inf 98.1%
neg-mul-198.1%
distribute-neg-frac298.1%
Simplified98.1%
Final simplification98.1%
(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(m * Float64(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[(m * N[(N[(m / v), $MachinePrecision] * N[(m + -1.0), $MachinePrecision]), $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}:\\
\;\;\;\;m \cdot \left(\frac{m}{v} \cdot \left(m + -1\right)\right)\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
Taylor expanded in m around 0 98.2%
if 1 < m Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
associate-*r/99.9%
Simplified99.9%
*-commutative99.9%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in m around inf 98.1%
neg-mul-198.1%
distribute-neg-frac298.1%
Simplified98.1%
Final simplification98.1%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ -1.0 (/ m v))) (* m (* m (/ (+ m 1.0) v)))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = m * (m * ((m + 1.0) / 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 = (1.0d0 - m) * ((-1.0d0) + (m / v))
else
tmp = m * (m * ((m + 1.0d0) / v))
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 * ((m + 1.0) / v));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = m * (m * ((m + 1.0) / v)) 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(m * Float64(Float64(m + 1.0) / v))); 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 * ((m + 1.0) / v)); 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[(m * N[(N[(m + 1.0), $MachinePrecision] / v), $MachinePrecision]), $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}:\\
\;\;\;\;m \cdot \left(m \cdot \frac{m + 1}{v}\right)\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
Taylor expanded in m around 0 98.2%
if 1 < m Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in m around inf 98.1%
neg-mul-198.1%
distribute-neg-frac298.1%
Simplified98.1%
*-commutative98.1%
distribute-frac-neg298.1%
distribute-frac-neg98.1%
associate-*l/98.1%
Applied egg-rr98.1%
*-commutative98.1%
associate-/l*98.1%
associate-*l*98.1%
add-sqr-sqrt0.0%
sqrt-unprod0.1%
sqr-neg0.1%
sqrt-unprod0.1%
add-sqr-sqrt0.1%
clear-num0.1%
associate-/r/0.1%
associate-/r*0.1%
clear-num0.1%
associate-/l*0.1%
sub-neg0.1%
add-sqr-sqrt0.0%
sqrt-unprod98.0%
sqr-neg98.0%
sqrt-unprod98.0%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
Final simplification98.1%
(FPCore (m v) :precision binary64 (if (<= m 2.85) (+ -1.0 (+ m (/ m v))) (* m (* m (/ (+ m 1.0) v)))))
double code(double m, double v) {
double tmp;
if (m <= 2.85) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = m * (m * ((m + 1.0) / v));
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 2.85d0) then
tmp = (-1.0d0) + (m + (m / v))
else
tmp = m * (m * ((m + 1.0d0) / v))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.85) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = m * (m * ((m + 1.0) / v));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.85: tmp = -1.0 + (m + (m / v)) else: tmp = m * (m * ((m + 1.0) / v)) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.85) tmp = Float64(-1.0 + Float64(m + Float64(m / v))); else tmp = Float64(m * Float64(m * Float64(Float64(m + 1.0) / v))); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.85) tmp = -1.0 + (m + (m / v)); else tmp = m * (m * ((m + 1.0) / v)); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.85], N[(-1.0 + N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(m * N[(m * N[(N[(m + 1.0), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.85:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;m \cdot \left(m \cdot \frac{m + 1}{v}\right)\\
\end{array}
\end{array}
if m < 2.85000000000000009Initial program 99.9%
*-commutative99.9%
associate-/l*99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 97.3%
sub-neg97.3%
metadata-eval97.3%
+-commutative97.3%
distribute-lft-in97.3%
*-rgt-identity97.3%
associate-*r/97.5%
*-rgt-identity97.5%
Simplified97.5%
if 2.85000000000000009 < m Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in m around inf 98.7%
neg-mul-198.7%
distribute-neg-frac298.7%
Simplified98.7%
*-commutative98.7%
distribute-frac-neg298.7%
distribute-frac-neg98.7%
associate-*l/98.7%
Applied egg-rr98.7%
*-commutative98.7%
associate-/l*98.7%
associate-*l*98.7%
add-sqr-sqrt0.0%
sqrt-unprod0.1%
sqr-neg0.1%
sqrt-unprod0.1%
add-sqr-sqrt0.1%
clear-num0.1%
associate-/r/0.1%
associate-/r*0.1%
clear-num0.1%
associate-/l*0.1%
sub-neg0.1%
add-sqr-sqrt0.0%
sqrt-unprod98.7%
sqr-neg98.7%
sqrt-unprod98.6%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
Final simplification98.1%
(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%
associate-/l*99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (+ -1.0 (+ m (/ m v))) (* m (/ (+ m -1.0) v))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = m * ((m + -1.0) / 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 = (-1.0d0) + (m + (m / v))
else
tmp = m * ((m + (-1.0d0)) / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = m * ((m + -1.0) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = -1.0 + (m + (m / v)) else: tmp = m * ((m + -1.0) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.0) tmp = Float64(-1.0 + Float64(m + Float64(m / v))); else tmp = Float64(m * Float64(Float64(m + -1.0) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.0) tmp = -1.0 + (m + (m / v)); else tmp = m * ((m + -1.0) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.0], N[(-1.0 + N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(m * N[(N[(m + -1.0), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m + -1}{v}\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
*-commutative100.0%
associate-/l*99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 98.0%
sub-neg98.0%
metadata-eval98.0%
+-commutative98.0%
distribute-lft-in98.0%
*-rgt-identity98.0%
associate-*r/98.1%
*-rgt-identity98.1%
Simplified98.1%
if 1 < m Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in m around 0 0.1%
associate-*r*0.1%
*-commutative0.1%
div-inv0.1%
frac-2neg0.1%
distribute-rgt-neg-in0.1%
add-sqr-sqrt0.0%
sqrt-unprod77.6%
sqr-neg77.6%
sqrt-unprod77.7%
add-sqr-sqrt77.7%
Applied egg-rr77.7%
associate-/l*77.7%
neg-mul-177.7%
*-commutative77.7%
*-commutative77.7%
neg-mul-177.7%
neg-sub077.7%
associate--r-77.7%
metadata-eval77.7%
Simplified77.7%
Final simplification87.7%
(FPCore (m v) :precision binary64 (if (<= v 9e-106) (/ m v) (+ m -1.0)))
double code(double m, double v) {
double tmp;
if (v <= 9e-106) {
tmp = m / v;
} else {
tmp = 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 (v <= 9d-106) then
tmp = m / v
else
tmp = m + (-1.0d0)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (v <= 9e-106) {
tmp = m / v;
} else {
tmp = m + -1.0;
}
return tmp;
}
def code(m, v): tmp = 0 if v <= 9e-106: tmp = m / v else: tmp = m + -1.0 return tmp
function code(m, v) tmp = 0.0 if (v <= 9e-106) tmp = Float64(m / v); else tmp = Float64(m + -1.0); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (v <= 9e-106) tmp = m / v; else tmp = m + -1.0; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[v, 9e-106], N[(m / v), $MachinePrecision], N[(m + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 9 \cdot 10^{-106}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m + -1\\
\end{array}
\end{array}
if v < 8.99999999999999911e-106Initial program 99.9%
*-commutative99.9%
associate-/l*99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 84.5%
associate-*r/84.4%
Simplified84.4%
associate-*r*84.4%
*-commutative84.4%
clear-num84.5%
un-div-inv84.5%
Applied egg-rr84.5%
Taylor expanded in m around 0 67.4%
if 8.99999999999999911e-106 < v Initial program 99.8%
*-commutative99.8%
associate-/l*99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around inf 45.5%
neg-mul-145.5%
neg-sub045.5%
associate--r-45.5%
metadata-eval45.5%
Simplified45.5%
Final simplification60.2%
(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%
associate-/l*99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around inf 26.1%
neg-mul-126.1%
neg-sub026.1%
associate--r-26.1%
metadata-eval26.1%
Simplified26.1%
Final simplification26.1%
(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%
associate-/l*99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in m around 0 23.7%
herbie shell --seed 2024096
(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)))