
(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 16 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 (if (<= m 1e-8) (- (fma (/ m v) (fma -2.0 m 1.0) m) 1.0) (* (/ (* (- 1.0 m) m) v) (- 1.0 m))))
double code(double m, double v) {
double tmp;
if (m <= 1e-8) {
tmp = fma((m / v), fma(-2.0, m, 1.0), m) - 1.0;
} else {
tmp = (((1.0 - m) * m) / v) * (1.0 - m);
}
return tmp;
}
function code(m, v) tmp = 0.0 if (m <= 1e-8) tmp = Float64(fma(Float64(m / v), fma(-2.0, m, 1.0), m) - 1.0); else tmp = Float64(Float64(Float64(Float64(1.0 - m) * m) / v) * Float64(1.0 - m)); end return tmp end
code[m_, v_] := If[LessEqual[m, 1e-8], N[(N[(N[(m / v), $MachinePrecision] * N[(-2.0 * m + 1.0), $MachinePrecision] + m), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(1.0 - m), $MachinePrecision] * m), $MachinePrecision] / v), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\frac{m}{v}, \mathsf{fma}\left(-2, m, 1\right), m\right) - 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - m\right) \cdot m}{v} \cdot \left(1 - m\right)\\
\end{array}
\end{array}
if m < 1e-8Initial program 99.9%
Taylor expanded in m around 0
distribute-rgt-inN/A
*-lft-identityN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
if 1e-8 < m Initial program 99.9%
lift--.f64N/A
sub-negN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Taylor expanded in v around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.9
Applied rewrites99.9%
(FPCore (m v) :precision binary64 (if (<= (* (- (/ (* (- 1.0 m) m) v) 1.0) (- 1.0 m)) -0.5) -1.0 (* 1.0 (/ m v))))
double code(double m, double v) {
double tmp;
if ((((((1.0 - m) * m) / v) - 1.0) * (1.0 - m)) <= -0.5) {
tmp = -1.0;
} else {
tmp = 1.0 * (m / v);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if ((((((1.0d0 - m) * m) / v) - 1.0d0) * (1.0d0 - m)) <= (-0.5d0)) then
tmp = -1.0d0
else
tmp = 1.0d0 * (m / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if ((((((1.0 - m) * m) / v) - 1.0) * (1.0 - m)) <= -0.5) {
tmp = -1.0;
} else {
tmp = 1.0 * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if (((((1.0 - m) * m) / v) - 1.0) * (1.0 - m)) <= -0.5: tmp = -1.0 else: tmp = 1.0 * (m / v) return tmp
function code(m, v) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(1.0 - m) * m) / v) - 1.0) * Float64(1.0 - m)) <= -0.5) tmp = -1.0; else tmp = Float64(1.0 * Float64(m / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if ((((((1.0 - m) * m) / v) - 1.0) * (1.0 - m)) <= -0.5) tmp = -1.0; else tmp = 1.0 * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[N[(N[(N[(N[(N[(1.0 - m), $MachinePrecision] * m), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision], -0.5], -1.0, N[(1.0 * N[(m / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\frac{\left(1 - m\right) \cdot m}{v} - 1\right) \cdot \left(1 - m\right) \leq -0.5:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \frac{m}{v}\\
\end{array}
\end{array}
if (*.f64 (-.f64 (/.f64 (*.f64 m (-.f64 #s(literal 1 binary64) m)) v) #s(literal 1 binary64)) (-.f64 #s(literal 1 binary64) m)) < -0.5Initial program 100.0%
Taylor expanded in m around 0
Applied rewrites98.4%
if -0.5 < (*.f64 (-.f64 (/.f64 (*.f64 m (-.f64 #s(literal 1 binary64) m)) v) #s(literal 1 binary64)) (-.f64 #s(literal 1 binary64) m)) Initial program 99.9%
lift--.f64N/A
sub-negN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Taylor expanded in v around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6498.9
Applied rewrites98.9%
Taylor expanded in m around 0
Applied rewrites28.8%
Taylor expanded in m around 0
Applied rewrites68.0%
Final simplification75.6%
(FPCore (m v) :precision binary64 (if (<= (* (- (/ (* (- 1.0 m) m) v) 1.0) (- 1.0 m)) -0.5) -1.0 (- (/ m v) m)))
double code(double m, double v) {
double tmp;
if ((((((1.0 - m) * m) / v) - 1.0) * (1.0 - m)) <= -0.5) {
tmp = -1.0;
} else {
tmp = (m / v) - m;
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if ((((((1.0d0 - m) * m) / v) - 1.0d0) * (1.0d0 - m)) <= (-0.5d0)) then
tmp = -1.0d0
else
tmp = (m / v) - m
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if ((((((1.0 - m) * m) / v) - 1.0) * (1.0 - m)) <= -0.5) {
tmp = -1.0;
} else {
tmp = (m / v) - m;
}
return tmp;
}
def code(m, v): tmp = 0 if (((((1.0 - m) * m) / v) - 1.0) * (1.0 - m)) <= -0.5: tmp = -1.0 else: tmp = (m / v) - m return tmp
function code(m, v) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(1.0 - m) * m) / v) - 1.0) * Float64(1.0 - m)) <= -0.5) tmp = -1.0; else tmp = Float64(Float64(m / v) - m); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if ((((((1.0 - m) * m) / v) - 1.0) * (1.0 - m)) <= -0.5) tmp = -1.0; else tmp = (m / v) - m; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[N[(N[(N[(N[(N[(1.0 - m), $MachinePrecision] * m), $MachinePrecision] / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision], -0.5], -1.0, N[(N[(m / v), $MachinePrecision] - m), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\frac{\left(1 - m\right) \cdot m}{v} - 1\right) \cdot \left(1 - m\right) \leq -0.5:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\frac{m}{v} - m\\
\end{array}
\end{array}
if (*.f64 (-.f64 (/.f64 (*.f64 m (-.f64 #s(literal 1 binary64) m)) v) #s(literal 1 binary64)) (-.f64 #s(literal 1 binary64) m)) < -0.5Initial program 100.0%
Taylor expanded in m around 0
Applied rewrites98.4%
if -0.5 < (*.f64 (-.f64 (/.f64 (*.f64 m (-.f64 #s(literal 1 binary64) m)) v) #s(literal 1 binary64)) (-.f64 #s(literal 1 binary64) m)) Initial program 99.9%
Applied rewrites99.9%
Taylor expanded in m around 0
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f6430.1
Applied rewrites30.1%
Taylor expanded in m around inf
Applied rewrites29.0%
Taylor expanded in m around 0
Applied rewrites68.0%
Final simplification75.6%
(FPCore (m v) :precision binary64 (fma (* (- m 1.0) (- m 1.0)) (/ m v) (fma -1.0 m -1.0)))
double code(double m, double v) {
return fma(((m - 1.0) * (m - 1.0)), (m / v), fma(-1.0, m, -1.0));
}
function code(m, v) return fma(Float64(Float64(m - 1.0) * Float64(m - 1.0)), Float64(m / v), fma(-1.0, m, -1.0)) end
code[m_, v_] := N[(N[(N[(m - 1.0), $MachinePrecision] * N[(m - 1.0), $MachinePrecision]), $MachinePrecision] * N[(m / v), $MachinePrecision] + N[(-1.0 * m + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(m - 1\right) \cdot \left(m - 1\right), \frac{m}{v}, \mathsf{fma}\left(-1, m, -1\right)\right)
\end{array}
Initial program 99.9%
Applied rewrites99.9%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 1.0) (- (fma (/ m v) (fma -2.0 m 1.0) m) 1.0) (/ (* (* (- m 2.0) m) m) v)))
double code(double m, double v) {
double tmp;
if (m <= 1.0) {
tmp = fma((m / v), fma(-2.0, m, 1.0), m) - 1.0;
} else {
tmp = (((m - 2.0) * m) * m) / v;
}
return tmp;
}
function code(m, v) tmp = 0.0 if (m <= 1.0) tmp = Float64(fma(Float64(m / v), fma(-2.0, m, 1.0), m) - 1.0); else tmp = Float64(Float64(Float64(Float64(m - 2.0) * m) * m) / v); end return tmp end
code[m_, v_] := If[LessEqual[m, 1.0], N[(N[(N[(m / v), $MachinePrecision] * N[(-2.0 * m + 1.0), $MachinePrecision] + m), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(m - 2.0), $MachinePrecision] * m), $MachinePrecision] * m), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;\mathsf{fma}\left(\frac{m}{v}, \mathsf{fma}\left(-2, m, 1\right), m\right) - 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(m - 2\right) \cdot m\right) \cdot m}{v}\\
\end{array}
\end{array}
if m < 1Initial program 99.9%
Taylor expanded in m around 0
distribute-rgt-inN/A
*-lft-identityN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
if 1 < m Initial program 99.9%
Taylor expanded in m around inf
Applied rewrites99.8%
Applied rewrites99.8%
Final simplification99.9%
(FPCore (m v) :precision binary64 (if (<= m 1.65) (* (- (/ m v) 1.0) (- 1.0 m)) (/ (* (* (- m 2.0) m) m) v)))
double code(double m, double v) {
double tmp;
if (m <= 1.65) {
tmp = ((m / v) - 1.0) * (1.0 - m);
} 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.65d0) then
tmp = ((m / v) - 1.0d0) * (1.0d0 - m)
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.65) {
tmp = ((m / v) - 1.0) * (1.0 - m);
} else {
tmp = (((m - 2.0) * m) * m) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.65: tmp = ((m / v) - 1.0) * (1.0 - m) else: tmp = (((m - 2.0) * m) * m) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 1.65) tmp = Float64(Float64(Float64(m / v) - 1.0) * Float64(1.0 - m)); else tmp = Float64(Float64(Float64(Float64(m - 2.0) * m) * m) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 1.65) tmp = ((m / v) - 1.0) * (1.0 - m); else tmp = (((m - 2.0) * m) * m) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.65], N[(N[(N[(m / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(m - 2.0), $MachinePrecision] * m), $MachinePrecision] * m), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.65:\\
\;\;\;\;\left(\frac{m}{v} - 1\right) \cdot \left(1 - m\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(m - 2\right) \cdot m\right) \cdot m}{v}\\
\end{array}
\end{array}
if m < 1.6499999999999999Initial program 99.9%
Taylor expanded in m around 0
lower-/.f6499.3
Applied rewrites99.3%
if 1.6499999999999999 < m Initial program 99.9%
Taylor expanded in m around inf
Applied rewrites99.8%
Applied rewrites99.8%
Final simplification99.5%
(FPCore (m v) :precision binary64 (if (<= m 1.65) (* (- (/ m v) 1.0) (- 1.0 m)) (* (* (/ m v) m) (- m 2.0))))
double code(double m, double v) {
double tmp;
if (m <= 1.65) {
tmp = ((m / v) - 1.0) * (1.0 - m);
} else {
tmp = ((m / v) * m) * (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) * (1.0d0 - m)
else
tmp = ((m / v) * m) * (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) * (1.0 - m);
} else {
tmp = ((m / v) * m) * (m - 2.0);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 1.65: tmp = ((m / v) - 1.0) * (1.0 - m) else: tmp = ((m / v) * m) * (m - 2.0) return tmp
function code(m, v) tmp = 0.0 if (m <= 1.65) tmp = Float64(Float64(Float64(m / v) - 1.0) * Float64(1.0 - m)); else tmp = Float64(Float64(Float64(m / v) * m) * 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) * (1.0 - m); else tmp = ((m / v) * m) * (m - 2.0); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 1.65], N[(N[(N[(m / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(m / v), $MachinePrecision] * m), $MachinePrecision] * N[(m - 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.65:\\
\;\;\;\;\left(\frac{m}{v} - 1\right) \cdot \left(1 - m\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{m}{v} \cdot m\right) \cdot \left(m - 2\right)\\
\end{array}
\end{array}
if m < 1.6499999999999999Initial program 99.9%
Taylor expanded in m around 0
lower-/.f6499.3
Applied rewrites99.3%
if 1.6499999999999999 < m Initial program 99.9%
Taylor expanded in m around inf
Applied rewrites99.8%
(FPCore (m v) :precision binary64 (if (<= m 0.43) (* (- (/ m v) 1.0) (- 1.0 m)) (/ (* (* m m) m) v)))
double code(double m, double v) {
double tmp;
if (m <= 0.43) {
tmp = ((m / v) - 1.0) * (1.0 - m);
} 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.43d0) then
tmp = ((m / v) - 1.0d0) * (1.0d0 - m)
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.43) {
tmp = ((m / v) - 1.0) * (1.0 - m);
} else {
tmp = ((m * m) * m) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 0.43: tmp = ((m / v) - 1.0) * (1.0 - m) else: tmp = ((m * m) * m) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 0.43) tmp = Float64(Float64(Float64(m / v) - 1.0) * Float64(1.0 - m)); else tmp = Float64(Float64(Float64(m * m) * m) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 0.43) tmp = ((m / v) - 1.0) * (1.0 - m); else tmp = ((m * m) * m) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 0.43], N[(N[(N[(m / v), $MachinePrecision] - 1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(m * m), $MachinePrecision] * m), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.43:\\
\;\;\;\;\left(\frac{m}{v} - 1\right) \cdot \left(1 - m\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(m \cdot m\right) \cdot m}{v}\\
\end{array}
\end{array}
if m < 0.429999999999999993Initial program 99.9%
Taylor expanded in m around 0
lower-/.f6499.3
Applied rewrites99.3%
if 0.429999999999999993 < m Initial program 99.9%
Taylor expanded in m around inf
Applied rewrites99.8%
Applied rewrites99.8%
Taylor expanded in m around inf
Applied rewrites99.0%
Final simplification99.1%
(FPCore (m v) :precision binary64 (* (fma (/ m v) (- 1.0 m) -1.0) (- 1.0 m)))
double code(double m, double v) {
return fma((m / v), (1.0 - m), -1.0) * (1.0 - m);
}
function code(m, v) return Float64(fma(Float64(m / v), Float64(1.0 - m), -1.0) * Float64(1.0 - m)) end
code[m_, v_] := N[(N[(N[(m / v), $MachinePrecision] * N[(1.0 - m), $MachinePrecision] + -1.0), $MachinePrecision] * N[(1.0 - m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{m}{v}, 1 - m, -1\right) \cdot \left(1 - m\right)
\end{array}
Initial program 99.9%
lift--.f64N/A
sub-negN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
(FPCore (m v) :precision binary64 (if (<= m 2.55) (- (+ (/ m v) m) 1.0) (/ (* (* m m) m) v)))
double code(double m, double v) {
double tmp;
if (m <= 2.55) {
tmp = ((m / v) + m) - 1.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) :: tmp
if (m <= 2.55d0) then
tmp = ((m / v) + m) - 1.0d0
else
tmp = ((m * m) * m) / v
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.55) {
tmp = ((m / v) + m) - 1.0;
} else {
tmp = ((m * m) * m) / v;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.55: tmp = ((m / v) + m) - 1.0 else: tmp = ((m * m) * m) / v return tmp
function code(m, v) tmp = 0.0 if (m <= 2.55) tmp = Float64(Float64(Float64(m / v) + m) - 1.0); else tmp = Float64(Float64(Float64(m * m) * m) / v); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.55) tmp = ((m / v) + m) - 1.0; else tmp = ((m * m) * m) / v; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.55], N[(N[(N[(m / v), $MachinePrecision] + m), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(m * m), $MachinePrecision] * m), $MachinePrecision] / v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.55:\\
\;\;\;\;\left(\frac{m}{v} + m\right) - 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(m \cdot m\right) \cdot m}{v}\\
\end{array}
\end{array}
if m < 2.5499999999999998Initial program 99.9%
Taylor expanded in m around 0
distribute-lft-inN/A
*-rgt-identityN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
*-lft-identityN/A
lower-+.f64N/A
lower-/.f6499.2
Applied rewrites99.2%
if 2.5499999999999998 < m Initial program 99.9%
Taylor expanded in m around inf
Applied rewrites99.8%
Applied rewrites99.8%
Taylor expanded in m around inf
Applied rewrites99.0%
Final simplification99.1%
(FPCore (m v) :precision binary64 (if (<= m 2.55) (- (+ (/ m v) m) 1.0) (* (* m m) (/ m v))))
double code(double m, double v) {
double tmp;
if (m <= 2.55) {
tmp = ((m / v) + m) - 1.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) :: tmp
if (m <= 2.55d0) then
tmp = ((m / v) + m) - 1.0d0
else
tmp = (m * m) * (m / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.55) {
tmp = ((m / v) + m) - 1.0;
} else {
tmp = (m * m) * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.55: tmp = ((m / v) + m) - 1.0 else: tmp = (m * m) * (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.55) tmp = Float64(Float64(Float64(m / v) + m) - 1.0); else tmp = Float64(Float64(m * m) * Float64(m / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.55) tmp = ((m / v) + m) - 1.0; else tmp = (m * m) * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.55], N[(N[(N[(m / v), $MachinePrecision] + m), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(m * m), $MachinePrecision] * N[(m / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.55:\\
\;\;\;\;\left(\frac{m}{v} + m\right) - 1\\
\mathbf{else}:\\
\;\;\;\;\left(m \cdot m\right) \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 2.5499999999999998Initial program 99.9%
Taylor expanded in m around 0
distribute-lft-inN/A
*-rgt-identityN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
*-lft-identityN/A
lower-+.f64N/A
lower-/.f6499.2
Applied rewrites99.2%
if 2.5499999999999998 < m Initial program 99.9%
Taylor expanded in m around inf
Applied rewrites99.8%
Applied rewrites99.8%
Taylor expanded in m around inf
Applied rewrites99.0%
Final simplification99.1%
(FPCore (m v) :precision binary64 (if (<= m 2.55) (- (+ (/ m v) m) 1.0) (* (/ (* m m) v) m)))
double code(double m, double v) {
double tmp;
if (m <= 2.55) {
tmp = ((m / v) + m) - 1.0;
} else {
tmp = ((m * m) / v) * m;
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 2.55d0) then
tmp = ((m / v) + m) - 1.0d0
else
tmp = ((m * m) / v) * m
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.55) {
tmp = ((m / v) + m) - 1.0;
} else {
tmp = ((m * m) / v) * m;
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.55: tmp = ((m / v) + m) - 1.0 else: tmp = ((m * m) / v) * m return tmp
function code(m, v) tmp = 0.0 if (m <= 2.55) tmp = Float64(Float64(Float64(m / v) + m) - 1.0); else tmp = Float64(Float64(Float64(m * m) / v) * m); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.55) tmp = ((m / v) + m) - 1.0; else tmp = ((m * m) / v) * m; end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.55], N[(N[(N[(m / v), $MachinePrecision] + m), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(m * m), $MachinePrecision] / v), $MachinePrecision] * m), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.55:\\
\;\;\;\;\left(\frac{m}{v} + m\right) - 1\\
\mathbf{else}:\\
\;\;\;\;\frac{m \cdot m}{v} \cdot m\\
\end{array}
\end{array}
if m < 2.5499999999999998Initial program 99.9%
Taylor expanded in m around 0
distribute-lft-inN/A
*-rgt-identityN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
*-lft-identityN/A
lower-+.f64N/A
lower-/.f6499.2
Applied rewrites99.2%
if 2.5499999999999998 < m Initial program 99.9%
Taylor expanded in m around inf
Applied rewrites99.8%
Applied rewrites99.8%
Taylor expanded in m around inf
Applied rewrites99.0%
Applied rewrites99.0%
Final simplification99.1%
(FPCore (m v) :precision binary64 (if (<= m 2.4) (- (+ (/ m v) m) 1.0) (* (- m -1.0) (/ m v))))
double code(double m, double v) {
double tmp;
if (m <= 2.4) {
tmp = ((m / v) + m) - 1.0;
} else {
tmp = (m - -1.0) * (m / v);
}
return tmp;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
real(8) :: tmp
if (m <= 2.4d0) then
tmp = ((m / v) + m) - 1.0d0
else
tmp = (m - (-1.0d0)) * (m / v)
end if
code = tmp
end function
public static double code(double m, double v) {
double tmp;
if (m <= 2.4) {
tmp = ((m / v) + m) - 1.0;
} else {
tmp = (m - -1.0) * (m / v);
}
return tmp;
}
def code(m, v): tmp = 0 if m <= 2.4: tmp = ((m / v) + m) - 1.0 else: tmp = (m - -1.0) * (m / v) return tmp
function code(m, v) tmp = 0.0 if (m <= 2.4) tmp = Float64(Float64(Float64(m / v) + m) - 1.0); else tmp = Float64(Float64(m - -1.0) * Float64(m / v)); end return tmp end
function tmp_2 = code(m, v) tmp = 0.0; if (m <= 2.4) tmp = ((m / v) + m) - 1.0; else tmp = (m - -1.0) * (m / v); end tmp_2 = tmp; end
code[m_, v_] := If[LessEqual[m, 2.4], N[(N[(N[(m / v), $MachinePrecision] + m), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(m - -1.0), $MachinePrecision] * N[(m / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.4:\\
\;\;\;\;\left(\frac{m}{v} + m\right) - 1\\
\mathbf{else}:\\
\;\;\;\;\left(m - -1\right) \cdot \frac{m}{v}\\
\end{array}
\end{array}
if m < 2.39999999999999991Initial program 99.9%
Taylor expanded in m around 0
distribute-lft-inN/A
*-rgt-identityN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
*-lft-identityN/A
lower-+.f64N/A
lower-/.f6499.2
Applied rewrites99.2%
if 2.39999999999999991 < m Initial program 99.9%
lift--.f64N/A
sub-negN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Taylor expanded in v around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in m around 0
Applied rewrites0.1%
lift--.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
*-commutativeN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
mul-1-negN/A
mul-1-negN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
metadata-evalN/A
unpow-prod-downN/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
*-commutativeN/A
*-lft-identityN/A
unpow1N/A
lower--.f6477.4
Applied rewrites77.4%
Final simplification87.8%
(FPCore (m v) :precision binary64 (- (+ (/ m v) m) 1.0))
double code(double m, double v) {
return ((m / v) + m) - 1.0;
}
real(8) function code(m, v)
real(8), intent (in) :: m
real(8), intent (in) :: v
code = ((m / v) + m) - 1.0d0
end function
public static double code(double m, double v) {
return ((m / v) + m) - 1.0;
}
def code(m, v): return ((m / v) + m) - 1.0
function code(m, v) return Float64(Float64(Float64(m / v) + m) - 1.0) end
function tmp = code(m, v) tmp = ((m / v) + m) - 1.0; end
code[m_, v_] := N[(N[(N[(m / v), $MachinePrecision] + m), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{m}{v} + m\right) - 1
\end{array}
Initial program 99.9%
Taylor expanded in m around 0
distribute-lft-inN/A
*-rgt-identityN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
*-lft-identityN/A
lower-+.f64N/A
lower-/.f6476.8
Applied rewrites76.8%
(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%
Taylor expanded in v around inf
mul-1-negN/A
neg-sub0N/A
associate--r-N/A
metadata-evalN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
lower--.f6427.7
Applied rewrites27.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%
Taylor expanded in m around 0
Applied rewrites25.2%
herbie shell --seed 2024312
(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)))