
(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 (+ (* y (+ (- 1.0 z) (log z))) (* x 0.5)))
double code(double x, double y, double z) {
return (y * ((1.0 - z) + log(z))) + (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 = (y * ((1.0d0 - z) + log(z))) + (x * 0.5d0)
end function
public static double code(double x, double y, double z) {
return (y * ((1.0 - z) + Math.log(z))) + (x * 0.5);
}
def code(x, y, z): return (y * ((1.0 - z) + math.log(z))) + (x * 0.5)
function code(x, y, z) return Float64(Float64(y * Float64(Float64(1.0 - z) + log(z))) + Float64(x * 0.5)) end
function tmp = code(x, y, z) tmp = (y * ((1.0 - z) + log(z))) + (x * 0.5); end
code[x_, y_, z_] := N[(N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\left(1 - z\right) + \log z\right) + x \cdot 0.5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y -2.8e+121) (* y (+ (- 1.0 z) (log z))) (if (<= y 2.4e+36) (- (* x 0.5) (* y z)) (* y (+ (- (log z) z) 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+121) {
tmp = y * ((1.0 - z) + log(z));
} else if (y <= 2.4e+36) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * ((log(z) - 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 (y <= (-2.8d+121)) then
tmp = y * ((1.0d0 - z) + log(z))
else if (y <= 2.4d+36) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y * ((log(z) - z) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+121) {
tmp = y * ((1.0 - z) + Math.log(z));
} else if (y <= 2.4e+36) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * ((Math.log(z) - z) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.8e+121: tmp = y * ((1.0 - z) + math.log(z)) elif y <= 2.4e+36: tmp = (x * 0.5) - (y * z) else: tmp = y * ((math.log(z) - z) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.8e+121) tmp = Float64(y * Float64(Float64(1.0 - z) + log(z))); elseif (y <= 2.4e+36) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y * Float64(Float64(log(z) - z) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.8e+121) tmp = y * ((1.0 - z) + log(z)); elseif (y <= 2.4e+36) tmp = (x * 0.5) - (y * z); else tmp = y * ((log(z) - z) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.8e+121], N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e+36], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+121}:\\
\;\;\;\;y \cdot \left(\left(1 - z\right) + \log z\right)\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+36}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(\log z - z\right) + 1\right)\\
\end{array}
\end{array}
if y < -2.80000000000000006e121Initial program 99.8%
Taylor expanded in x around 0
*-lowering-*.f64N/A
associate--l+N/A
sub-negN/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-sub-invN/A
neg-mul-1N/A
--lowering--.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6491.0%
Simplified91.0%
associate-+l-N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
log-lowering-log.f6491.0%
Applied egg-rr91.0%
if -2.80000000000000006e121 < y < 2.39999999999999992e36Initial program 99.9%
flip-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
log-lowering-log.f6499.8%
Applied egg-rr99.8%
Taylor expanded in z around inf
/-lowering-/.f6488.6%
Simplified88.6%
Taylor expanded in x around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6488.7%
Simplified88.7%
if 2.39999999999999992e36 < y Initial program 99.8%
Taylor expanded in x around 0
*-lowering-*.f64N/A
associate--l+N/A
sub-negN/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-sub-invN/A
neg-mul-1N/A
--lowering--.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6482.3%
Simplified82.3%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (+ (- (log z) z) 1.0)))) (if (<= y -3.95e+121) t_0 (if (<= y 4.1e+36) (- (* x 0.5) (* y z)) t_0))))
double code(double x, double y, double z) {
double t_0 = y * ((log(z) - z) + 1.0);
double tmp;
if (y <= -3.95e+121) {
tmp = t_0;
} else if (y <= 4.1e+36) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = y * ((log(z) - z) + 1.0d0)
if (y <= (-3.95d+121)) then
tmp = t_0
else if (y <= 4.1d+36) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * ((Math.log(z) - z) + 1.0);
double tmp;
if (y <= -3.95e+121) {
tmp = t_0;
} else if (y <= 4.1e+36) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * ((math.log(z) - z) + 1.0) tmp = 0 if y <= -3.95e+121: tmp = t_0 elif y <= 4.1e+36: tmp = (x * 0.5) - (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(Float64(log(z) - z) + 1.0)) tmp = 0.0 if (y <= -3.95e+121) tmp = t_0; elseif (y <= 4.1e+36) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * ((log(z) - z) + 1.0); tmp = 0.0; if (y <= -3.95e+121) tmp = t_0; elseif (y <= 4.1e+36) tmp = (x * 0.5) - (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.95e+121], t$95$0, If[LessEqual[y, 4.1e+36], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\left(\log z - z\right) + 1\right)\\
\mathbf{if}\;y \leq -3.95 \cdot 10^{+121}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+36}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.95e121 or 4.10000000000000013e36 < y Initial program 99.8%
Taylor expanded in x around 0
*-lowering-*.f64N/A
associate--l+N/A
sub-negN/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-sub-invN/A
neg-mul-1N/A
--lowering--.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6486.8%
Simplified86.8%
if -3.95e121 < y < 4.10000000000000013e36Initial program 99.9%
flip-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
log-lowering-log.f6499.8%
Applied egg-rr99.8%
Taylor expanded in z around inf
/-lowering-/.f6488.6%
Simplified88.6%
Taylor expanded in x around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6488.7%
Simplified88.7%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (+ (* y (+ (log z) 1.0)) (* x 0.5)) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (y * (log(z) + 1.0)) + (x * 0.5);
} else {
tmp = (x * 0.5) - (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.28d0) then
tmp = (y * (log(z) + 1.0d0)) + (x * 0.5d0)
else
tmp = (x * 0.5d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (y * (Math.log(z) + 1.0)) + (x * 0.5);
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.28: tmp = (y * (math.log(z) + 1.0)) + (x * 0.5) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.28) tmp = Float64(Float64(y * Float64(log(z) + 1.0)) + Float64(x * 0.5)); else tmp = Float64(Float64(x * 0.5) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 0.28) tmp = (y * (log(z) + 1.0)) + (x * 0.5); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.28], N[(N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.28:\\
\;\;\;\;y \cdot \left(\log z + 1\right) + x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 0.28000000000000003Initial program 99.8%
Taylor expanded in z around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6498.7%
Simplified98.7%
if 0.28000000000000003 < z Initial program 100.0%
flip-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
log-lowering-log.f6499.8%
Applied egg-rr99.8%
Taylor expanded in z around inf
/-lowering-/.f6498.0%
Simplified98.0%
Taylor expanded in x around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6498.2%
Simplified98.2%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= z 2.3e+81) (* x 0.5) (* y (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.3e+81) {
tmp = x * 0.5;
} else {
tmp = y * (1.0 - 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 <= 2.3d+81) then
tmp = x * 0.5d0
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2.3e+81) {
tmp = x * 0.5;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.3e+81: tmp = x * 0.5 else: tmp = y * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.3e+81) tmp = Float64(x * 0.5); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2.3e+81) tmp = x * 0.5; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.3e+81], N[(x * 0.5), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{+81}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if z < 2.2999999999999999e81Initial program 99.8%
Taylor expanded in x around inf
*-lowering-*.f6458.8%
Simplified58.8%
if 2.2999999999999999e81 < z Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
associate--l+N/A
sub-negN/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-sub-invN/A
neg-mul-1N/A
--lowering--.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6479.7%
Simplified79.7%
Taylor expanded in z around inf
Simplified79.7%
Final simplification66.3%
(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%
flip-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
log-lowering-log.f6499.8%
Applied egg-rr99.8%
Taylor expanded in z around inf
/-lowering-/.f6477.9%
Simplified77.9%
Taylor expanded in x around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6478.0%
Simplified78.0%
Final simplification78.0%
(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
*-lowering-*.f6445.9%
Simplified45.9%
Final simplification45.9%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f64N/A
associate--l+N/A
sub-negN/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-sub-invN/A
neg-mul-1N/A
--lowering--.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6456.0%
Simplified56.0%
Taylor expanded in z around inf
Simplified33.9%
Taylor expanded in z around 0
Simplified2.0%
(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 2024161
(FPCore (x y z)
:name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
:precision binary64
:alt
(! :herbie-platform default (- (+ y (* 1/2 x)) (* y (- z (log z)))))
(+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))