
(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 11 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*100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (m v) :precision binary64 (* (- 1.0 m) (+ -1.0 (* (- 1.0 m) (/ m v)))))
double code(double m, double v) {
return (1.0 - m) * (-1.0 + ((1.0 - m) * (m / v)));
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (1.0d0 - m) * ((-1.0d0) + ((1.0d0 - m) * (m / v)))
end function
public static double code(double m, double v) {
return (1.0 - m) * (-1.0 + ((1.0 - m) * (m / v)));
}
def code(m, v): return (1.0 - m) * (-1.0 + ((1.0 - m) * (m / v)))
function code(m, v) return Float64(Float64(1.0 - m) * Float64(-1.0 + Float64(Float64(1.0 - m) * Float64(m / v)))) end
function tmp = code(m, v) tmp = (1.0 - m) * (-1.0 + ((1.0 - m) * (m / v))); end
code[m_, v_] := N[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 + N[(N[(1.0 - m), $MachinePrecision] * N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - m\right) \cdot \left(-1 + \left(1 - m\right) \cdot \frac{m}{v}\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (m v) :precision binary64 (if (<= m 0.32) (* (- 1.0 m) (+ -1.0 (/ m v))) (* m (/ m v))))
double code(double m, double v) {
double tmp;
if (m <= 0.32) {
tmp = (1.0 - m) * (-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.32d0) then
tmp = (1.0d0 - m) * ((-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.32) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = m * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 0.32: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = m * (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(m * 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 = m * (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[(m * N[(m / v), $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}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 0.320000000000000007Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 99.3%
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 0 0.2%
+-commutative0.2%
distribute-rgt-in0.2%
neg-mul-10.2%
neg-sub00.2%
metadata-eval0.2%
associate--r-0.2%
metadata-eval0.2%
metadata-eval0.2%
add-sqr-sqrt0.2%
sqrt-unprod79.2%
sqr-neg79.2%
sqrt-unprod79.1%
add-sqr-sqrt79.1%
neg-sub079.1%
metadata-eval79.1%
associate--r-79.1%
metadata-eval79.1%
metadata-eval79.1%
Applied egg-rr79.1%
distribute-rgt1-in79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in m around inf 79.3%
unpow279.3%
associate-*r/79.3%
Simplified79.3%
Final simplification89.7%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ -1.0 (/ m v))) (* (/ m (/ v m)) (+ 1.0 m))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = (m / (v / m)) * (1.0 + m);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 1.0d0) then
tmp = (1.0d0 - m) * ((-1.0d0) + (m / v))
else
tmp = (m / (v / m)) * (1.0d0 + m)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = (m / (v / m)) * (1.0 + m);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = (m / (v / m)) * (1.0 + m) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.0) tmp = Float64(Float64(1.0 - m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(Float64(m / Float64(v / m)) * Float64(1.0 + m)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.0) tmp = (1.0 - m) * (-1.0 + (m / v)); else tmp = (m / (v / m)) * (1.0 + m); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.0], N[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m / N[(v / m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;\left(1 - m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{\frac{v}{m}} \cdot \left(1 + m\right)\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 98.7%
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 98.3%
associate-*r/98.3%
neg-mul-198.3%
Simplified98.3%
Taylor expanded in v around 0 98.3%
mul-1-neg98.3%
associate-/l*98.3%
distribute-neg-frac98.3%
unpow298.3%
distribute-rgt-neg-in98.3%
Simplified98.3%
associate-/r/98.2%
*-commutative98.2%
associate-/l*98.3%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
sub-neg0.0%
add-sqr-sqrt0.0%
sqrt-unprod98.2%
sqr-neg98.2%
sqrt-unprod98.2%
add-sqr-sqrt98.2%
+-commutative98.2%
Applied egg-rr98.2%
Final simplification98.5%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ -1.0 (/ m v))) (* (/ (+ m -1.0) v) (* m m))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = ((m + -1.0) / v) * (m * 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 + (-1.0d0)) / v) * (m * 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 + -1.0) / v) * (m * m);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = ((m + -1.0) / v) * (m * 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(Float64(m + -1.0) / v) * Float64(m * 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 + -1.0) / v) * (m * 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[(N[(m + -1.0), $MachinePrecision] / v), $MachinePrecision] * N[(m * 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 + -1}{v} \cdot \left(m \cdot m\right)\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 98.7%
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 98.3%
associate-*r/98.3%
neg-mul-198.3%
Simplified98.3%
Taylor expanded in v around 0 98.3%
mul-1-neg98.3%
associate-/l*98.3%
distribute-neg-frac98.3%
unpow298.3%
distribute-rgt-neg-in98.3%
Simplified98.3%
Taylor expanded in m around 0 20.6%
+-commutative20.6%
mul-1-neg20.6%
unpow220.6%
associate-/l*20.6%
unsub-neg20.6%
cube-mult20.6%
associate-/l*20.6%
associate-/l*20.6%
*-lft-identity20.6%
associate-*l/20.6%
associate-/r/20.6%
div-sub98.3%
associate-/r/98.3%
sub-neg98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification98.5%
(FPCore (m v) :precision binary64 (if (<= m 2.4e-126) -1.0 (if (<= m 0.27) (/ m v) (* m (/ m v)))))
double code(double m, double v) {
double tmp;
if (m <= 2.4e-126) {
tmp = -1.0;
} else if (m <= 0.27) {
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 <= 2.4d-126) then
tmp = -1.0d0
else if (m <= 0.27d0) 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 <= 2.4e-126) {
tmp = -1.0;
} else if (m <= 0.27) {
tmp = m / v;
} else {
tmp = m * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.4e-126: tmp = -1.0 elif m <= 0.27: tmp = m / v else: tmp = m * (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.4e-126) tmp = -1.0; elseif (m <= 0.27) 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 <= 2.4e-126) tmp = -1.0; elseif (m <= 0.27) tmp = m / v; else tmp = m * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.4e-126], -1.0, If[LessEqual[m, 0.27], N[(m / v), $MachinePrecision], N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.4 \cdot 10^{-126}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 0.27:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 2.40000000000000007e-126Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 74.5%
if 2.40000000000000007e-126 < m < 0.27000000000000002Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 98.1%
Taylor expanded in v around 0 78.5%
*-commutative78.5%
sub-neg78.5%
metadata-eval78.5%
distribute-neg-in78.5%
neg-mul-178.5%
*-commutative78.5%
associate-*r/78.5%
*-commutative78.5%
associate-*r*78.5%
mul-1-neg78.5%
*-commutative78.5%
associate-*l/78.5%
associate-*r/78.2%
distribute-rgt-neg-in78.2%
distribute-neg-frac78.2%
distribute-neg-in78.2%
metadata-eval78.2%
sub-neg78.2%
Simplified78.2%
Taylor expanded in m around 0 78.5%
if 0.27000000000000002 < 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 0.2%
+-commutative0.2%
distribute-rgt-in0.2%
neg-mul-10.2%
neg-sub00.2%
metadata-eval0.2%
associate--r-0.2%
metadata-eval0.2%
metadata-eval0.2%
add-sqr-sqrt0.2%
sqrt-unprod79.2%
sqr-neg79.2%
sqrt-unprod79.1%
add-sqr-sqrt79.1%
neg-sub079.1%
metadata-eval79.1%
associate--r-79.1%
metadata-eval79.1%
metadata-eval79.1%
Applied egg-rr79.1%
distribute-rgt1-in79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in m around inf 79.3%
unpow279.3%
associate-*r/79.3%
Simplified79.3%
Final simplification77.5%
(FPCore (m v) :precision binary64 (if (<= m 0.27) (+ -1.0 (/ m v)) (* m (/ m v))))
double code(double m, double v) {
double tmp;
if (m <= 0.27) {
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.27d0) 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.27) {
tmp = -1.0 + (m / v);
} else {
tmp = m * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 0.27: tmp = -1.0 + (m / v) else: tmp = m * (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 0.27) 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.27) tmp = -1.0 + (m / v); else tmp = m * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 0.27], 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.27:\\
\;\;\;\;-1 + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 0.27000000000000002Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
distribute-lft-in100.0%
associate-/r/100.0%
*-commutative100.0%
neg-mul-1100.0%
clear-num99.8%
associate-/r/99.8%
clear-num99.8%
*-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in m around 0 99.0%
sub-neg99.0%
*-commutative99.0%
distribute-rgt-in99.0%
*-lft-identity99.0%
associate-*l/99.3%
*-lft-identity99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in v around 0 99.3%
if 0.27000000000000002 < 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 0.2%
+-commutative0.2%
distribute-rgt-in0.2%
neg-mul-10.2%
neg-sub00.2%
metadata-eval0.2%
associate--r-0.2%
metadata-eval0.2%
metadata-eval0.2%
add-sqr-sqrt0.2%
sqrt-unprod79.2%
sqr-neg79.2%
sqrt-unprod79.1%
add-sqr-sqrt79.1%
neg-sub079.1%
metadata-eval79.1%
associate--r-79.1%
metadata-eval79.1%
metadata-eval79.1%
Applied egg-rr79.1%
distribute-rgt1-in79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in m around inf 79.3%
unpow279.3%
associate-*r/79.3%
Simplified79.3%
Final simplification89.7%
(FPCore (m v) :precision binary64 (if (<= m 2.35e-126) -1.0 (/ m v)))
double code(double m, double v) {
double tmp;
if (m <= 2.35e-126) {
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 <= 2.35d-126) 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 <= 2.35e-126) {
tmp = -1.0;
} else {
tmp = m / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.35e-126: tmp = -1.0 else: tmp = m / v return tmp
function code(m, v) tmp = 0.0 if (m <= 2.35e-126) tmp = -1.0; else tmp = Float64(m / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.35e-126) tmp = -1.0; else tmp = m / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.35e-126], -1.0, N[(m / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.35 \cdot 10^{-126}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{v}\\
\end{array}
\end{array}
if m < 2.35000000000000009e-126Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 74.5%
if 2.35000000000000009e-126 < 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 28.7%
Taylor expanded in v around 0 23.0%
*-commutative23.0%
sub-neg23.0%
metadata-eval23.0%
distribute-neg-in23.0%
neg-mul-123.0%
*-commutative23.0%
associate-*r/23.0%
*-commutative23.0%
associate-*r*23.0%
mul-1-neg23.0%
*-commutative23.0%
associate-*l/23.0%
associate-*r/22.9%
distribute-rgt-neg-in22.9%
distribute-neg-frac22.9%
distribute-neg-in22.9%
metadata-eval22.9%
sub-neg22.9%
Simplified22.9%
Taylor expanded in m around 0 63.6%
Final simplification67.2%
(FPCore (m v) :precision binary64 (if (<= m 2.4e-56) -1.0 1.0))
double code(double m, double v) {
double tmp;
if (m <= 2.4e-56) {
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 <= 2.4d-56) 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 <= 2.4e-56) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.4e-56: tmp = -1.0 else: tmp = 1.0 return tmp
function code(m, v) tmp = 0.0 if (m <= 2.4e-56) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.4e-56) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.4e-56], -1.0, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.4 \cdot 10^{-56}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if m < 2.40000000000000001e-56Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 61.2%
if 2.40000000000000001e-56 < 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 83.3%
associate-*r/83.3%
neg-mul-183.3%
Simplified83.3%
distribute-lft-in83.3%
clear-num83.3%
un-div-inv83.3%
add-sqr-sqrt0.1%
sqrt-unprod0.2%
sqr-neg0.2%
sqrt-unprod0.0%
add-sqr-sqrt1.3%
neg-sub01.3%
metadata-eval1.3%
associate--r-1.3%
metadata-eval1.3%
metadata-eval1.3%
add-sqr-sqrt0.0%
sqrt-unprod81.6%
sqr-neg81.6%
sqrt-unprod83.3%
add-sqr-sqrt83.3%
Applied egg-rr83.5%
Taylor expanded in m around 0 3.6%
Final simplification29.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 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in v around inf 29.7%
neg-mul-129.7%
neg-sub029.7%
associate--r-29.7%
metadata-eval29.7%
Simplified29.7%
Final simplification29.7%
(FPCore (m v) :precision binary64 -1.0)
double code(double m, double v) {
return -1.0;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = -1.0d0
end function
public static double code(double m, double v) {
return -1.0;
}
def code(m, v): return -1.0
function code(m, v) return -1.0 end
function tmp = code(m, v) tmp = -1.0; end
code[m_, v_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 27.4%
Final simplification27.4%
herbie shell --seed 2023222
(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)))