
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + log(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * 0.5d0) + (y * ((1.0d0 - z) + log(z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + Math.log(z)));
}
def code(x, y, z): return (x * 0.5) + (y * ((1.0 - z) + math.log(z)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(1.0 - z) + log(z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * ((1.0 - z) + log(z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + log(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * 0.5d0) + (y * ((1.0d0 - z) + log(z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + Math.log(z)));
}
def code(x, y, z): return (x * 0.5) + (y * ((1.0 - z) + math.log(z)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(1.0 - z) + log(z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * ((1.0 - z) + log(z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\end{array}
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + log(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * 0.5d0) + (y * ((1.0d0 - z) + log(z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + Math.log(z)));
}
def code(x, y, z): return (x * 0.5) + (y * ((1.0 - z) + math.log(z)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(1.0 - z) + log(z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * ((1.0 - z) + log(z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (or (<= (* x 0.5) -5e+52)
(and (not (<= (* x 0.5) -1000000000.0))
(or (<= (* x 0.5) -1e-44) (not (<= (* x 0.5) 1e-38)))))
(- (* x 0.5) (* y z))
(+ y (* y (- (log z) z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e+52) || (!((x * 0.5) <= -1000000000.0) && (((x * 0.5) <= -1e-44) || !((x * 0.5) <= 1e-38)))) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * (log(z) - z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (((x * 0.5d0) <= (-5d+52)) .or. (.not. ((x * 0.5d0) <= (-1000000000.0d0))) .and. ((x * 0.5d0) <= (-1d-44)) .or. (.not. ((x * 0.5d0) <= 1d-38))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y + (y * (log(z) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e+52) || (!((x * 0.5) <= -1000000000.0) && (((x * 0.5) <= -1e-44) || !((x * 0.5) <= 1e-38)))) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * (Math.log(z) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -5e+52) or (not ((x * 0.5) <= -1000000000.0) and (((x * 0.5) <= -1e-44) or not ((x * 0.5) <= 1e-38))): tmp = (x * 0.5) - (y * z) else: tmp = y + (y * (math.log(z) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -5e+52) || (!(Float64(x * 0.5) <= -1000000000.0) && ((Float64(x * 0.5) <= -1e-44) || !(Float64(x * 0.5) <= 1e-38)))) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y + Float64(y * Float64(log(z) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -5e+52) || (~(((x * 0.5) <= -1000000000.0)) && (((x * 0.5) <= -1e-44) || ~(((x * 0.5) <= 1e-38))))) tmp = (x * 0.5) - (y * z); else tmp = y + (y * (log(z) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -5e+52], And[N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], -1000000000.0]], $MachinePrecision], Or[LessEqual[N[(x * 0.5), $MachinePrecision], -1e-44], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 1e-38]], $MachinePrecision]]]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -5 \cdot 10^{+52} \lor \neg \left(x \cdot 0.5 \leq -1000000000\right) \land \left(x \cdot 0.5 \leq -1 \cdot 10^{-44} \lor \neg \left(x \cdot 0.5 \leq 10^{-38}\right)\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \left(\log z - z\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -5e52 or -1e9 < (*.f64 x 1/2) < -9.99999999999999953e-45 or 9.9999999999999996e-39 < (*.f64 x 1/2) Initial program 99.9%
Taylor expanded in z around inf 90.2%
mul-1-neg90.2%
distribute-rgt-neg-in90.2%
Simplified90.2%
if -5e52 < (*.f64 x 1/2) < -1e9 or -9.99999999999999953e-45 < (*.f64 x 1/2) < 9.9999999999999996e-39Initial program 99.7%
sub-neg99.7%
associate-+l+99.8%
distribute-rgt-in99.7%
*-lft-identity99.7%
associate-+r+99.7%
neg-sub099.7%
associate-+l-99.7%
neg-sub099.7%
distribute-lft-neg-out99.7%
unsub-neg99.7%
fma-def99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 86.9%
Final simplification88.7%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -5e-280) (not (<= (* x 0.5) -4e-308))) (- (* x 0.5) (* y z)) (* y (+ (log z) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e-280) || !((x * 0.5) <= -4e-308)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (log(z) + 1.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (((x * 0.5d0) <= (-5d-280)) .or. (.not. ((x * 0.5d0) <= (-4d-308)))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y * (log(z) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e-280) || !((x * 0.5) <= -4e-308)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (Math.log(z) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -5e-280) or not ((x * 0.5) <= -4e-308): tmp = (x * 0.5) - (y * z) else: tmp = y * (math.log(z) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -5e-280) || !(Float64(x * 0.5) <= -4e-308)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y * Float64(log(z) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -5e-280) || ~(((x * 0.5) <= -4e-308))) tmp = (x * 0.5) - (y * z); else tmp = y * (log(z) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -5e-280], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], -4e-308]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -5 \cdot 10^{-280} \lor \neg \left(x \cdot 0.5 \leq -4 \cdot 10^{-308}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\log z + 1\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -5.00000000000000028e-280 or -4.00000000000000013e-308 < (*.f64 x 1/2) Initial program 99.9%
Taylor expanded in z around inf 79.3%
mul-1-neg79.3%
distribute-rgt-neg-in79.3%
Simplified79.3%
if -5.00000000000000028e-280 < (*.f64 x 1/2) < -4.00000000000000013e-308Initial program 99.2%
Taylor expanded in z around 0 93.7%
Taylor expanded in x around 0 81.3%
Final simplification79.3%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -5e-280) (not (<= (* x 0.5) -4e-308))) (- (* x 0.5) (* y z)) (+ y (* y (log z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e-280) || !((x * 0.5) <= -4e-308)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * log(z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (((x * 0.5d0) <= (-5d-280)) .or. (.not. ((x * 0.5d0) <= (-4d-308)))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y + (y * log(z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e-280) || !((x * 0.5) <= -4e-308)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * Math.log(z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -5e-280) or not ((x * 0.5) <= -4e-308): tmp = (x * 0.5) - (y * z) else: tmp = y + (y * math.log(z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -5e-280) || !(Float64(x * 0.5) <= -4e-308)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y + Float64(y * log(z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -5e-280) || ~(((x * 0.5) <= -4e-308))) tmp = (x * 0.5) - (y * z); else tmp = y + (y * log(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -5e-280], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], -4e-308]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -5 \cdot 10^{-280} \lor \neg \left(x \cdot 0.5 \leq -4 \cdot 10^{-308}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \log z\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -5.00000000000000028e-280 or -4.00000000000000013e-308 < (*.f64 x 1/2) Initial program 99.9%
Taylor expanded in z around inf 79.3%
mul-1-neg79.3%
distribute-rgt-neg-in79.3%
Simplified79.3%
if -5.00000000000000028e-280 < (*.f64 x 1/2) < -4.00000000000000013e-308Initial program 99.2%
distribute-lft-in99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 87.1%
Taylor expanded in z around 0 81.6%
Final simplification79.4%
(FPCore (x y z) :precision binary64 (if (<= z 0.56) (+ (* x 0.5) (* y (+ (log z) 1.0))) (+ (* x 0.5) (- y (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.56) {
tmp = (x * 0.5) + (y * (log(z) + 1.0));
} else {
tmp = (x * 0.5) + (y - (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 0.56d0) then
tmp = (x * 0.5d0) + (y * (log(z) + 1.0d0))
else
tmp = (x * 0.5d0) + (y - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 0.56) {
tmp = (x * 0.5) + (y * (Math.log(z) + 1.0));
} else {
tmp = (x * 0.5) + (y - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.56: tmp = (x * 0.5) + (y * (math.log(z) + 1.0)) else: tmp = (x * 0.5) + (y - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.56) tmp = Float64(Float64(x * 0.5) + Float64(y * Float64(log(z) + 1.0))); else tmp = Float64(Float64(x * 0.5) + Float64(y - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 0.56) tmp = (x * 0.5) + (y * (log(z) + 1.0)); else tmp = (x * 0.5) + (y - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.56], N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] + N[(y - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.56:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(\log z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 + \left(y - y \cdot z\right)\\
\end{array}
\end{array}
if z < 0.56000000000000005Initial program 99.7%
Taylor expanded in z around 0 98.9%
if 0.56000000000000005 < z Initial program 100.0%
distribute-lft-in99.2%
Applied egg-rr99.2%
add-sqr-sqrt55.5%
pow255.5%
Applied egg-rr55.5%
Taylor expanded in y around 0 99.2%
sub-neg99.2%
distribute-lft-in99.2%
*-rgt-identity99.2%
distribute-rgt-neg-in99.2%
unsub-neg99.2%
Simplified99.2%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (- (* x 0.5) (* y z)))
double code(double x, double y, double z) {
return (x * 0.5) - (y * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * 0.5d0) - (y * z)
end function
public static double code(double x, double y, double z) {
return (x * 0.5) - (y * z);
}
def code(x, y, z): return (x * 0.5) - (y * z)
function code(x, y, z) return Float64(Float64(x * 0.5) - Float64(y * z)) end
function tmp = code(x, y, z) tmp = (x * 0.5) - (y * z); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 - y \cdot z
\end{array}
Initial program 99.9%
Taylor expanded in z around inf 76.5%
mul-1-neg76.5%
distribute-rgt-neg-in76.5%
Simplified76.5%
Final simplification76.5%
(FPCore (x y z) :precision binary64 (if (<= z 3.8e+32) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 3.8e+32) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 3.8d+32) then
tmp = x * 0.5d0
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 3.8e+32) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 3.8e+32: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 3.8e+32) tmp = Float64(x * 0.5); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 3.8e+32) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 3.8e+32], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.8 \cdot 10^{+32}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 3.8000000000000003e32Initial program 99.7%
Taylor expanded in x around inf 53.8%
if 3.8000000000000003e32 < z Initial program 100.0%
sub-neg100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
associate-+r+100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
distribute-lft-neg-out100.0%
unsub-neg100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
expm1-log1p-u95.9%
Applied egg-rr95.9%
Taylor expanded in z around inf 75.3%
mul-1-neg75.3%
distribute-rgt-neg-in75.3%
Simplified75.3%
Final simplification63.6%
(FPCore (x y z) :precision binary64 (* x 0.5))
double code(double x, double y, double z) {
return x * 0.5;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * 0.5d0
end function
public static double code(double x, double y, double z) {
return x * 0.5;
}
def code(x, y, z): return x * 0.5
function code(x, y, z) return Float64(x * 0.5) end
function tmp = code(x, y, z) tmp = x * 0.5; end
code[x_, y_, z_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 41.2%
Final simplification41.2%
(FPCore (x y z) :precision binary64 (- (+ y (* 0.5 x)) (* y (- z (log z)))))
double code(double x, double y, double z) {
return (y + (0.5 * x)) - (y * (z - log(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y + (0.5d0 * x)) - (y * (z - log(z)))
end function
public static double code(double x, double y, double z) {
return (y + (0.5 * x)) - (y * (z - Math.log(z)));
}
def code(x, y, z): return (y + (0.5 * x)) - (y * (z - math.log(z)))
function code(x, y, z) return Float64(Float64(y + Float64(0.5 * x)) - Float64(y * Float64(z - log(z)))) end
function tmp = code(x, y, z) tmp = (y + (0.5 * x)) - (y * (z - log(z))); end
code[x_, y_, z_] := N[(N[(y + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + 0.5 \cdot x\right) - y \cdot \left(z - \log z\right)
\end{array}
herbie shell --seed 2023275
(FPCore (x y z)
:name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
:precision binary64
:herbie-target
(- (+ y (* 0.5 x)) (* y (- z (log z))))
(+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))