
(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 (* (+ (/ (- m (* m m)) v) -1.0) (- 1.0 m)))
double code(double m, double v) {
return (((m - (m * 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 - (m * m)) / v) + (-1.0d0)) * (1.0d0 - m)
end function
public static double code(double m, double v) {
return (((m - (m * m)) / v) + -1.0) * (1.0 - m);
}
def code(m, v): return (((m - (m * m)) / v) + -1.0) * (1.0 - m)
function code(m, v) return Float64(Float64(Float64(Float64(m - Float64(m * m)) / v) + -1.0) * Float64(1.0 - m)) end
function tmp = code(m, v) tmp = (((m - (m * m)) / v) + -1.0) * (1.0 - m); end
code[m_, v_] := N[(N[(N[(N[(m - N[(m * m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] + -1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m - m \cdot m}{v} + -1\right) \cdot \left(1 - m\right)
\end{array}
Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (m v)
:precision binary64
(if (<= m 6.4e-224)
-1.0
(if (<= m 3.4e-155)
(/ m v)
(if (<= m 6e-153)
-1.0
(if (<= m 1.8e-127)
(/ m v)
(if (<= m 1.75e-115)
-1.0
(if (<= m 1.18e-12) (/ m v) (* m (/ m v)))))))))
double code(double m, double v) {
double tmp;
if (m <= 6.4e-224) {
tmp = -1.0;
} else if (m <= 3.4e-155) {
tmp = m / v;
} else if (m <= 6e-153) {
tmp = -1.0;
} else if (m <= 1.8e-127) {
tmp = m / v;
} else if (m <= 1.75e-115) {
tmp = -1.0;
} else if (m <= 1.18e-12) {
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 <= 6.4d-224) then
tmp = -1.0d0
else if (m <= 3.4d-155) then
tmp = m / v
else if (m <= 6d-153) then
tmp = -1.0d0
else if (m <= 1.8d-127) then
tmp = m / v
else if (m <= 1.75d-115) then
tmp = -1.0d0
else if (m <= 1.18d-12) 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 <= 6.4e-224) {
tmp = -1.0;
} else if (m <= 3.4e-155) {
tmp = m / v;
} else if (m <= 6e-153) {
tmp = -1.0;
} else if (m <= 1.8e-127) {
tmp = m / v;
} else if (m <= 1.75e-115) {
tmp = -1.0;
} else if (m <= 1.18e-12) {
tmp = m / v;
} else {
tmp = m * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6.4e-224: tmp = -1.0 elif m <= 3.4e-155: tmp = m / v elif m <= 6e-153: tmp = -1.0 elif m <= 1.8e-127: tmp = m / v elif m <= 1.75e-115: tmp = -1.0 elif m <= 1.18e-12: tmp = m / v else: tmp = m * (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 6.4e-224) tmp = -1.0; elseif (m <= 3.4e-155) tmp = Float64(m / v); elseif (m <= 6e-153) tmp = -1.0; elseif (m <= 1.8e-127) tmp = Float64(m / v); elseif (m <= 1.75e-115) tmp = -1.0; elseif (m <= 1.18e-12) 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 <= 6.4e-224) tmp = -1.0; elseif (m <= 3.4e-155) tmp = m / v; elseif (m <= 6e-153) tmp = -1.0; elseif (m <= 1.8e-127) tmp = m / v; elseif (m <= 1.75e-115) tmp = -1.0; elseif (m <= 1.18e-12) tmp = m / v; else tmp = m * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6.4e-224], -1.0, If[LessEqual[m, 3.4e-155], N[(m / v), $MachinePrecision], If[LessEqual[m, 6e-153], -1.0, If[LessEqual[m, 1.8e-127], N[(m / v), $MachinePrecision], If[LessEqual[m, 1.75e-115], -1.0, If[LessEqual[m, 1.18e-12], N[(m / v), $MachinePrecision], N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.4 \cdot 10^{-224}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 3.4 \cdot 10^{-155}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{elif}\;m \leq 6 \cdot 10^{-153}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1.8 \cdot 10^{-127}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{elif}\;m \leq 1.75 \cdot 10^{-115}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1.18 \cdot 10^{-12}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 6.3999999999999997e-224 or 3.4e-155 < m < 6e-153 or 1.8e-127 < m < 1.7500000000000001e-115Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 81.1%
if 6.3999999999999997e-224 < m < 3.4e-155 or 6e-153 < m < 1.8e-127 or 1.7500000000000001e-115 < m < 1.18000000000000002e-12Initial program 100.0%
Taylor expanded in m around 0 99.8%
Taylor expanded in v around 0 74.7%
Taylor expanded in m around 0 74.6%
if 1.18000000000000002e-12 < m Initial program 99.9%
Taylor expanded in m around 0 2.3%
sub-neg2.3%
distribute-rgt-in2.3%
*-un-lft-identity2.3%
sub-neg2.3%
metadata-eval2.3%
add-sqr-sqrt0.0%
sqrt-unprod75.6%
sqr-neg75.6%
sqrt-unprod75.6%
add-sqr-sqrt75.6%
sub-neg75.6%
metadata-eval75.6%
Applied egg-rr75.6%
distribute-rgt1-in75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in v around 0 75.6%
associate-/l*75.6%
+-commutative75.6%
Simplified75.6%
clear-num75.6%
inv-pow75.6%
+-commutative75.6%
Applied egg-rr75.6%
unpow-175.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in m around inf 73.9%
Taylor expanded in v around 0 73.9%
(FPCore (m v)
:precision binary64
(if (<= m 4.3e-224)
-1.0
(if (or (<= m 6.5e-155)
(and (not (<= m 8.2e-153))
(or (<= m 2.1e-127) (not (<= m 7e-115)))))
(/ m v)
-1.0)))
double code(double m, double v) {
double tmp;
if (m <= 4.3e-224) {
tmp = -1.0;
} else if ((m <= 6.5e-155) || (!(m <= 8.2e-153) && ((m <= 2.1e-127) || !(m <= 7e-115)))) {
tmp = m / v;
} 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 <= 4.3d-224) then
tmp = -1.0d0
else if ((m <= 6.5d-155) .or. (.not. (m <= 8.2d-153)) .and. (m <= 2.1d-127) .or. (.not. (m <= 7d-115))) then
tmp = m / v
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 4.3e-224) {
tmp = -1.0;
} else if ((m <= 6.5e-155) || (!(m <= 8.2e-153) && ((m <= 2.1e-127) || !(m <= 7e-115)))) {
tmp = m / v;
} else {
tmp = -1.0;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 4.3e-224: tmp = -1.0 elif (m <= 6.5e-155) or (not (m <= 8.2e-153) and ((m <= 2.1e-127) or not (m <= 7e-115))): tmp = m / v else: tmp = -1.0 return tmp
function code(m, v) tmp = 0.0 if (m <= 4.3e-224) tmp = -1.0; elseif ((m <= 6.5e-155) || (!(m <= 8.2e-153) && ((m <= 2.1e-127) || !(m <= 7e-115)))) tmp = Float64(m / v); else tmp = -1.0; end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 4.3e-224) tmp = -1.0; elseif ((m <= 6.5e-155) || (~((m <= 8.2e-153)) && ((m <= 2.1e-127) || ~((m <= 7e-115))))) tmp = m / v; else tmp = -1.0; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 4.3e-224], -1.0, If[Or[LessEqual[m, 6.5e-155], And[N[Not[LessEqual[m, 8.2e-153]], $MachinePrecision], Or[LessEqual[m, 2.1e-127], N[Not[LessEqual[m, 7e-115]], $MachinePrecision]]]], N[(m / v), $MachinePrecision], -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.3 \cdot 10^{-224}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 6.5 \cdot 10^{-155} \lor \neg \left(m \leq 8.2 \cdot 10^{-153}\right) \land \left(m \leq 2.1 \cdot 10^{-127} \lor \neg \left(m \leq 7 \cdot 10^{-115}\right)\right):\\
\;\;\;\;\frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if m < 4.3e-224 or 6.5e-155 < m < 8.2e-153 or 2.1000000000000001e-127 < m < 7.0000000000000004e-115Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 81.1%
if 4.3e-224 < m < 6.5e-155 or 8.2e-153 < m < 2.1000000000000001e-127 or 7.0000000000000004e-115 < m Initial program 99.9%
Taylor expanded in m around 0 38.4%
Taylor expanded in v around 0 29.1%
Taylor expanded in m around 0 61.4%
Final simplification64.9%
(FPCore (m v) :precision binary64 (if (<= m 4.5e-6) (+ -1.0 (/ (* m (+ 1.0 (* m -2.0))) v)) (* (- 1.0 m) (- -1.0 (* m (/ m v))))))
double code(double m, double v) {
double tmp;
if (m <= 4.5e-6) {
tmp = -1.0 + ((m * (1.0 + (m * -2.0))) / 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 <= 4.5d-6) then
tmp = (-1.0d0) + ((m * (1.0d0 + (m * (-2.0d0)))) / 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 <= 4.5e-6) {
tmp = -1.0 + ((m * (1.0 + (m * -2.0))) / v);
} else {
tmp = (1.0 - m) * (-1.0 - (m * (m / v)));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 4.5e-6: tmp = -1.0 + ((m * (1.0 + (m * -2.0))) / v) else: tmp = (1.0 - m) * (-1.0 - (m * (m / v))) return tmp
function code(m, v) tmp = 0.0 if (m <= 4.5e-6) tmp = Float64(-1.0 + Float64(Float64(m * Float64(1.0 + Float64(m * -2.0))) / 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 <= 4.5e-6) tmp = -1.0 + ((m * (1.0 + (m * -2.0))) / v); else tmp = (1.0 - m) * (-1.0 - (m * (m / v))); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 4.5e-6], N[(-1.0 + N[(N[(m * N[(1.0 + N[(m * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $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 4.5 \cdot 10^{-6}:\\
\;\;\;\;-1 + \frac{m \cdot \left(1 + m \cdot -2\right)}{v}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - m\right) \cdot \left(-1 - m \cdot \frac{m}{v}\right)\\
\end{array}
\end{array}
if m < 4.50000000000000011e-6Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 99.8%
Taylor expanded in v around 0 100.0%
associate-/l*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in v around 0 100.0%
if 4.50000000000000011e-6 < 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.5%
neg-mul-197.5%
distribute-neg-frac297.5%
Simplified97.5%
Final simplification98.7%
(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 99.9%
Final simplification99.9%
(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(m * Float64(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[(m * N[(N[(1.0 - m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - m\right) \cdot \left(m \cdot \frac{1 - m}{v} + -1\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
(FPCore (m v) :precision binary64 (if (<= m 1.25e-58) (+ -1.0 (/ m v)) (/ (* m (+ m 1.0)) v)))
double code(double m, double v) {
double tmp;
if (m <= 1.25e-58) {
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 <= 1.25d-58) 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 <= 1.25e-58) {
tmp = -1.0 + (m / v);
} else {
tmp = (m * (m + 1.0)) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.25e-58: tmp = -1.0 + (m / v) else: tmp = (m * (m + 1.0)) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 1.25e-58) tmp = Float64(-1.0 + Float64(m / v)); else tmp = Float64(Float64(m * Float64(m + 1.0)) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.25e-58) tmp = -1.0 + (m / v); else tmp = (m * (m + 1.0)) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.25e-58], N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m + 1.0), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.25 \cdot 10^{-58}:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;\frac{m \cdot \left(m + 1\right)}{v}\\
\end{array}
\end{array}
if m < 1.24999999999999994e-58Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 99.8%
Taylor expanded in v around 0 100.0%
associate-/l*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 100.0%
if 1.24999999999999994e-58 < m Initial program 99.9%
Taylor expanded in m around 0 14.5%
sub-neg14.5%
distribute-rgt-in14.5%
*-un-lft-identity14.5%
sub-neg14.5%
metadata-eval14.5%
add-sqr-sqrt0.0%
sqrt-unprod78.6%
sqr-neg78.6%
sqrt-unprod78.6%
add-sqr-sqrt78.6%
sub-neg78.6%
metadata-eval78.6%
Applied egg-rr78.6%
distribute-rgt1-in78.6%
+-commutative78.6%
Simplified78.6%
Taylor expanded in v around 0 78.6%
Final simplification87.3%
(FPCore (m v) :precision binary64 (if (<= m 1.25e-58) (+ -1.0 (/ m v)) (/ m (/ v (+ m 1.0)))))
double code(double m, double v) {
double tmp;
if (m <= 1.25e-58) {
tmp = -1.0 + (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 <= 1.25d-58) then
tmp = (-1.0d0) + (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 <= 1.25e-58) {
tmp = -1.0 + (m / v);
} else {
tmp = m / (v / (m + 1.0));
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.25e-58: tmp = -1.0 + (m / v) else: tmp = m / (v / (m + 1.0)) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.25e-58) tmp = Float64(-1.0 + Float64(m / v)); else tmp = Float64(m / Float64(v / Float64(m + 1.0))); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.25e-58) tmp = -1.0 + (m / v); else tmp = m / (v / (m + 1.0)); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.25e-58], N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision], N[(m / N[(v / N[(m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.25 \cdot 10^{-58}:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{\frac{v}{m + 1}}\\
\end{array}
\end{array}
if m < 1.24999999999999994e-58Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 99.8%
Taylor expanded in v around 0 100.0%
associate-/l*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 100.0%
if 1.24999999999999994e-58 < m Initial program 99.9%
Taylor expanded in m around 0 14.5%
sub-neg14.5%
distribute-rgt-in14.5%
*-un-lft-identity14.5%
sub-neg14.5%
metadata-eval14.5%
add-sqr-sqrt0.0%
sqrt-unprod78.6%
sqr-neg78.6%
sqrt-unprod78.6%
add-sqr-sqrt78.6%
sub-neg78.6%
metadata-eval78.6%
Applied egg-rr78.6%
distribute-rgt1-in78.6%
+-commutative78.6%
Simplified78.6%
Taylor expanded in v around 0 78.6%
associate-/l*78.5%
+-commutative78.5%
Simplified78.5%
clear-num78.5%
inv-pow78.5%
+-commutative78.5%
Applied egg-rr78.5%
unpow-178.5%
+-commutative78.5%
Simplified78.5%
un-div-inv78.6%
Applied egg-rr78.6%
Final simplification87.3%
(FPCore (m v) :precision binary64 (if (<= m 4e-63) (+ -1.0 (/ m v)) (* m (/ (+ m 1.0) v))))
double code(double m, double v) {
double tmp;
if (m <= 4e-63) {
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 <= 4d-63) 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 <= 4e-63) {
tmp = -1.0 + (m / v);
} else {
tmp = m * ((m + 1.0) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 4e-63: tmp = -1.0 + (m / v) else: tmp = m * ((m + 1.0) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 4e-63) 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 <= 4e-63) tmp = -1.0 + (m / v); else tmp = m * ((m + 1.0) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 4e-63], 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 4 \cdot 10^{-63}:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m + 1}{v}\\
\end{array}
\end{array}
if m < 4.00000000000000027e-63Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 99.8%
Taylor expanded in v around 0 100.0%
associate-/l*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 100.0%
if 4.00000000000000027e-63 < m Initial program 99.9%
Taylor expanded in m around 0 15.6%
sub-neg15.6%
distribute-rgt-in15.6%
*-un-lft-identity15.6%
sub-neg15.6%
metadata-eval15.6%
add-sqr-sqrt0.0%
sqrt-unprod78.9%
sqr-neg78.9%
sqrt-unprod78.9%
add-sqr-sqrt78.9%
sub-neg78.9%
metadata-eval78.9%
Applied egg-rr78.9%
distribute-rgt1-in78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in v around 0 78.2%
associate-/l*78.2%
+-commutative78.2%
Simplified78.2%
Final simplification86.9%
(FPCore (m v) :precision binary64 (if (<= m 1.18e-12) (+ -1.0 (/ m v)) (* m (/ m v))))
double code(double m, double v) {
double tmp;
if (m <= 1.18e-12) {
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 <= 1.18d-12) 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 <= 1.18e-12) {
tmp = -1.0 + (m / v);
} else {
tmp = m * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.18e-12: tmp = -1.0 + (m / v) else: tmp = m * (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.18e-12) 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 <= 1.18e-12) tmp = -1.0 + (m / v); else tmp = m * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.18e-12], 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 1.18 \cdot 10^{-12}:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 1.18000000000000002e-12Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 99.8%
Taylor expanded in v around 0 100.0%
associate-/l*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 99.9%
if 1.18000000000000002e-12 < m Initial program 99.9%
Taylor expanded in m around 0 2.3%
sub-neg2.3%
distribute-rgt-in2.3%
*-un-lft-identity2.3%
sub-neg2.3%
metadata-eval2.3%
add-sqr-sqrt0.0%
sqrt-unprod75.6%
sqr-neg75.6%
sqrt-unprod75.6%
add-sqr-sqrt75.6%
sub-neg75.6%
metadata-eval75.6%
Applied egg-rr75.6%
distribute-rgt1-in75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in v around 0 75.6%
associate-/l*75.6%
+-commutative75.6%
Simplified75.6%
clear-num75.6%
inv-pow75.6%
+-commutative75.6%
Applied egg-rr75.6%
unpow-175.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in m around inf 73.9%
Taylor expanded in v around 0 73.9%
Final simplification86.4%
(FPCore (m v) :precision binary64 (* (+ m 1.0) (+ -1.0 (/ m v))))
double code(double m, double v) {
return (m + 1.0) * (-1.0 + (m / v));
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (m + 1.0d0) * ((-1.0d0) + (m / v))
end function
public static double code(double m, double v) {
return (m + 1.0) * (-1.0 + (m / v));
}
def code(m, v): return (m + 1.0) * (-1.0 + (m / v))
function code(m, v) return Float64(Float64(m + 1.0) * Float64(-1.0 + Float64(m / v))) end
function tmp = code(m, v) tmp = (m + 1.0) * (-1.0 + (m / v)); end
code[m_, v_] := N[(N[(m + 1.0), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(m + 1\right) \cdot \left(-1 + \frac{m}{v}\right)
\end{array}
Initial program 99.9%
Taylor expanded in m around 0 49.2%
sub-neg49.2%
distribute-rgt-in49.2%
*-un-lft-identity49.2%
sub-neg49.2%
metadata-eval49.2%
add-sqr-sqrt0.0%
sqrt-unprod87.3%
sqr-neg87.3%
sqrt-unprod87.3%
add-sqr-sqrt87.3%
sub-neg87.3%
metadata-eval87.3%
Applied egg-rr87.3%
distribute-rgt1-in87.3%
+-commutative87.3%
Simplified87.3%
(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 24.9%
neg-mul-124.9%
neg-sub024.9%
associate--r-24.9%
metadata-eval24.9%
Simplified24.9%
Final simplification24.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 99.9%
*-commutative99.9%
sub-neg99.9%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in m around 0 22.4%
herbie shell --seed 2024107
(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)))