
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) (- 1.0 m)))
double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (((m * (1.0d0 - m)) / v) - 1.0d0) * (1.0d0 - m)
end function
public static double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
def code(m, v): return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m)
function code(m, v) return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * Float64(1.0 - m)) end
function tmp = code(m, v) tmp = (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m); end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) (- 1.0 m)))
double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (((m * (1.0d0 - m)) / v) - 1.0d0) * (1.0d0 - m)
end function
public static double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
def code(m, v): return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m)
function code(m, v) return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * Float64(1.0 - m)) end
function tmp = code(m, v) tmp = (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m); end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)
\end{array}
(FPCore (m v) :precision binary64 (* (- 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
(if (<= m 1.25e-239)
-1.0
(if (<= m 6.8e-217)
(/ m v)
(if (<= m 9.5e-209) -1.0 (if (<= m 0.27) (/ m v) (* m (/ m v)))))))
double code(double m, double v) {
double tmp;
if (m <= 1.25e-239) {
tmp = -1.0;
} else if (m <= 6.8e-217) {
tmp = m / v;
} else if (m <= 9.5e-209) {
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 <= 1.25d-239) then
tmp = -1.0d0
else if (m <= 6.8d-217) then
tmp = m / v
else if (m <= 9.5d-209) 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 <= 1.25e-239) {
tmp = -1.0;
} else if (m <= 6.8e-217) {
tmp = m / v;
} else if (m <= 9.5e-209) {
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 <= 1.25e-239: tmp = -1.0 elif m <= 6.8e-217: tmp = m / v elif m <= 9.5e-209: 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 <= 1.25e-239) tmp = -1.0; elseif (m <= 6.8e-217) tmp = Float64(m / v); elseif (m <= 9.5e-209) 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 <= 1.25e-239) tmp = -1.0; elseif (m <= 6.8e-217) tmp = m / v; elseif (m <= 9.5e-209) 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, 1.25e-239], -1.0, If[LessEqual[m, 6.8e-217], N[(m / v), $MachinePrecision], If[LessEqual[m, 9.5e-209], -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 1.25 \cdot 10^{-239}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 6.8 \cdot 10^{-217}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{elif}\;m \leq 9.5 \cdot 10^{-209}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 0.27:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 1.25e-239 or 6.80000000000000032e-217 < m < 9.50000000000000028e-209Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 89.0%
if 1.25e-239 < m < 6.80000000000000032e-217 or 9.50000000000000028e-209 < m < 0.27000000000000002Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in v around 0 69.4%
Taylor expanded in m around 0 68.9%
if 0.27000000000000002 < 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%
remove-double-div0.1%
times-frac0.1%
*-un-lft-identity0.1%
associate-/l/0.1%
associate-/r/0.1%
/-rgt-identity0.1%
sub-neg0.1%
add-sqr-sqrt0.0%
sqrt-unprod77.2%
sqr-neg77.2%
sqrt-unprod77.2%
add-sqr-sqrt77.2%
sub-neg77.2%
add-sqr-sqrt0.0%
sqrt-unprod29.2%
sqr-neg29.2%
sqrt-unprod77.2%
add-sqr-sqrt77.2%
Applied egg-rr77.2%
*-commutative77.2%
distribute-rgt-in77.2%
+-commutative77.2%
Simplified77.2%
Taylor expanded in m around inf 77.2%
unpow277.2%
associate-*r/77.2%
Simplified77.2%
Final simplification75.4%
(FPCore (m v) :precision binary64 (if (<= m 4.2e-239) -1.0 (if (<= m 6.2e-217) (/ m v) (if (<= m 5e-209) -1.0 (* (/ m v) (+ m 1.0))))))
double code(double m, double v) {
double tmp;
if (m <= 4.2e-239) {
tmp = -1.0;
} else if (m <= 6.2e-217) {
tmp = m / v;
} else if (m <= 5e-209) {
tmp = -1.0;
} 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 <= 4.2d-239) then
tmp = -1.0d0
else if (m <= 6.2d-217) then
tmp = m / v
else if (m <= 5d-209) then
tmp = -1.0d0
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 <= 4.2e-239) {
tmp = -1.0;
} else if (m <= 6.2e-217) {
tmp = m / v;
} else if (m <= 5e-209) {
tmp = -1.0;
} else {
tmp = (m / v) * (m + 1.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 4.2e-239: tmp = -1.0 elif m <= 6.2e-217: tmp = m / v elif m <= 5e-209: tmp = -1.0 else: tmp = (m / v) * (m + 1.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 4.2e-239) tmp = -1.0; elseif (m <= 6.2e-217) tmp = Float64(m / v); elseif (m <= 5e-209) tmp = -1.0; else tmp = Float64(Float64(m / v) * Float64(m + 1.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 4.2e-239) tmp = -1.0; elseif (m <= 6.2e-217) tmp = m / v; elseif (m <= 5e-209) tmp = -1.0; else tmp = (m / v) * (m + 1.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 4.2e-239], -1.0, If[LessEqual[m, 6.2e-217], N[(m / v), $MachinePrecision], If[LessEqual[m, 5e-209], -1.0, N[(N[(m / v), $MachinePrecision] * N[(m + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.2 \cdot 10^{-239}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 6.2 \cdot 10^{-217}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{elif}\;m \leq 5 \cdot 10^{-209}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{v} \cdot \left(m + 1\right)\\
\end{array}
\end{array}
if m < 4.2000000000000004e-239 or 6.1999999999999997e-217 < m < 5.0000000000000005e-209Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 89.0%
if 4.2000000000000004e-239 < m < 6.1999999999999997e-217Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in v around 0 75.3%
Taylor expanded in m around 0 75.3%
if 5.0000000000000005e-209 < m Initial program 99.9%
Taylor expanded in m around 0 39.8%
*-commutative39.8%
sub-neg39.8%
metadata-eval39.8%
distribute-lft-in39.8%
remove-double-div39.8%
times-frac39.8%
*-un-lft-identity39.8%
associate-/l/39.8%
associate-/r/39.8%
/-rgt-identity39.8%
sub-neg39.8%
add-sqr-sqrt0.0%
sqrt-unprod86.0%
sqr-neg86.0%
sqrt-unprod86.0%
add-sqr-sqrt86.0%
sub-neg86.0%
add-sqr-sqrt0.0%
sqrt-unprod57.2%
sqr-neg57.2%
sqrt-unprod86.0%
add-sqr-sqrt86.0%
Applied egg-rr86.0%
*-commutative86.0%
distribute-rgt-in86.0%
+-commutative86.0%
Simplified86.0%
Taylor expanded in v around 0 73.6%
+-commutative73.6%
associate-*l/73.6%
+-commutative73.6%
Simplified73.6%
Final simplification75.4%
(FPCore (m v) :precision binary64 (if (<= m 1e-27) (+ -1.0 (+ m (/ m v))) (/ (* m (+ 1.0 (* m (+ m -2.0)))) v)))
double code(double m, double v) {
double tmp;
if (m <= 1e-27) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m * (1.0 + (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 <= 1d-27) then
tmp = (-1.0d0) + (m + (m / v))
else
tmp = (m * (1.0d0 + (m * (m + (-2.0d0))))) / v
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1e-27) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m * (1.0 + (m * (m + -2.0)))) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1e-27: tmp = -1.0 + (m + (m / v)) else: tmp = (m * (1.0 + (m * (m + -2.0)))) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 1e-27) tmp = Float64(-1.0 + Float64(m + Float64(m / v))); else tmp = Float64(Float64(m * Float64(1.0 + Float64(m * Float64(m + -2.0)))) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1e-27) tmp = -1.0 + (m + (m / v)); else tmp = (m * (1.0 + (m * (m + -2.0)))) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1e-27], N[(-1.0 + N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(1.0 + N[(m * N[(m + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 10^{-27}:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m \cdot \left(1 + m \cdot \left(m + -2\right)\right)}{v}\\
\end{array}
\end{array}
if m < 1e-27Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-in99.7%
*-lft-identity99.7%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
if 1e-27 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.6%
Taylor expanded in m around 0 99.6%
unpow299.6%
distribute-rgt-out99.6%
Simplified99.6%
Final simplification99.8%
(FPCore (m v) :precision binary64 (* (- 1.0 m) (+ (* (- 1.0 m) (/ m v)) -1.0)))
double code(double m, double v) {
return (1.0 - m) * (((1.0 - m) * (m / v)) + -1.0);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (1.0d0 - m) * (((1.0d0 - m) * (m / v)) + (-1.0d0))
end function
public static double code(double m, double v) {
return (1.0 - m) * (((1.0 - m) * (m / v)) + -1.0);
}
def code(m, v): return (1.0 - m) * (((1.0 - m) * (m / v)) + -1.0)
function code(m, v) return Float64(Float64(1.0 - m) * Float64(Float64(Float64(1.0 - m) * Float64(m / v)) + -1.0)) end
function tmp = code(m, v) tmp = (1.0 - m) * (((1.0 - m) * (m / v)) + -1.0); end
code[m_, v_] := N[(N[(1.0 - m), $MachinePrecision] * N[(N[(N[(1.0 - m), $MachinePrecision] * N[(m / v), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - m\right) \cdot \left(\left(1 - m\right) \cdot \frac{m}{v} + -1\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 2.35) (+ -1.0 (+ m (/ m v))) (* (* m (/ m v)) (+ m -1.0))))
double code(double m, double v) {
double tmp;
if (m <= 2.35) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m * (m / v)) * (m + -1.0);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 2.35d0) then
tmp = (-1.0d0) + (m + (m / v))
else
tmp = (m * (m / v)) * (m + (-1.0d0))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.35) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m * (m / v)) * (m + -1.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.35: tmp = -1.0 + (m + (m / v)) else: tmp = (m * (m / v)) * (m + -1.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.35) tmp = Float64(-1.0 + Float64(m + Float64(m / v))); else tmp = Float64(Float64(m * Float64(m / v)) * Float64(m + -1.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.35) tmp = -1.0 + (m + (m / v)); else tmp = (m * (m / v)) * (m + -1.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.35], N[(-1.0 + N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision] * N[(m + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.35:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot \frac{m}{v}\right) \cdot \left(m + -1\right)\\
\end{array}
\end{array}
if m < 2.35000000000000009Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
*-commutative99.0%
distribute-rgt-in99.0%
*-lft-identity99.0%
associate-*l/99.3%
*-lft-identity99.3%
Simplified99.3%
if 2.35000000000000009 < 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.4%
associate-*r/97.4%
mul-1-neg97.4%
unpow297.4%
distribute-rgt-neg-out97.4%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in v around 0 97.4%
mul-1-neg97.4%
unpow297.4%
associate-/l*97.4%
distribute-neg-frac97.4%
Simplified97.4%
Taylor expanded in m around 0 22.6%
*-commutative22.6%
unpow222.6%
associate-*r/22.6%
unpow322.6%
associate-*l/22.6%
associate-*r/22.6%
distribute-lft-out97.4%
Simplified97.4%
Final simplification98.3%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (* (- 1.0 m) (+ (/ m v) -1.0)) (* (* m (/ m v)) (+ m -1.0))))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * ((m / v) + -1.0);
} else {
tmp = (m * (m / v)) * (m + -1.0);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 1.0d0) then
tmp = (1.0d0 - m) * ((m / v) + (-1.0d0))
else
tmp = (m * (m / v)) * (m + (-1.0d0))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = (1.0 - m) * ((m / v) + -1.0);
} else {
tmp = (m * (m / v)) * (m + -1.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.0: tmp = (1.0 - m) * ((m / v) + -1.0) else: tmp = (m * (m / v)) * (m + -1.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.0) tmp = Float64(Float64(1.0 - m) * Float64(Float64(m / v) + -1.0)); else tmp = Float64(Float64(m * Float64(m / v)) * Float64(m + -1.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.0) tmp = (1.0 - m) * ((m / v) + -1.0); else tmp = (m * (m / v)) * (m + -1.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.0], N[(N[(1.0 - m), $MachinePrecision] * N[(N[(m / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision] * N[(m + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;\left(1 - m\right) \cdot \left(\frac{m}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot \frac{m}{v}\right) \cdot \left(m + -1\right)\\
\end{array}
\end{array}
if m < 1Initial program 100.0%
Taylor expanded in m around 0 99.3%
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.4%
associate-*r/97.4%
mul-1-neg97.4%
unpow297.4%
distribute-rgt-neg-out97.4%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in v around 0 97.4%
mul-1-neg97.4%
unpow297.4%
associate-/l*97.4%
distribute-neg-frac97.4%
Simplified97.4%
Taylor expanded in m around 0 22.6%
*-commutative22.6%
unpow222.6%
associate-*r/22.6%
unpow322.6%
associate-*l/22.6%
associate-*r/22.6%
distribute-lft-out97.4%
Simplified97.4%
Final simplification98.3%
(FPCore (m v) :precision binary64 (if (<= m 1.62) (* (- 1.0 m) (+ (/ m v) -1.0)) (/ (* m (* m (+ m -2.0))) v)))
double code(double m, double v) {
double tmp;
if (m <= 1.62) {
tmp = (1.0 - m) * ((m / v) + -1.0);
} 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) * ((m / v) + (-1.0d0))
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) * ((m / v) + -1.0);
} else {
tmp = (m * (m * (m + -2.0))) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.62: tmp = (1.0 - m) * ((m / v) + -1.0) 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(Float64(m / v) + -1.0)); else tmp = Float64(Float64(m * Float64(m * 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) * ((m / v) + -1.0); 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[(N[(m / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m * N[(m + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.62:\\
\;\;\;\;\left(1 - m\right) \cdot \left(\frac{m}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m \cdot \left(m \cdot \left(m + -2\right)\right)}{v}\\
\end{array}
\end{array}
if m < 1.6200000000000001Initial program 100.0%
Taylor expanded in m around 0 99.3%
if 1.6200000000000001 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
Taylor expanded in m around inf 98.8%
unpow298.8%
distribute-rgt-out98.8%
Simplified98.8%
Final simplification99.1%
(FPCore (m v) :precision binary64 (if (<= m 1.62) (* (- 1.0 m) (+ (/ m v) -1.0)) (/ (* (+ m -2.0) (* m m)) v)))
double code(double m, double v) {
double tmp;
if (m <= 1.62) {
tmp = (1.0 - m) * ((m / v) + -1.0);
} else {
tmp = ((m + -2.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.62d0) then
tmp = (1.0d0 - m) * ((m / v) + (-1.0d0))
else
tmp = ((m + (-2.0d0)) * (m * m)) / 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) * ((m / v) + -1.0);
} else {
tmp = ((m + -2.0) * (m * m)) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.62: tmp = (1.0 - m) * ((m / v) + -1.0) else: tmp = ((m + -2.0) * (m * m)) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 1.62) tmp = Float64(Float64(1.0 - m) * Float64(Float64(m / v) + -1.0)); else tmp = Float64(Float64(Float64(m + -2.0) * Float64(m * m)) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.62) tmp = (1.0 - m) * ((m / v) + -1.0); else tmp = ((m + -2.0) * (m * m)) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.62], N[(N[(1.0 - m), $MachinePrecision] * N[(N[(m / v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(m + -2.0), $MachinePrecision] * N[(m * m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.62:\\
\;\;\;\;\left(1 - m\right) \cdot \left(\frac{m}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(m + -2\right) \cdot \left(m \cdot m\right)}{v}\\
\end{array}
\end{array}
if m < 1.6200000000000001Initial program 100.0%
Taylor expanded in m around 0 99.3%
if 1.6200000000000001 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
Taylor expanded in m around inf 50.8%
unpow250.8%
cube-mult50.7%
distribute-rgt-out98.8%
Simplified98.8%
Final simplification99.1%
(FPCore (m v) :precision binary64 (if (<= m 2.35) (+ -1.0 (+ m (/ m v))) (* (/ m v) (+ m 1.0))))
double code(double m, double v) {
double tmp;
if (m <= 2.35) {
tmp = -1.0 + (m + (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 <= 2.35d0) then
tmp = (-1.0d0) + (m + (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 <= 2.35) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m / v) * (m + 1.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.35: tmp = -1.0 + (m + (m / v)) else: tmp = (m / v) * (m + 1.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.35) tmp = Float64(-1.0 + Float64(m + Float64(m / v))); else tmp = Float64(Float64(m / v) * Float64(m + 1.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.35) tmp = -1.0 + (m + (m / v)); else tmp = (m / v) * (m + 1.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.35], N[(-1.0 + N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m / v), $MachinePrecision] * N[(m + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.35:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{v} \cdot \left(m + 1\right)\\
\end{array}
\end{array}
if m < 2.35000000000000009Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
*-commutative99.0%
distribute-rgt-in99.0%
*-lft-identity99.0%
associate-*l/99.3%
*-lft-identity99.3%
Simplified99.3%
if 2.35000000000000009 < 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%
remove-double-div0.1%
times-frac0.1%
*-un-lft-identity0.1%
associate-/l/0.1%
associate-/r/0.1%
/-rgt-identity0.1%
sub-neg0.1%
add-sqr-sqrt0.0%
sqrt-unprod77.2%
sqr-neg77.2%
sqrt-unprod77.2%
add-sqr-sqrt77.2%
sub-neg77.2%
add-sqr-sqrt0.0%
sqrt-unprod29.2%
sqr-neg29.2%
sqrt-unprod77.2%
add-sqr-sqrt77.2%
Applied egg-rr77.2%
*-commutative77.2%
distribute-rgt-in77.2%
+-commutative77.2%
Simplified77.2%
Taylor expanded in v around 0 77.2%
+-commutative77.2%
associate-*l/77.2%
+-commutative77.2%
Simplified77.2%
Final simplification88.0%
(FPCore (m v) :precision binary64 (if (<= m 0.375) (+ -1.0 (+ m (/ m v))) (/ (* m (* m m)) v)))
double code(double m, double v) {
double tmp;
if (m <= 0.375) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (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 <= 0.375d0) then
tmp = (-1.0d0) + (m + (m / v))
else
tmp = (m * (m * m)) / v
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 0.375) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m * (m * m)) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 0.375: tmp = -1.0 + (m + (m / v)) else: tmp = (m * (m * m)) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 0.375) tmp = Float64(-1.0 + Float64(m + Float64(m / v))); else tmp = Float64(Float64(m * Float64(m * m)) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 0.375) tmp = -1.0 + (m + (m / v)); else tmp = (m * (m * m)) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 0.375], N[(-1.0 + N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m * m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.375:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{m \cdot \left(m \cdot m\right)}{v}\\
\end{array}
\end{array}
if m < 0.375Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
*-commutative99.0%
distribute-rgt-in99.0%
*-lft-identity99.0%
associate-*l/99.3%
*-lft-identity99.3%
Simplified99.3%
if 0.375 < m Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 99.9%
Taylor expanded in m around inf 97.3%
unpow297.3%
Simplified97.3%
Final simplification98.3%
(FPCore (m v) :precision binary64 (if (<= v 1.6e-81) (/ m v) (+ m -1.0)))
double code(double m, double v) {
double tmp;
if (v <= 1.6e-81) {
tmp = m / v;
} else {
tmp = m + -1.0;
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (v <= 1.6d-81) then
tmp = m / v
else
tmp = m + (-1.0d0)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (v <= 1.6e-81) {
tmp = m / v;
} else {
tmp = m + -1.0;
}
return tmp;
}
def code(m, v): tmp = 0 if v <= 1.6e-81: tmp = m / v else: tmp = m + -1.0 return tmp
function code(m, v) tmp = 0.0 if (v <= 1.6e-81) tmp = Float64(m / v); else tmp = Float64(m + -1.0); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (v <= 1.6e-81) tmp = m / v; else tmp = m + -1.0; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[v, 1.6e-81], N[(m / v), $MachinePrecision], N[(m + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 1.6 \cdot 10^{-81}:\\
\;\;\;\;\frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m + -1\\
\end{array}
\end{array}
if v < 1.6e-81Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 84.9%
Taylor expanded in m around 0 62.8%
if 1.6e-81 < v Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around inf 44.4%
neg-mul-144.4%
neg-sub044.4%
associate--r-44.4%
metadata-eval44.4%
Simplified44.4%
Final simplification58.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.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around inf 21.4%
neg-mul-121.4%
neg-sub021.4%
associate--r-21.4%
metadata-eval21.4%
Simplified21.4%
Final simplification21.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.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 18.9%
Final simplification18.9%
herbie shell --seed 2023214
(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)))