
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) (- 1.0 m)))
double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (((m * (1.0d0 - m)) / v) - 1.0d0) * (1.0d0 - m)
end function
public static double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
def code(m, v): return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m)
function code(m, v) return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * Float64(1.0 - m)) end
function tmp = code(m, v) tmp = (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m); end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (m v) :precision binary64 (* (- (/ (* m (- 1.0 m)) v) 1.0) (- 1.0 m)))
double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = (((m * (1.0d0 - m)) / v) - 1.0d0) * (1.0d0 - m)
end function
public static double code(double m, double v) {
return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m);
}
def code(m, v): return (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m)
function code(m, v) return Float64(Float64(Float64(Float64(m * Float64(1.0 - m)) / v) - 1.0) * Float64(1.0 - m)) end
function tmp = code(m, v) tmp = (((m * (1.0 - m)) / v) - 1.0) * (1.0 - m); end
code[m_, v_] := N[(N[(N[(N[(m * N[(1.0 - m), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m \cdot \left(1 - m\right)}{v} - 1\right) \cdot \left(1 - m\right)
\end{array}
(FPCore (m v) :precision binary64 (* (- 1.0 m) (+ (/ m (/ 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.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (m v)
:precision binary64
(let* ((t_0 (+ m (/ m v))))
(if (<= m 6e-248)
-1.0
(if (<= m 1.55e-220)
t_0
(if (<= m 1.08e-201) -1.0 (if (<= m 0.38) t_0 (* m (* m (/ m v)))))))))
double code(double m, double v) {
double t_0 = m + (m / v);
double tmp;
if (m <= 6e-248) {
tmp = -1.0;
} else if (m <= 1.55e-220) {
tmp = t_0;
} else if (m <= 1.08e-201) {
tmp = -1.0;
} else if (m <= 0.38) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = m + (m / v)
if (m <= 6d-248) then
tmp = -1.0d0
else if (m <= 1.55d-220) then
tmp = t_0
else if (m <= 1.08d-201) then
tmp = -1.0d0
else if (m <= 0.38d0) then
tmp = t_0
else
tmp = m * (m * (m / v))
end if
code = tmp
end function
public static double code(double m, double v) {
double t_0 = m + (m / v);
double tmp;
if (m <= 6e-248) {
tmp = -1.0;
} else if (m <= 1.55e-220) {
tmp = t_0;
} else if (m <= 1.08e-201) {
tmp = -1.0;
} else if (m <= 0.38) {
tmp = t_0;
} else {
tmp = m * (m * (m / v));
}
return tmp;
}
def code(m, v): t_0 = m + (m / v) tmp = 0 if m <= 6e-248: tmp = -1.0 elif m <= 1.55e-220: tmp = t_0 elif m <= 1.08e-201: tmp = -1.0 elif m <= 0.38: tmp = t_0 else: tmp = m * (m * (m / v)) return tmp
function code(m, v) t_0 = Float64(m + Float64(m / v)) tmp = 0.0 if (m <= 6e-248) tmp = -1.0; elseif (m <= 1.55e-220) tmp = t_0; elseif (m <= 1.08e-201) tmp = -1.0; elseif (m <= 0.38) tmp = t_0; else tmp = Float64(m * Float64(m * Float64(m / v))); end return tmp end
function tmp_2 = code(m, v) t_0 = m + (m / v); tmp = 0.0; if (m <= 6e-248) tmp = -1.0; elseif (m <= 1.55e-220) tmp = t_0; elseif (m <= 1.08e-201) tmp = -1.0; elseif (m <= 0.38) tmp = t_0; else tmp = m * (m * (m / v)); end tmp_2 = tmp; end
code[m_, v_] := Block[{t$95$0 = N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 6e-248], -1.0, If[LessEqual[m, 1.55e-220], t$95$0, If[LessEqual[m, 1.08e-201], -1.0, If[LessEqual[m, 0.38], t$95$0, N[(m * N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := m + \frac{m}{v}\\
\mathbf{if}\;m \leq 6 \cdot 10^{-248}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1.55 \cdot 10^{-220}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq 1.08 \cdot 10^{-201}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 0.38:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;m \cdot \left(m \cdot \frac{m}{v}\right)\\
\end{array}
\end{array}
if m < 6.00000000000000027e-248 or 1.55000000000000006e-220 < m < 1.0799999999999999e-201Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 93.0%
if 6.00000000000000027e-248 < m < 1.55000000000000006e-220 or 1.0799999999999999e-201 < m < 0.38Initial program 99.9%
Taylor expanded in m around 0 92.8%
Taylor expanded in m around inf 75.5%
+-commutative75.5%
mul-1-neg75.5%
unpow275.5%
associate-*r/75.5%
unsub-neg75.5%
*-commutative75.5%
distribute-lft-in75.5%
*-rgt-identity75.5%
associate-*r/75.8%
*-rgt-identity75.8%
Simplified75.8%
Taylor expanded in m around 0 75.3%
*-commutative75.3%
distribute-lft-in75.3%
*-rgt-identity75.3%
associate-*r/75.5%
*-rgt-identity75.5%
Simplified75.5%
if 0.38 < 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.6%
div-inv97.6%
cube-mult97.6%
associate-*l*97.6%
add-sqr-sqrt97.6%
sqrt-unprod97.6%
sqr-neg97.6%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
associate-*l*0.1%
div-inv0.1%
add-sqr-sqrt0.0%
sqrt-unprod97.6%
sqr-neg97.6%
sqrt-unprod97.6%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
Final simplification89.7%
(FPCore (m v)
:precision binary64
(let* ((t_0 (+ m (/ m v))))
(if (<= m 6e-248)
-1.0
(if (<= m 1.45e-220)
t_0
(if (<= m 6.8e-202) -1.0 (if (<= m 0.38) t_0 (* m (/ (* m m) v))))))))
double code(double m, double v) {
double t_0 = m + (m / v);
double tmp;
if (m <= 6e-248) {
tmp = -1.0;
} else if (m <= 1.45e-220) {
tmp = t_0;
} else if (m <= 6.8e-202) {
tmp = -1.0;
} else if (m <= 0.38) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = m + (m / v)
if (m <= 6d-248) then
tmp = -1.0d0
else if (m <= 1.45d-220) then
tmp = t_0
else if (m <= 6.8d-202) then
tmp = -1.0d0
else if (m <= 0.38d0) then
tmp = t_0
else
tmp = m * ((m * m) / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double t_0 = m + (m / v);
double tmp;
if (m <= 6e-248) {
tmp = -1.0;
} else if (m <= 1.45e-220) {
tmp = t_0;
} else if (m <= 6.8e-202) {
tmp = -1.0;
} else if (m <= 0.38) {
tmp = t_0;
} else {
tmp = m * ((m * m) / v);
}
return tmp;
}
def code(m, v): t_0 = m + (m / v) tmp = 0 if m <= 6e-248: tmp = -1.0 elif m <= 1.45e-220: tmp = t_0 elif m <= 6.8e-202: tmp = -1.0 elif m <= 0.38: tmp = t_0 else: tmp = m * ((m * m) / v) return tmp
function code(m, v) t_0 = Float64(m + Float64(m / v)) tmp = 0.0 if (m <= 6e-248) tmp = -1.0; elseif (m <= 1.45e-220) tmp = t_0; elseif (m <= 6.8e-202) tmp = -1.0; elseif (m <= 0.38) tmp = t_0; else tmp = Float64(m * Float64(Float64(m * m) / v)); end return tmp end
function tmp_2 = code(m, v) t_0 = m + (m / v); tmp = 0.0; if (m <= 6e-248) tmp = -1.0; elseif (m <= 1.45e-220) tmp = t_0; elseif (m <= 6.8e-202) tmp = -1.0; elseif (m <= 0.38) tmp = t_0; else tmp = m * ((m * m) / v); end tmp_2 = tmp; end
code[m_, v_] := Block[{t$95$0 = N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 6e-248], -1.0, If[LessEqual[m, 1.45e-220], t$95$0, If[LessEqual[m, 6.8e-202], -1.0, If[LessEqual[m, 0.38], t$95$0, N[(m * N[(N[(m * m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := m + \frac{m}{v}\\
\mathbf{if}\;m \leq 6 \cdot 10^{-248}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1.45 \cdot 10^{-220}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq 6.8 \cdot 10^{-202}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 0.38:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m \cdot m}{v}\\
\end{array}
\end{array}
if m < 6.00000000000000027e-248 or 1.4499999999999999e-220 < m < 6.80000000000000025e-202Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 93.0%
if 6.00000000000000027e-248 < m < 1.4499999999999999e-220 or 6.80000000000000025e-202 < m < 0.38Initial program 99.9%
Taylor expanded in m around 0 92.8%
Taylor expanded in m around inf 75.5%
+-commutative75.5%
mul-1-neg75.5%
unpow275.5%
associate-*r/75.5%
unsub-neg75.5%
*-commutative75.5%
distribute-lft-in75.5%
*-rgt-identity75.5%
associate-*r/75.8%
*-rgt-identity75.8%
Simplified75.8%
Taylor expanded in m around 0 75.3%
*-commutative75.3%
distribute-lft-in75.3%
*-rgt-identity75.3%
associate-*r/75.5%
*-rgt-identity75.5%
Simplified75.5%
if 0.38 < 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.6%
div-inv97.6%
cube-mult97.6%
associate-*l*97.6%
add-sqr-sqrt97.6%
sqrt-unprod97.6%
sqr-neg97.6%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
associate-*l*0.1%
div-inv0.1%
add-sqr-sqrt0.0%
sqrt-unprod97.6%
sqr-neg97.6%
sqrt-unprod97.6%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.7%
Applied egg-rr97.7%
Final simplification89.7%
(FPCore (m v)
:precision binary64
(if (<= m 6e-248)
-1.0
(if (<= m 2.4e-220)
(+ m (/ m v))
(if (<= m 1.15e-201)
-1.0
(if (<= m 0.42) (* (- 1.0 m) (/ m v)) (* m (/ (* m m) v)))))))
double code(double m, double v) {
double tmp;
if (m <= 6e-248) {
tmp = -1.0;
} else if (m <= 2.4e-220) {
tmp = m + (m / v);
} else if (m <= 1.15e-201) {
tmp = -1.0;
} else if (m <= 0.42) {
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 <= 6d-248) then
tmp = -1.0d0
else if (m <= 2.4d-220) then
tmp = m + (m / v)
else if (m <= 1.15d-201) then
tmp = -1.0d0
else if (m <= 0.42d0) 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 <= 6e-248) {
tmp = -1.0;
} else if (m <= 2.4e-220) {
tmp = m + (m / v);
} else if (m <= 1.15e-201) {
tmp = -1.0;
} else if (m <= 0.42) {
tmp = (1.0 - m) * (m / v);
} else {
tmp = m * ((m * m) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6e-248: tmp = -1.0 elif m <= 2.4e-220: tmp = m + (m / v) elif m <= 1.15e-201: tmp = -1.0 elif m <= 0.42: tmp = (1.0 - m) * (m / v) else: tmp = m * ((m * m) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 6e-248) tmp = -1.0; elseif (m <= 2.4e-220) tmp = Float64(m + Float64(m / v)); elseif (m <= 1.15e-201) tmp = -1.0; elseif (m <= 0.42) tmp = Float64(Float64(1.0 - m) * Float64(m / v)); else tmp = Float64(m * Float64(Float64(m * m) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 6e-248) tmp = -1.0; elseif (m <= 2.4e-220) tmp = m + (m / v); elseif (m <= 1.15e-201) tmp = -1.0; elseif (m <= 0.42) tmp = (1.0 - m) * (m / v); else tmp = m * ((m * m) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6e-248], -1.0, If[LessEqual[m, 2.4e-220], N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.15e-201], -1.0, If[LessEqual[m, 0.42], N[(N[(1.0 - m), $MachinePrecision] * N[(m / v), $MachinePrecision]), $MachinePrecision], N[(m * N[(N[(m * m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6 \cdot 10^{-248}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 2.4 \cdot 10^{-220}:\\
\;\;\;\;m + \frac{m}{v}\\
\mathbf{elif}\;m \leq 1.15 \cdot 10^{-201}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 0.42:\\
\;\;\;\;\left(1 - m\right) \cdot \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m \cdot m}{v}\\
\end{array}
\end{array}
if m < 6.00000000000000027e-248 or 2.4000000000000001e-220 < m < 1.14999999999999993e-201Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 93.0%
if 6.00000000000000027e-248 < m < 2.4000000000000001e-220Initial program 100.0%
Taylor expanded in m around 0 100.0%
Taylor expanded in m around inf 83.9%
+-commutative83.9%
mul-1-neg83.9%
unpow283.9%
associate-*r/83.9%
unsub-neg83.9%
*-commutative83.9%
distribute-lft-in83.9%
*-rgt-identity83.9%
associate-*r/84.4%
*-rgt-identity84.4%
Simplified84.4%
Taylor expanded in m around 0 83.9%
*-commutative83.9%
distribute-lft-in83.9%
*-rgt-identity83.9%
associate-*r/84.4%
*-rgt-identity84.4%
Simplified84.4%
if 1.14999999999999993e-201 < m < 0.419999999999999984Initial program 99.9%
Taylor expanded in m around 0 92.1%
Taylor expanded in m around inf 74.7%
+-commutative74.7%
mul-1-neg74.7%
unpow274.7%
associate-*r/74.7%
unsub-neg74.7%
*-commutative74.7%
distribute-lft-in74.7%
*-rgt-identity74.7%
associate-*r/74.9%
*-rgt-identity74.9%
Simplified74.9%
Taylor expanded in v around 0 74.9%
unpow274.9%
div-sub74.9%
associate-*r/74.9%
cancel-sign-sub-inv74.9%
*-lft-identity74.9%
distribute-rgt-in74.9%
sub-neg74.9%
Simplified74.9%
if 0.419999999999999984 < 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.6%
div-inv97.6%
cube-mult97.6%
associate-*l*97.6%
add-sqr-sqrt97.6%
sqrt-unprod97.6%
sqr-neg97.6%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
associate-*l*0.1%
div-inv0.1%
add-sqr-sqrt0.0%
sqrt-unprod97.6%
sqr-neg97.6%
sqrt-unprod97.6%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.7%
Applied egg-rr97.7%
Final simplification89.8%
(FPCore (m v) :precision binary64 (if (<= m 1.65) (+ (/ m (/ v (- 1.0 m))) (+ m -1.0)) (* (* m (/ m v)) (+ m -2.0))))
double code(double m, double v) {
double tmp;
if (m <= 1.65) {
tmp = (m / (v / (1.0 - m))) + (m + -1.0);
} else {
tmp = (m * (m / v)) * (m + -2.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.65d0) then
tmp = (m / (v / (1.0d0 - m))) + (m + (-1.0d0))
else
tmp = (m * (m / v)) * (m + (-2.0d0))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.65) {
tmp = (m / (v / (1.0 - m))) + (m + -1.0);
} else {
tmp = (m * (m / v)) * (m + -2.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.65: tmp = (m / (v / (1.0 - m))) + (m + -1.0) else: tmp = (m * (m / v)) * (m + -2.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.65) tmp = Float64(Float64(m / Float64(v / Float64(1.0 - m))) + Float64(m + -1.0)); else tmp = Float64(Float64(m * Float64(m / v)) * Float64(m + -2.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.65) tmp = (m / (v / (1.0 - m))) + (m + -1.0); else tmp = (m * (m / v)) * (m + -2.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.65], N[(N[(m / N[(v / N[(1.0 - m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(m + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision] * N[(m + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.65:\\
\;\;\;\;\frac{m}{\frac{v}{1 - m}} + \left(m + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot \frac{m}{v}\right) \cdot \left(m + -2\right)\\
\end{array}
\end{array}
if m < 1.6499999999999999Initial program 99.9%
Taylor expanded in m around 0 93.9%
Taylor expanded in v around 0 93.9%
+-commutative93.9%
mul-1-neg93.9%
unsub-neg93.9%
associate-/l*93.9%
Simplified93.9%
if 1.6499999999999999 < m Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
associate-/r/99.9%
div-inv99.9%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in m around inf 18.5%
unpow218.5%
associate-*r/18.5%
unpow318.5%
associate-*r/18.5%
associate-*r*18.5%
distribute-rgt-out98.6%
Simplified98.6%
Final simplification96.5%
(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/99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 6e-248) -1.0 (if (or (<= m 1.45e-220) (not (<= m 1.6e-201))) (+ m (/ m v)) -1.0)))
double code(double m, double v) {
double tmp;
if (m <= 6e-248) {
tmp = -1.0;
} else if ((m <= 1.45e-220) || !(m <= 1.6e-201)) {
tmp = m + (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 <= 6d-248) then
tmp = -1.0d0
else if ((m <= 1.45d-220) .or. (.not. (m <= 1.6d-201))) then
tmp = m + (m / v)
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 6e-248) {
tmp = -1.0;
} else if ((m <= 1.45e-220) || !(m <= 1.6e-201)) {
tmp = m + (m / v);
} else {
tmp = -1.0;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 6e-248: tmp = -1.0 elif (m <= 1.45e-220) or not (m <= 1.6e-201): tmp = m + (m / v) else: tmp = -1.0 return tmp
function code(m, v) tmp = 0.0 if (m <= 6e-248) tmp = -1.0; elseif ((m <= 1.45e-220) || !(m <= 1.6e-201)) tmp = Float64(m + Float64(m / v)); else tmp = -1.0; end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 6e-248) tmp = -1.0; elseif ((m <= 1.45e-220) || ~((m <= 1.6e-201))) tmp = m + (m / v); else tmp = -1.0; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 6e-248], -1.0, If[Or[LessEqual[m, 1.45e-220], N[Not[LessEqual[m, 1.6e-201]], $MachinePrecision]], N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision], -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6 \cdot 10^{-248}:\\
\;\;\;\;-1\\
\mathbf{elif}\;m \leq 1.45 \cdot 10^{-220} \lor \neg \left(m \leq 1.6 \cdot 10^{-201}\right):\\
\;\;\;\;m + \frac{m}{v}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if m < 6.00000000000000027e-248 or 1.4499999999999999e-220 < m < 1.6000000000000001e-201Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in m around 0 93.0%
if 6.00000000000000027e-248 < m < 1.4499999999999999e-220 or 1.6000000000000001e-201 < m Initial program 99.9%
Taylor expanded in m around 0 35.1%
Taylor expanded in m around inf 28.6%
+-commutative28.6%
mul-1-neg28.6%
unpow228.6%
associate-*r/28.6%
unsub-neg28.6%
*-commutative28.6%
distribute-lft-in28.6%
*-rgt-identity28.6%
associate-*r/28.7%
*-rgt-identity28.7%
Simplified28.7%
Taylor expanded in m around 0 62.8%
*-commutative62.8%
distribute-lft-in62.8%
*-rgt-identity62.8%
associate-*r/62.9%
*-rgt-identity62.9%
Simplified62.9%
Final simplification66.2%
(FPCore (m v) :precision binary64 (if (<= m 2.4) (+ -1.0 (+ m (/ m v))) (* (* m (/ m v)) (+ m -2.0))))
double code(double m, double v) {
double tmp;
if (m <= 2.4) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m * (m / v)) * (m + -2.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.4d0) then
tmp = (-1.0d0) + (m + (m / v))
else
tmp = (m * (m / v)) * (m + (-2.0d0))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.4) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = (m * (m / v)) * (m + -2.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.4: tmp = -1.0 + (m + (m / v)) else: tmp = (m * (m / v)) * (m + -2.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.4) tmp = Float64(-1.0 + Float64(m + Float64(m / v))); else tmp = Float64(Float64(m * Float64(m / v)) * Float64(m + -2.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.4) tmp = -1.0 + (m + (m / v)); else tmp = (m * (m / v)) * (m + -2.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.4], N[(-1.0 + N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision] * N[(m + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.4:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot \frac{m}{v}\right) \cdot \left(m + -2\right)\\
\end{array}
\end{array}
if m < 2.39999999999999991Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 93.5%
sub-neg93.5%
*-commutative93.5%
distribute-rgt-in93.5%
*-lft-identity93.5%
associate-*l/93.7%
*-lft-identity93.7%
metadata-eval93.7%
Simplified93.7%
if 2.39999999999999991 < m Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
associate-/r/99.9%
div-inv99.9%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in m around inf 18.5%
unpow218.5%
associate-*r/18.5%
unpow318.5%
associate-*r/18.5%
associate-*r*18.5%
distribute-rgt-out98.6%
Simplified98.6%
Final simplification96.4%
(FPCore (m v) :precision binary64 (if (<= m 1.65) (* (- 1.0 m) (+ -1.0 (/ m v))) (* (* m (/ m v)) (+ m -2.0))))
double code(double m, double v) {
double tmp;
if (m <= 1.65) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = (m * (m / v)) * (m + -2.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.65d0) then
tmp = (1.0d0 - m) * ((-1.0d0) + (m / v))
else
tmp = (m * (m / v)) * (m + (-2.0d0))
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 1.65) {
tmp = (1.0 - m) * (-1.0 + (m / v));
} else {
tmp = (m * (m / v)) * (m + -2.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.65: tmp = (1.0 - m) * (-1.0 + (m / v)) else: tmp = (m * (m / v)) * (m + -2.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.65) tmp = Float64(Float64(1.0 - m) * Float64(-1.0 + Float64(m / v))); else tmp = Float64(Float64(m * Float64(m / v)) * Float64(m + -2.0)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.65) tmp = (1.0 - m) * (-1.0 + (m / v)); else tmp = (m * (m / v)) * (m + -2.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.65], N[(N[(1.0 - m), $MachinePrecision] * N[(-1.0 + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(m * N[(m / v), $MachinePrecision]), $MachinePrecision] * N[(m + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.65:\\
\;\;\;\;\left(1 - m\right) \cdot \left(-1 + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot \frac{m}{v}\right) \cdot \left(m + -2\right)\\
\end{array}
\end{array}
if m < 1.6499999999999999Initial program 99.9%
Taylor expanded in m around 0 93.9%
if 1.6499999999999999 < m Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
associate-/r/99.9%
div-inv99.9%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in m around inf 18.5%
unpow218.5%
associate-*r/18.5%
unpow318.5%
associate-*r/18.5%
associate-*r*18.5%
distribute-rgt-out98.6%
Simplified98.6%
Final simplification96.5%
(FPCore (m v) :precision binary64 (if (<= m 0.38) (+ -1.0 (+ m (/ m v))) (* m (/ (* m m) v))))
double code(double m, double v) {
double tmp;
if (m <= 0.38) {
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.38d0) 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.38) {
tmp = -1.0 + (m + (m / v));
} else {
tmp = m * ((m * m) / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 0.38: tmp = -1.0 + (m + (m / v)) else: tmp = m * ((m * m) / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 0.38) tmp = Float64(-1.0 + Float64(m + Float64(m / v))); else tmp = Float64(m * Float64(Float64(m * m) / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 0.38) tmp = -1.0 + (m + (m / v)); else tmp = m * ((m * m) / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 0.38], N[(-1.0 + N[(m + N[(m / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(m * N[(N[(m * m), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.38:\\
\;\;\;\;-1 + \left(m + \frac{m}{v}\right)\\
\mathbf{else}:\\
\;\;\;\;m \cdot \frac{m \cdot m}{v}\\
\end{array}
\end{array}
if m < 0.38Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in m around 0 94.2%
sub-neg94.2%
*-commutative94.2%
distribute-rgt-in94.2%
*-lft-identity94.2%
associate-*l/94.4%
*-lft-identity94.4%
metadata-eval94.4%
Simplified94.4%
if 0.38 < 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.6%
div-inv97.6%
cube-mult97.6%
associate-*l*97.6%
add-sqr-sqrt97.6%
sqrt-unprod97.6%
sqr-neg97.6%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
associate-*l*0.1%
div-inv0.1%
add-sqr-sqrt0.0%
sqrt-unprod97.6%
sqr-neg97.6%
sqrt-unprod97.6%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.7%
Applied egg-rr97.7%
Final simplification96.2%
(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 18.6%
neg-mul-118.6%
neg-sub018.6%
associate--r-18.6%
metadata-eval18.6%
Simplified18.6%
Final simplification18.6%
(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 15.8%
Final simplification15.8%
herbie shell --seed 2023189
(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)))