
(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 12 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 (- 1.0 m)) v) -1.0)))
double code(double m, double v) {
return (1.0 - 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 = (1.0d0 - m) * (((m * (1.0d0 - m)) / v) + (-1.0d0))
end function
public static double code(double m, double v) {
return (1.0 - m) * (((m * (1.0 - m)) / v) + -1.0);
}
def code(m, v): return (1.0 - m) * (((m * (1.0 - m)) / v) + -1.0)
function code(m, v) return Float64(Float64(1.0 - m) * Float64(Float64(Float64(m * Float64(1.0 - m)) / v) + -1.0)) end
function tmp = code(m, v) tmp = (1.0 - m) * (((m * (1.0 - m)) / v) + -1.0); end
code[m_, v_] := N[(N[(1.0 - m), $MachinePrecision] * N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - m\right) \cdot \left(\frac{m \cdot \left(1 - m\right)}{v} + -1\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (m v) :precision binary64 (if (<= m 2e-19) (+ -1.0 (/ m v)) (/ (* (- 1.0 m) (- m (* m m))) v)))
double code(double m, double v) {
double tmp;
if (m <= 2e-19) {
tmp = -1.0 + (m / v);
} else {
tmp = ((1.0 - m) * (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 <= 2d-19) then
tmp = (-1.0d0) + (m / v)
else
tmp = ((1.0d0 - m) * (m - (m * m))) / v
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2e-19) {
tmp = -1.0 + (m / v);
} else {
tmp = ((1.0 - m) * (m - (m * m))) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2e-19: tmp = -1.0 + (m / v) else: tmp = ((1.0 - m) * (m - (m * m))) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 2e-19) tmp = Float64(-1.0 + Float64(m / v)); else tmp = Float64(Float64(Float64(1.0 - m) * Float64(m - Float64(m * m))) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2e-19) tmp = -1.0 + (m / v); else tmp = ((1.0 - m) * (m - (m * m))) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2e-19], N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - m), $MachinePrecision] * N[(m - N[(m * m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2 \cdot 10^{-19}:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - m\right) \cdot \left(m - m \cdot m\right)}{v}\\
\end{array}
\end{array}
if m < 2e-19Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
associate-/r/100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in m around 0 99.9%
sub-neg99.9%
*-commutative99.9%
distribute-rgt-in99.9%
*-lft-identity99.9%
associate-*l/100.0%
*-lft-identity100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in v around 0 100.0%
if 2e-19 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
associate-/r/99.9%
sub-neg99.9%
distribute-rgt-in54.1%
*-un-lft-identity54.1%
div-inv54.1%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.9%
+-commutative99.9%
pow299.9%
mul-1-neg99.9%
unsub-neg99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 5e-20) (+ -1.0 (/ m v)) (/ (+ m (* (* m m) (+ m -2.0))) v)))
double code(double m, double v) {
double tmp;
if (m <= 5e-20) {
tmp = -1.0 + (m / v);
} else {
tmp = (m + ((m * m) * (m + -2.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 <= 5d-20) then
tmp = (-1.0d0) + (m / v)
else
tmp = (m + ((m * m) * (m + (-2.0d0)))) / v
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 5e-20) {
tmp = -1.0 + (m / v);
} else {
tmp = (m + ((m * m) * (m + -2.0))) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 5e-20: tmp = -1.0 + (m / v) else: tmp = (m + ((m * m) * (m + -2.0))) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 5e-20) tmp = Float64(-1.0 + Float64(m / v)); else tmp = Float64(Float64(m + Float64(Float64(m * m) * Float64(m + -2.0))) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 5e-20) tmp = -1.0 + (m / v); else tmp = (m + ((m * m) * (m + -2.0))) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 5e-20], N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision], N[(N[(m + N[(N[(m * m), $MachinePrecision] * N[(m + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5 \cdot 10^{-20}:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;\frac{m + \left(m \cdot m\right) \cdot \left(m + -2\right)}{v}\\
\end{array}
\end{array}
if m < 4.9999999999999999e-20Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
associate-/r/100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in m around 0 99.9%
sub-neg99.9%
*-commutative99.9%
distribute-rgt-in99.9%
*-lft-identity99.9%
associate-*l/100.0%
*-lft-identity100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in v around 0 100.0%
if 4.9999999999999999e-20 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
associate-/r/99.9%
sub-neg99.9%
distribute-rgt-in54.1%
*-un-lft-identity54.1%
div-inv54.1%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.9%
Taylor expanded in m around 0 51.8%
+-commutative51.8%
+-commutative51.8%
associate-+l+51.8%
cube-mult51.8%
unpow251.8%
distribute-rgt-out99.9%
Simplified99.9%
Final simplification100.0%
(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 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (m v) :precision binary64 (if (<= m 2.45) (+ -1.0 (/ m v)) (* m (* m (/ (+ m -2.0) v)))))
double code(double m, double v) {
double tmp;
if (m <= 2.45) {
tmp = -1.0 + (m / v);
} else {
tmp = m * (m * ((m + -2.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.45d0) then
tmp = (-1.0d0) + (m / v)
else
tmp = m * (m * ((m + (-2.0d0)) / v))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.45) {
tmp = -1.0 + (m / v);
} else {
tmp = m * (m * ((m + -2.0) / v));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.45: tmp = -1.0 + (m / v) else: tmp = m * (m * ((m + -2.0) / v)) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.45) tmp = Float64(-1.0 + Float64(m / v)); else tmp = Float64(m * Float64(m * Float64(Float64(m + -2.0) / v))); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.45) tmp = -1.0 + (m / v); else tmp = m * (m * ((m + -2.0) / v)); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.45], N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision], N[(m * N[(m * N[(N[(m + -2.0), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.45:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \left(m \cdot \frac{m + -2}{v}\right)\\
\end{array}
\end{array}
if m < 2.4500000000000002Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
associate-/r/100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in m around 0 98.1%
sub-neg98.1%
*-commutative98.1%
distribute-rgt-in98.1%
*-lft-identity98.1%
associate-*l/98.2%
*-lft-identity98.2%
metadata-eval98.2%
Simplified98.2%
Taylor expanded in v around 0 98.2%
if 2.4500000000000002 < m Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
associate-/r/100.0%
sub-neg100.0%
distribute-rgt-in51.1%
*-un-lft-identity51.1%
div-inv51.1%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 99.9%
Taylor expanded in m around inf 47.9%
+-commutative47.9%
cube-mult47.9%
unpow247.9%
distribute-rgt-out99.1%
Simplified99.1%
Taylor expanded in m around 0 19.9%
+-commutative19.9%
unpow319.9%
associate-*l/19.9%
associate-*r/19.9%
*-commutative19.9%
unpow219.9%
associate-*r/19.9%
distribute-lft-in99.1%
associate-*l*99.1%
associate-*l/99.1%
associate-*r/99.1%
Simplified99.1%
Final simplification98.6%
(FPCore (m v) :precision binary64 (if (<= m 1.62) (* (- 1.0 m) (+ -1.0 (/ m v))) (* m (* m (/ (+ m -2.0) v)))))
double code(double m, double v) {
double tmp;
if (m <= 1.62) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = m * (m * ((m + -2.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.62d0) then
tmp = (1.0d0 - m) * ((-1.0d0) + (m / v))
else
tmp = m * (m * ((m + (-2.0d0)) / v))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.62) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = m * (m * ((m + -2.0) / v));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.62: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = m * (m * ((m + -2.0) / v)) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.62) tmp = Float64(Float64(1.0 - m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(m * Float64(m * Float64(Float64(m + -2.0) / v))); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.62) tmp = (1.0 - m) * (-1.0 + (m / v)); else tmp = m * (m * ((m + -2.0) / v)); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.62], N[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(m * N[(m * N[(N[(m + -2.0), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.62:\\
\;\;\;\;\left(1 - m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;m \cdot \left(m \cdot \frac{m + -2}{v}\right)\\
\end{array}
\end{array}
if m < 1.6200000000000001Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 98.3%
if 1.6200000000000001 < m Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
associate-/r/100.0%
sub-neg100.0%
distribute-rgt-in51.1%
*-un-lft-identity51.1%
div-inv51.1%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 99.9%
Taylor expanded in m around inf 47.9%
+-commutative47.9%
cube-mult47.9%
unpow247.9%
distribute-rgt-out99.1%
Simplified99.1%
Taylor expanded in m around 0 19.9%
+-commutative19.9%
unpow319.9%
associate-*l/19.9%
associate-*r/19.9%
*-commutative19.9%
unpow219.9%
associate-*r/19.9%
distribute-lft-in99.1%
associate-*l*99.1%
associate-*l/99.1%
associate-*r/99.1%
Simplified99.1%
Final simplification98.7%
(FPCore (m v) :precision binary64 (if (<= m 3.6e-114) -1.0 (if (<= m 0.28) (/ m v) (* m (/ m v)))))
double code(double m, double v) {
double tmp;
if (m <= 3.6e-114) {
tmp = -1.0;
} else if (m <= 0.28) {
tmp = 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 <= 3.6d-114) then
tmp = -1.0d0
else if (m <= 0.28d0) then
tmp = 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 <= 3.6e-114) {
tmp = -1.0;
} else if (m <= 0.28) {
tmp = m / v;
} else {
tmp = m * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 3.6e-114: tmp = -1.0 elif m <= 0.28: tmp = m / v else: tmp = m * (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 3.6e-114) tmp = -1.0; elseif (m <= 0.28) tmp = Float64(m / v); else tmp = Float64(m * Float64(m / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 3.6e-114) tmp = -1.0; elseif (m <= 0.28) tmp = m / v; else tmp = m * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 3.6e-114], -1.0, If[LessEqual[m, 0.28], N[(m / v), $MachinePrecision], N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.6 \cdot 10^{-114}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 0.28:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 3.60000000000000018e-114Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 76.7%
if 3.60000000000000018e-114 < m < 0.28000000000000003Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 94.5%
distribute-lft-in94.5%
sub-neg94.5%
add-sqr-sqrt0.0%
sqrt-unprod94.2%
sqr-neg94.2%
sqrt-unprod94.2%
add-sqr-sqrt94.2%
sub-neg94.2%
add-sqr-sqrt0.0%
sqrt-unprod94.2%
sqr-neg94.2%
sqrt-unprod94.2%
add-sqr-sqrt94.2%
Applied egg-rr94.2%
distribute-lft-in94.2%
+-commutative94.2%
+-commutative94.2%
Simplified94.2%
Taylor expanded in v around 0 83.0%
Taylor expanded in m around 0 83.1%
if 0.28000000000000003 < m Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 0.1%
distribute-lft-in0.1%
sub-neg0.1%
add-sqr-sqrt0.0%
sqrt-unprod81.0%
sqr-neg81.0%
sqrt-unprod81.0%
add-sqr-sqrt81.0%
sub-neg81.0%
add-sqr-sqrt0.0%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod81.0%
add-sqr-sqrt81.0%
Applied egg-rr81.0%
distribute-lft-in81.0%
+-commutative81.0%
+-commutative81.0%
Simplified81.0%
Taylor expanded in m around inf 81.0%
unpow281.0%
associate-*r/81.0%
Simplified81.0%
Final simplification79.8%
(FPCore (m v) :precision binary64 (if (<= m 2.4) (+ -1.0 (/ m v)) (* m (/ (+ m 1.0) v))))
double code(double m, double v) {
double tmp;
if (m <= 2.4) {
tmp = -1.0 + (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 <= 2.4d0) then
tmp = (-1.0d0) + (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 <= 2.4) {
tmp = -1.0 + (m / v);
} else {
tmp = m * ((m + 1.0) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.4: tmp = -1.0 + (m / v) else: tmp = m * ((m + 1.0) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.4) tmp = Float64(-1.0 + 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 <= 2.4) tmp = -1.0 + (m / v); else tmp = m * ((m + 1.0) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.4], N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision], N[(m * N[(N[(m + 1.0), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.4:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m + 1}{v}\\
\end{array}
\end{array}
if m < 2.39999999999999991Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
associate-/r/100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in m around 0 98.1%
sub-neg98.1%
*-commutative98.1%
distribute-rgt-in98.1%
*-lft-identity98.1%
associate-*l/98.2%
*-lft-identity98.2%
metadata-eval98.2%
Simplified98.2%
Taylor expanded in v around 0 98.2%
if 2.39999999999999991 < m Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 0.1%
distribute-lft-in0.1%
sub-neg0.1%
add-sqr-sqrt0.0%
sqrt-unprod81.0%
sqr-neg81.0%
sqrt-unprod81.0%
add-sqr-sqrt81.0%
sub-neg81.0%
add-sqr-sqrt0.0%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod81.0%
add-sqr-sqrt81.0%
Applied egg-rr81.0%
distribute-lft-in81.0%
+-commutative81.0%
+-commutative81.0%
Simplified81.0%
Taylor expanded in v around 0 81.0%
div-inv81.0%
associate-*l*81.0%
add-sqr-sqrt81.0%
sqrt-prod81.0%
sqr-neg81.0%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
sub-neg0.1%
div-inv0.1%
*-un-lft-identity0.1%
*-un-lft-identity0.1%
sub-neg0.1%
add-sqr-sqrt0.0%
sqrt-unprod81.0%
sqr-neg81.0%
sqrt-prod81.0%
add-sqr-sqrt81.0%
+-commutative81.0%
Applied egg-rr81.0%
Final simplification89.8%
(FPCore (m v) :precision binary64 (if (<= m 0.28) (+ -1.0 (/ m v)) (* m (/ m v))))
double code(double m, double v) {
double tmp;
if (m <= 0.28) {
tmp = -1.0 + (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 <= 0.28d0) then
tmp = (-1.0d0) + (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 <= 0.28) {
tmp = -1.0 + (m / v);
} else {
tmp = m * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 0.28: tmp = -1.0 + (m / v) else: tmp = m * (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 0.28) tmp = Float64(-1.0 + Float64(m / v)); else tmp = Float64(m * Float64(m / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 0.28) tmp = -1.0 + (m / v); else tmp = m * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 0.28], N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision], N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.28:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 0.28000000000000003Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
associate-/r/100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in m around 0 98.1%
sub-neg98.1%
*-commutative98.1%
distribute-rgt-in98.1%
*-lft-identity98.1%
associate-*l/98.2%
*-lft-identity98.2%
metadata-eval98.2%
Simplified98.2%
Taylor expanded in v around 0 98.2%
if 0.28000000000000003 < m Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 0.1%
distribute-lft-in0.1%
sub-neg0.1%
add-sqr-sqrt0.0%
sqrt-unprod81.0%
sqr-neg81.0%
sqrt-unprod81.0%
add-sqr-sqrt81.0%
sub-neg81.0%
add-sqr-sqrt0.0%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod81.0%
add-sqr-sqrt81.0%
Applied egg-rr81.0%
distribute-lft-in81.0%
+-commutative81.0%
+-commutative81.0%
Simplified81.0%
Taylor expanded in m around inf 81.0%
unpow281.0%
associate-*r/81.0%
Simplified81.0%
Final simplification89.8%
(FPCore (m v) :precision binary64 (if (<= m 6.5e-115) -1.0 (/ m v)))
double code(double m, double v) {
double tmp;
if (m <= 6.5e-115) {
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 <= 6.5d-115) 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 <= 6.5e-115) {
tmp = -1.0;
} else {
tmp = m / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6.5e-115: tmp = -1.0 else: tmp = m / v return tmp
function code(m, v) tmp = 0.0 if (m <= 6.5e-115) tmp = -1.0; else tmp = Float64(m / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 6.5e-115) tmp = -1.0; else tmp = m / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6.5e-115], -1.0, N[(m / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.5 \cdot 10^{-115}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{v}\\
\end{array}
\end{array}
if m < 6.50000000000000033e-115Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 76.7%
if 6.50000000000000033e-115 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 23.4%
distribute-lft-in23.4%
sub-neg23.4%
add-sqr-sqrt0.0%
sqrt-unprod84.3%
sqr-neg84.3%
sqrt-unprod84.3%
add-sqr-sqrt84.3%
sub-neg84.3%
add-sqr-sqrt0.0%
sqrt-unprod45.7%
sqr-neg45.7%
sqrt-unprod84.3%
add-sqr-sqrt84.3%
Applied egg-rr84.3%
distribute-lft-in84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in v around 0 81.5%
Taylor expanded in m around 0 60.2%
Final simplification66.0%
(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 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in v around inf 30.9%
neg-mul-130.9%
neg-sub030.9%
associate--r-30.9%
metadata-eval30.9%
Simplified30.9%
Final simplification30.9%
(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 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 28.4%
Final simplification28.4%
herbie shell --seed 2023274
(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)))