
(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 3.3e-180) -1.0 (if (<= m 1.0) (+ m (/ m v)) (* m (/ (+ m -1.0) v)))))
double code(double m, double v) {
double tmp;
if (m <= 3.3e-180) {
tmp = -1.0;
} else if (m <= 1.0) {
tmp = 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 <= 3.3d-180) then
tmp = -1.0d0
else if (m <= 1.0d0) then
tmp = 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 <= 3.3e-180) {
tmp = -1.0;
} else if (m <= 1.0) {
tmp = m + (m / v);
} else {
tmp = m * ((m + -1.0) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 3.3e-180: tmp = -1.0 elif m <= 1.0: tmp = m + (m / v) else: tmp = m * ((m + -1.0) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 3.3e-180) tmp = -1.0; elseif (m <= 1.0) tmp = 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 <= 3.3e-180) tmp = -1.0; elseif (m <= 1.0) tmp = m + (m / v); else tmp = m * ((m + -1.0) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 3.3e-180], -1.0, If[LessEqual[m, 1.0], N[(m + 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 3.3 \cdot 10^{-180}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1:\\
\;\;\;\;m + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m + -1}{v}\\
\end{array}
\end{array}
if m < 3.29999999999999998e-180Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 84.2%
if 3.29999999999999998e-180 < m < 1Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in m around 0 95.3%
Taylor expanded in m around inf 64.3%
+-commutative64.3%
distribute-lft-in64.3%
div-inv64.7%
*-rgt-identity64.7%
Applied egg-rr64.7%
if 1 < m Initial program 99.9%
Taylor expanded in m around 0 0.1%
*-commutative0.1%
sub-neg0.1%
metadata-eval0.1%
distribute-lft-in0.1%
Applied egg-rr72.9%
associate-*r/72.9%
associate-*l/72.9%
*-commutative72.9%
distribute-lft-in72.9%
+-commutative72.9%
Simplified72.9%
Taylor expanded in v around 0 72.9%
sub-neg72.9%
metadata-eval72.9%
associate-/l*72.9%
Simplified72.9%
Final simplification72.8%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ -1.0 (/ m v))) (* (- 1.0 m) (- -1.0 (* m (/ m v))))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = (1.0 - m) * (-1.0 - (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 = (1.0d0 - m) * ((-1.0d0) + (m / v))
else
tmp = (1.0d0 - m) * ((-1.0d0) - (m * (m / 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 = (1.0 - m) * (-1.0 - (m * (m / v)));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = (1.0 - m) * (-1.0 - (m * (m / 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(Float64(1.0 - m) * Float64(-1.0 - Float64(m * Float64(m / 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 = (1.0 - m) * (-1.0 - (m * (m / 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[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 - N[(m * N[(m / v), $MachinePrecision]), $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}:\\
\;\;\;\;\left(1 - m\right) \cdot \left(-1 - m \cdot \frac{m}{v}\right)\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
Taylor expanded in m around 0 97.5%
if 1 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around inf 97.8%
neg-mul-197.8%
distribute-neg-frac297.8%
Simplified97.8%
Final simplification97.7%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ -1.0 (/ m v))) (* 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 + -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 + (-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 + -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 + -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(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 + -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[(N[(m + -1.0), $MachinePrecision] / v), $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 \frac{m + -1}{v}\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
Taylor expanded in m around 0 97.5%
if 1 < m Initial program 99.9%
Taylor expanded in m around 0 0.1%
*-commutative0.1%
sub-neg0.1%
metadata-eval0.1%
distribute-lft-in0.1%
Applied egg-rr72.9%
associate-*r/72.9%
associate-*l/72.9%
*-commutative72.9%
distribute-lft-in72.9%
+-commutative72.9%
Simplified72.9%
Taylor expanded in v around 0 72.9%
sub-neg72.9%
metadata-eval72.9%
associate-/l*72.9%
Simplified72.9%
Final simplification84.9%
(FPCore (m v) :precision binary64 (if (<= m 0.32) (* (- 1.0 m) (+ -1.0 (/ m v))) (+ -1.0 (* m (+ 1.0 (/ m v))))))
double code(double m, double v) {
double tmp;
if (m <= 0.32) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = -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 <= 0.32d0) then
tmp = (1.0d0 - m) * ((-1.0d0) + (m / v))
else
tmp = (-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 <= 0.32) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = -1.0 + (m * (1.0 + (m / v)));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 0.32: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = -1.0 + (m * (1.0 + (m / v))) return tmp
function code(m, v) tmp = 0.0 if (m <= 0.32) tmp = Float64(Float64(1.0 - m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(-1.0 + Float64(m * Float64(1.0 + Float64(m / v)))); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 0.32) tmp = (1.0 - m) * (-1.0 + (m / v)); else tmp = -1.0 + (m * (1.0 + (m / v))); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 0.32], N[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(m * N[(1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.32:\\
\;\;\;\;\left(1 - m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + m \cdot \left(1 + \frac{m}{v}\right)\\
\end{array}
\end{array}
if m < 0.320000000000000007Initial program 99.9%
Taylor expanded in m around 0 98.1%
if 0.320000000000000007 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around inf 97.1%
neg-mul-197.1%
distribute-neg-frac297.1%
Simplified97.1%
distribute-frac-neg297.1%
distribute-frac-neg97.1%
associate-*r/97.1%
Applied egg-rr97.1%
associate-/l*97.1%
add-sqr-sqrt0.0%
sqrt-unprod0.2%
sqr-neg0.2%
sqrt-unprod0.2%
add-sqr-sqrt0.2%
Applied egg-rr0.2%
Taylor expanded in m around 0 72.6%
Final simplification84.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 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%
sub-neg100.0%
associate-/l*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in m around 0 97.2%
+-commutative43.6%
distribute-lft-in43.6%
div-inv43.8%
*-rgt-identity43.8%
Applied egg-rr97.4%
if 1 < m Initial program 99.9%
Taylor expanded in m around 0 0.1%
*-commutative0.1%
sub-neg0.1%
metadata-eval0.1%
distribute-lft-in0.1%
Applied egg-rr72.9%
associate-*r/72.9%
associate-*l/72.9%
*-commutative72.9%
distribute-lft-in72.9%
+-commutative72.9%
Simplified72.9%
Taylor expanded in v around 0 72.9%
sub-neg72.9%
metadata-eval72.9%
associate-/l*72.9%
Simplified72.9%
Final simplification84.9%
(FPCore (m v) :precision binary64 (+ (* m (/ (+ 1.0 m) v)) (+ m -1.0)))
double code(double m, double v) {
return (m * ((1.0 + m) / v)) + (m + -1.0);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (m * ((1.0d0 + m) / v)) + (m + (-1.0d0))
end function
public static double code(double m, double v) {
return (m * ((1.0 + m) / v)) + (m + -1.0);
}
def code(m, v): return (m * ((1.0 + m) / v)) + (m + -1.0)
function code(m, v) return Float64(Float64(m * Float64(Float64(1.0 + m) / v)) + Float64(m + -1.0)) end
function tmp = code(m, v) tmp = (m * ((1.0 + m) / v)) + (m + -1.0); end
code[m_, v_] := N[(N[(m * N[(N[(1.0 + m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision] + N[(m + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
m \cdot \frac{1 + m}{v} + \left(m + -1\right)
\end{array}
Initial program 99.9%
Taylor expanded in m around 0 47.6%
*-commutative47.6%
sub-neg47.6%
metadata-eval47.6%
distribute-rgt-in47.6%
associate-/r/47.6%
div-inv47.5%
clear-num47.5%
add-sqr-sqrt47.5%
sqrt-unprod84.8%
sqr-neg84.8%
sqrt-unprod37.3%
add-sqr-sqrt60.8%
neg-sub060.8%
associate--r-60.8%
metadata-eval60.8%
neg-mul-160.8%
neg-sub060.8%
associate--r-60.8%
metadata-eval60.8%
Applied egg-rr60.8%
add-exp-log37.3%
log-div37.3%
Applied egg-rr82.5%
exp-diff82.5%
log1p-undefine82.5%
rem-exp-log82.5%
rem-exp-log84.7%
Simplified84.7%
Final simplification84.7%
(FPCore (m v) :precision binary64 (if (<= m 7.5e-183) -1.0 (+ m (/ m v))))
double code(double m, double v) {
double tmp;
if (m <= 7.5e-183) {
tmp = -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 <= 7.5d-183) then
tmp = -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 <= 7.5e-183) {
tmp = -1.0;
} else {
tmp = m + (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 7.5e-183: tmp = -1.0 else: tmp = m + (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 7.5e-183) tmp = -1.0; else tmp = Float64(m + Float64(m / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 7.5e-183) tmp = -1.0; else tmp = m + (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 7.5e-183], -1.0, N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7.5 \cdot 10^{-183}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;m + \frac{m}{v}\\
\end{array}
\end{array}
if m < 7.5000000000000004e-183Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 84.2%
if 7.5000000000000004e-183 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 67.5%
Taylor expanded in m around inf 56.4%
+-commutative56.4%
distribute-lft-in56.4%
div-inv56.5%
*-rgt-identity56.5%
Applied egg-rr56.5%
Final simplification62.0%
(FPCore (m v) :precision binary64 (if (<= m 6.2e-24) -1.0 1.0))
double code(double m, double v) {
double tmp;
if (m <= 6.2e-24) {
tmp = -1.0;
} else {
tmp = 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 <= 6.2d-24) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 6.2e-24) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6.2e-24: tmp = -1.0 else: tmp = 1.0 return tmp
function code(m, v) tmp = 0.0 if (m <= 6.2e-24) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 6.2e-24) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6.2e-24], -1.0, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.2 \cdot 10^{-24}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if m < 6.2000000000000001e-24Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in m around 0 53.3%
if 6.2000000000000001e-24 < m Initial program 99.9%
Taylor expanded in m around 0 6.3%
*-commutative6.3%
sub-neg6.3%
metadata-eval6.3%
distribute-lft-in6.3%
Applied egg-rr66.9%
associate-*r/66.9%
associate-*l/66.9%
*-commutative66.9%
distribute-lft-in66.9%
+-commutative66.9%
Simplified66.9%
Taylor expanded in m around 0 3.5%
Final simplification25.5%
(FPCore (m v) :precision binary64 (if (<= m 4.8e-24) -1.0 m))
double code(double m, double v) {
double tmp;
if (m <= 4.8e-24) {
tmp = -1.0;
} 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 (m <= 4.8d-24) then
tmp = -1.0d0
else
tmp = m
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 4.8e-24) {
tmp = -1.0;
} else {
tmp = m;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 4.8e-24: tmp = -1.0 else: tmp = m return tmp
function code(m, v) tmp = 0.0 if (m <= 4.8e-24) tmp = -1.0; else tmp = m; end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 4.8e-24) tmp = -1.0; else tmp = m; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 4.8e-24], -1.0, m]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.8 \cdot 10^{-24}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;m\\
\end{array}
\end{array}
if m < 4.7999999999999996e-24Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in m around 0 53.3%
if 4.7999999999999996e-24 < 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 53.7%
Taylor expanded in m around inf 53.1%
Taylor expanded in v around inf 5.5%
Final simplification26.6%
(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 26.4%
neg-mul-126.4%
sub-neg26.4%
+-commutative26.4%
distribute-neg-in26.4%
remove-double-neg26.4%
metadata-eval26.4%
Simplified26.4%
Final simplification26.4%
(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 23.9%
Final simplification23.9%
herbie shell --seed 2024055
(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)))