
(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 9 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 (fma y (+ (- 1.0 z) (log z)) (* x 0.5)))
double code(double x, double y, double z) {
return fma(y, ((1.0 - z) + log(z)), (x * 0.5));
}
function code(x, y, z) return fma(y, Float64(Float64(1.0 - z) + log(z)), Float64(x * 0.5)) end
code[x_, y_, z_] := N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \left(1 - z\right) + \log z, x \cdot 0.5\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z)
:precision binary64
(if (<= (* x 0.5) -4e-129)
(- (* x 0.5) (* y z))
(if (<= (* x 0.5) 1e-70)
(* y (- (+ 1.0 (log z)) z))
(fma y (- z) (* x 0.5)))))
double code(double x, double y, double z) {
double tmp;
if ((x * 0.5) <= -4e-129) {
tmp = (x * 0.5) - (y * z);
} else if ((x * 0.5) <= 1e-70) {
tmp = y * ((1.0 + log(z)) - z);
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(x * 0.5) <= -4e-129) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); elseif (Float64(x * 0.5) <= 1e-70) tmp = Float64(y * Float64(Float64(1.0 + log(z)) - z)); else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(x * 0.5), $MachinePrecision], -4e-129], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * 0.5), $MachinePrecision], 1e-70], N[(y * N[(N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision], N[(y * (-z) + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -4 \cdot 10^{-129}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{elif}\;x \cdot 0.5 \leq 10^{-70}:\\
\;\;\;\;y \cdot \left(\left(1 + \log z\right) - z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 x #s(literal 1/2 binary64)) < -3.9999999999999997e-129Initial program 100.0%
Taylor expanded in z around inf 81.4%
associate-*r*81.4%
neg-mul-181.4%
Simplified81.4%
distribute-lft-neg-out81.4%
unsub-neg81.4%
add-sqr-sqrt42.4%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod28.7%
add-sqr-sqrt56.3%
*-commutative56.3%
add-sqr-sqrt28.7%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod42.4%
add-sqr-sqrt81.4%
Applied egg-rr81.4%
if -3.9999999999999997e-129 < (*.f64 x #s(literal 1/2 binary64)) < 9.99999999999999996e-71Initial program 99.8%
Taylor expanded in x around -inf 68.1%
mul-1-neg68.1%
*-commutative68.1%
distribute-rgt-neg-in68.1%
Simplified68.1%
Taylor expanded in y around -inf 93.1%
if 9.99999999999999996e-71 < (*.f64 x #s(literal 1/2 binary64)) Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 89.2%
neg-mul-189.2%
Simplified89.2%
Final simplification87.4%
(FPCore (x y z) :precision binary64 (if (<= z 2.4e-219) (* x (- 0.5 (* z (/ y x)))) (if (<= z 3.9e-54) (* y (+ 1.0 (log z))) (fma y (- z) (* x 0.5)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.4e-219) {
tmp = x * (0.5 - (z * (y / x)));
} else if (z <= 3.9e-54) {
tmp = y * (1.0 + log(z));
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 2.4e-219) tmp = Float64(x * Float64(0.5 - Float64(z * Float64(y / x)))); elseif (z <= 3.9e-54) tmp = Float64(y * Float64(1.0 + log(z))); else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 2.4e-219], N[(x * N[(0.5 - N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.9e-54], N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * (-z) + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.4 \cdot 10^{-219}:\\
\;\;\;\;x \cdot \left(0.5 - z \cdot \frac{y}{x}\right)\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-54}:\\
\;\;\;\;y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 2.40000000000000014e-219Initial program 99.9%
Taylor expanded in z around inf 65.3%
associate-*r*65.3%
neg-mul-165.3%
Simplified65.3%
distribute-lft-neg-out65.3%
unsub-neg65.3%
add-sqr-sqrt38.9%
sqrt-unprod60.6%
sqr-neg60.6%
sqrt-unprod26.3%
add-sqr-sqrt64.9%
*-commutative64.9%
add-sqr-sqrt26.3%
sqrt-unprod60.6%
sqr-neg60.6%
sqrt-unprod38.9%
add-sqr-sqrt65.3%
Applied egg-rr65.3%
Taylor expanded in x around inf 65.3%
mul-1-neg65.3%
*-commutative65.3%
associate-*r/65.8%
distribute-rgt-neg-in65.8%
Simplified65.8%
if 2.40000000000000014e-219 < z < 3.9e-54Initial program 99.8%
Taylor expanded in x around -inf 87.3%
mul-1-neg87.3%
*-commutative87.3%
distribute-rgt-neg-in87.3%
Simplified87.3%
Taylor expanded in y around -inf 58.5%
Taylor expanded in z around 0 58.5%
if 3.9e-54 < z Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 94.3%
neg-mul-194.3%
Simplified94.3%
Final simplification78.2%
(FPCore (x y z) :precision binary64 (if (<= z 4.2e-219) (* x (- 0.5 (* z (/ y x)))) (if (<= z 5.1e-54) (* y (+ 1.0 (log z))) (- (* x 0.5) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 4.2e-219) {
tmp = x * (0.5 - (z * (y / x)));
} else if (z <= 5.1e-54) {
tmp = y * (1.0 + log(z));
} 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 <= 4.2d-219) then
tmp = x * (0.5d0 - (z * (y / x)))
else if (z <= 5.1d-54) then
tmp = y * (1.0d0 + log(z))
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 <= 4.2e-219) {
tmp = x * (0.5 - (z * (y / x)));
} else if (z <= 5.1e-54) {
tmp = y * (1.0 + Math.log(z));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 4.2e-219: tmp = x * (0.5 - (z * (y / x))) elif z <= 5.1e-54: tmp = y * (1.0 + math.log(z)) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 4.2e-219) tmp = Float64(x * Float64(0.5 - Float64(z * Float64(y / x)))); elseif (z <= 5.1e-54) tmp = Float64(y * Float64(1.0 + log(z))); 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 <= 4.2e-219) tmp = x * (0.5 - (z * (y / x))); elseif (z <= 5.1e-54) tmp = y * (1.0 + log(z)); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 4.2e-219], N[(x * N[(0.5 - N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.1e-54], N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.2 \cdot 10^{-219}:\\
\;\;\;\;x \cdot \left(0.5 - z \cdot \frac{y}{x}\right)\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-54}:\\
\;\;\;\;y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 4.20000000000000001e-219Initial program 99.9%
Taylor expanded in z around inf 65.3%
associate-*r*65.3%
neg-mul-165.3%
Simplified65.3%
distribute-lft-neg-out65.3%
unsub-neg65.3%
add-sqr-sqrt38.9%
sqrt-unprod60.6%
sqr-neg60.6%
sqrt-unprod26.3%
add-sqr-sqrt64.9%
*-commutative64.9%
add-sqr-sqrt26.3%
sqrt-unprod60.6%
sqr-neg60.6%
sqrt-unprod38.9%
add-sqr-sqrt65.3%
Applied egg-rr65.3%
Taylor expanded in x around inf 65.3%
mul-1-neg65.3%
*-commutative65.3%
associate-*r/65.8%
distribute-rgt-neg-in65.8%
Simplified65.8%
if 4.20000000000000001e-219 < z < 5.1000000000000001e-54Initial program 99.8%
Taylor expanded in x around -inf 87.3%
mul-1-neg87.3%
*-commutative87.3%
distribute-rgt-neg-in87.3%
Simplified87.3%
Taylor expanded in y around -inf 58.5%
Taylor expanded in z around 0 58.5%
if 5.1000000000000001e-54 < z Initial program 100.0%
Taylor expanded in z around inf 94.3%
associate-*r*94.3%
neg-mul-194.3%
Simplified94.3%
distribute-lft-neg-out94.3%
unsub-neg94.3%
add-sqr-sqrt42.0%
sqrt-unprod56.2%
sqr-neg56.2%
sqrt-unprod18.4%
add-sqr-sqrt33.4%
*-commutative33.4%
add-sqr-sqrt18.4%
sqrt-unprod56.2%
sqr-neg56.2%
sqrt-unprod42.0%
add-sqr-sqrt94.3%
Applied egg-rr94.3%
Final simplification78.1%
(FPCore (x y z) :precision binary64 (if (<= z 2.35e-5) (+ (* x 0.5) (* y (+ 1.0 (log z)))) (fma y (- z) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.35e-5) {
tmp = (x * 0.5) + (y * (1.0 + log(z)));
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 2.35e-5) tmp = Float64(Float64(x * 0.5) + Float64(y * Float64(1.0 + log(z)))); else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 2.35e-5], N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * (-z) + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.35 \cdot 10^{-5}:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 2.34999999999999986e-5Initial program 99.9%
Taylor expanded in z around 0 99.4%
*-commutative99.4%
Simplified99.4%
if 2.34999999999999986e-5 < z Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 98.8%
neg-mul-198.8%
Simplified98.8%
Final simplification99.1%
(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%
(FPCore (x y z) :precision binary64 (if (<= z 2.1e+24) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.1e+24) {
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 <= 2.1d+24) 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 <= 2.1e+24) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.1e+24: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.1e+24) 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 <= 2.1e+24) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.1e+24], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.1 \cdot 10^{+24}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 2.1000000000000001e24Initial program 99.9%
Taylor expanded in z around inf 55.6%
associate-*r*55.6%
neg-mul-155.6%
Simplified55.6%
Taylor expanded in x around inf 52.6%
if 2.1000000000000001e24 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around inf 89.1%
mul-1-neg89.1%
unsub-neg89.1%
associate-/l*84.3%
Simplified84.3%
Taylor expanded in x around 0 73.5%
associate-*r*73.5%
neg-mul-173.5%
Simplified73.5%
Final simplification61.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 73.5%
associate-*r*73.5%
neg-mul-173.5%
Simplified73.5%
distribute-lft-neg-out73.5%
unsub-neg73.5%
add-sqr-sqrt35.5%
sqrt-unprod52.1%
sqr-neg52.1%
sqrt-unprod20.2%
add-sqr-sqrt41.6%
*-commutative41.6%
add-sqr-sqrt20.2%
sqrt-unprod52.1%
sqr-neg52.1%
sqrt-unprod35.5%
add-sqr-sqrt73.5%
Applied egg-rr73.5%
Final simplification73.5%
(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 z around inf 73.5%
associate-*r*73.5%
neg-mul-173.5%
Simplified73.5%
Taylor expanded in x around inf 42.7%
Final simplification42.7%
(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 2024133
(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)))))