
(FPCore (x y) :precision binary64 (* (* x y) (- 1.0 y)))
double code(double x, double y) {
return (x * y) * (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) * (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x * y) * (1.0 - y);
}
def code(x, y): return (x * y) * (1.0 - y)
function code(x, y) return Float64(Float64(x * y) * Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x * y) * (1.0 - y); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y\right) \cdot \left(1 - y\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (* x y) (- 1.0 y)))
double code(double x, double y) {
return (x * y) * (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) * (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x * y) * (1.0 - y);
}
def code(x, y): return (x * y) * (1.0 - y)
function code(x, y) return Float64(Float64(x * y) * Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x * y) * (1.0 - y); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y\right) \cdot \left(1 - y\right)
\end{array}
(FPCore (x y) :precision binary64 (* y (* (- 1.0 y) x)))
double code(double x, double y) {
return y * ((1.0 - y) * x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y * ((1.0d0 - y) * x)
end function
public static double code(double x, double y) {
return y * ((1.0 - y) * x);
}
def code(x, y): return y * ((1.0 - y) * x)
function code(x, y) return Float64(y * Float64(Float64(1.0 - y) * x)) end
function tmp = code(x, y) tmp = y * ((1.0 - y) * x); end
code[x_, y_] := N[(y * N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\left(1 - y\right) \cdot x\right)
\end{array}
Initial program 99.9%
flip3--N/A
metadata-evalN/A
div-subN/A
div-invN/A
sqr-powN/A
associate-/l*N/A
prod-diffN/A
+-lowering-+.f64N/A
Applied egg-rr40.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (* (- 1.0 y) (* y x)))
double code(double x, double y) {
return (1.0 - y) * (y * x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - y) * (y * x)
end function
public static double code(double x, double y) {
return (1.0 - y) * (y * x);
}
def code(x, y): return (1.0 - y) * (y * x)
function code(x, y) return Float64(Float64(1.0 - y) * Float64(y * x)) end
function tmp = code(x, y) tmp = (1.0 - y) * (y * x); end
code[x_, y_] := N[(N[(1.0 - y), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - y\right) \cdot \left(y \cdot x\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (* x (- y (* y y))))
double code(double x, double y) {
return x * (y - (y * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (y - (y * y))
end function
public static double code(double x, double y) {
return x * (y - (y * y));
}
def code(x, y): return x * (y - (y * y))
function code(x, y) return Float64(x * Float64(y - Float64(y * y))) end
function tmp = code(x, y) tmp = x * (y - (y * y)); end
code[x_, y_] := N[(x * N[(y - N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(y - y \cdot y\right)
\end{array}
Initial program 99.9%
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.4%
Simplified93.4%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-inN/A
fmm-defN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f6493.4%
Applied egg-rr93.4%
(FPCore (x y) :precision binary64 (* x (* y (- 1.0 y))))
double code(double x, double y) {
return x * (y * (1.0 - y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (y * (1.0d0 - y))
end function
public static double code(double x, double y) {
return x * (y * (1.0 - y));
}
def code(x, y): return x * (y * (1.0 - y))
function code(x, y) return Float64(x * Float64(y * Float64(1.0 - y))) end
function tmp = code(x, y) tmp = x * (y * (1.0 - y)); end
code[x_, y_] := N[(x * N[(y * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(y \cdot \left(1 - y\right)\right)
\end{array}
Initial program 99.9%
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.4%
Simplified93.4%
(FPCore (x y) :precision binary64 (* y x))
double code(double x, double y) {
return y * x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y * x
end function
public static double code(double x, double y) {
return y * x;
}
def code(x, y): return y * x
function code(x, y) return Float64(y * x) end
function tmp = code(x, y) tmp = y * x; end
code[x_, y_] := N[(y * x), $MachinePrecision]
\begin{array}{l}
\\
y \cdot x
\end{array}
Initial program 99.9%
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.4%
Simplified93.4%
Taylor expanded in y around 0
*-lowering-*.f6458.6%
Simplified58.6%
Final simplification58.6%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.4%
Simplified93.4%
Applied egg-rr54.2%
Taylor expanded in y around 0
*-lowering-*.f6454.5%
Simplified54.5%
Taylor expanded in y around inf
Simplified3.0%
herbie shell --seed 2024160
(FPCore (x y)
:name "Statistics.Distribution.Binomial:$cvariance from math-functions-0.1.5.2"
:precision binary64
(* (* x y) (- 1.0 y)))