
(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 10 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.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (log z)))))
(if (<= z 7.8e-212)
t_0
(if (<= z 2.35e-188)
(* x 0.5)
(if (or (<= z 2.6e-131) (and (not (<= z 1.95e-53)) (<= z 7e-42)))
t_0
(- (* x 0.5) (* y z)))))))
double code(double x, double y, double z) {
double t_0 = y * (1.0 + log(z));
double tmp;
if (z <= 7.8e-212) {
tmp = t_0;
} else if (z <= 2.35e-188) {
tmp = x * 0.5;
} else if ((z <= 2.6e-131) || (!(z <= 1.95e-53) && (z <= 7e-42))) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = y * (1.0d0 + log(z))
if (z <= 7.8d-212) then
tmp = t_0
else if (z <= 2.35d-188) then
tmp = x * 0.5d0
else if ((z <= 2.6d-131) .or. (.not. (z <= 1.95d-53)) .and. (z <= 7d-42)) then
tmp = t_0
else
tmp = (x * 0.5d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (1.0 + Math.log(z));
double tmp;
if (z <= 7.8e-212) {
tmp = t_0;
} else if (z <= 2.35e-188) {
tmp = x * 0.5;
} else if ((z <= 2.6e-131) || (!(z <= 1.95e-53) && (z <= 7e-42))) {
tmp = t_0;
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): t_0 = y * (1.0 + math.log(z)) tmp = 0 if z <= 7.8e-212: tmp = t_0 elif z <= 2.35e-188: tmp = x * 0.5 elif (z <= 2.6e-131) or (not (z <= 1.95e-53) and (z <= 7e-42)): tmp = t_0 else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) t_0 = Float64(y * Float64(1.0 + log(z))) tmp = 0.0 if (z <= 7.8e-212) tmp = t_0; elseif (z <= 2.35e-188) tmp = Float64(x * 0.5); elseif ((z <= 2.6e-131) || (!(z <= 1.95e-53) && (z <= 7e-42))) tmp = t_0; else tmp = Float64(Float64(x * 0.5) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (1.0 + log(z)); tmp = 0.0; if (z <= 7.8e-212) tmp = t_0; elseif (z <= 2.35e-188) tmp = x * 0.5; elseif ((z <= 2.6e-131) || (~((z <= 1.95e-53)) && (z <= 7e-42))) tmp = t_0; else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 7.8e-212], t$95$0, If[LessEqual[z, 2.35e-188], N[(x * 0.5), $MachinePrecision], If[Or[LessEqual[z, 2.6e-131], And[N[Not[LessEqual[z, 1.95e-53]], $MachinePrecision], LessEqual[z, 7e-42]]], t$95$0, N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + \log z\right)\\
\mathbf{if}\;z \leq 7.8 \cdot 10^{-212}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-188}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-131} \lor \neg \left(z \leq 1.95 \cdot 10^{-53}\right) \land z \leq 7 \cdot 10^{-42}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 7.8e-212 or 2.34999999999999999e-188 < z < 2.59999999999999996e-131 or 1.9500000000000001e-53 < z < 7.0000000000000004e-42Initial program 99.6%
Taylor expanded in z around 0 99.6%
Taylor expanded in x around 0 68.4%
if 7.8e-212 < z < 2.34999999999999999e-188Initial program 99.8%
Taylor expanded in x around inf 86.4%
if 2.59999999999999996e-131 < z < 1.9500000000000001e-53 or 7.0000000000000004e-42 < z Initial program 99.9%
Taylor expanded in z around inf 87.7%
associate-*r*87.7%
neg-mul-187.7%
Simplified87.7%
Final simplification82.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.4e+49) (not (<= y 8.5e+56))) (* y (+ (- 1.0 z) (log z))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.4e+49) || !(y <= 8.5e+56)) {
tmp = y * ((1.0 - z) + 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 ((y <= (-1.4d+49)) .or. (.not. (y <= 8.5d+56))) then
tmp = y * ((1.0d0 - z) + 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 ((y <= -1.4e+49) || !(y <= 8.5e+56)) {
tmp = y * ((1.0 - z) + Math.log(z));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.4e+49) or not (y <= 8.5e+56): tmp = y * ((1.0 - z) + math.log(z)) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.4e+49) || !(y <= 8.5e+56)) tmp = Float64(y * Float64(Float64(1.0 - z) + 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 ((y <= -1.4e+49) || ~((y <= 8.5e+56))) tmp = y * ((1.0 - z) + log(z)); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.4e+49], N[Not[LessEqual[y, 8.5e+56]], $MachinePrecision]], N[(y * N[(N[(1.0 - z), $MachinePrecision] + 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}\;y \leq -1.4 \cdot 10^{+49} \lor \neg \left(y \leq 8.5 \cdot 10^{+56}\right):\\
\;\;\;\;y \cdot \left(\left(1 - z\right) + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if y < -1.3999999999999999e49 or 8.4999999999999998e56 < y Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
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%
expm1-log1p-u97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 91.0%
*-commutative91.0%
cancel-sign-sub-inv91.0%
*-lft-identity91.0%
distribute-rgt-in91.0%
+-commutative91.0%
sub-neg91.0%
+-commutative91.0%
distribute-neg-in91.0%
remove-double-neg91.0%
associate-+r+91.0%
+-commutative91.0%
sub-neg91.0%
Simplified91.0%
if -1.3999999999999999e49 < y < 8.4999999999999998e56Initial program 99.9%
Taylor expanded in z around inf 86.1%
associate-*r*86.1%
neg-mul-186.1%
Simplified86.1%
Final simplification88.0%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (+ (* x 0.5) (* y (+ 1.0 (log z)))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (x * 0.5) + (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 <= 0.28d0) then
tmp = (x * 0.5d0) + (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 <= 0.28) {
tmp = (x * 0.5) + (y * (1.0 + Math.log(z)));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.28: tmp = (x * 0.5) + (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 <= 0.28) tmp = Float64(Float64(x * 0.5) + 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 <= 0.28) tmp = (x * 0.5) + (y * (1.0 + log(z))); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.28], N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $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:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 0.28000000000000003Initial program 99.7%
Taylor expanded in z around 0 99.2%
if 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around inf 97.4%
associate-*r*97.4%
neg-mul-197.4%
Simplified97.4%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (+ (* x 0.5) (+ y (* y (log z)))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (x * 0.5) + (y + (y * 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 <= 0.28d0) then
tmp = (x * 0.5d0) + (y + (y * 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 <= 0.28) {
tmp = (x * 0.5) + (y + (y * Math.log(z)));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.28: tmp = (x * 0.5) + (y + (y * math.log(z))) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.28) tmp = Float64(Float64(x * 0.5) + Float64(y + Float64(y * 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 <= 0.28) tmp = (x * 0.5) + (y + (y * log(z))); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.28], N[(N[(x * 0.5), $MachinePrecision] + N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $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:\\
\;\;\;\;x \cdot 0.5 + \left(y + y \cdot \log z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 0.28000000000000003Initial program 99.7%
Taylor expanded in z around 0 99.2%
distribute-lft-in99.2%
*-rgt-identity99.2%
Simplified99.2%
if 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around inf 97.4%
associate-*r*97.4%
neg-mul-197.4%
Simplified97.4%
Final simplification98.3%
(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.8%
Final simplification99.8%
(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.8%
Taylor expanded in z around inf 72.0%
associate-*r*72.0%
neg-mul-172.0%
Simplified72.0%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (<= z 2.5e+47) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.5e+47) {
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.5d+47) 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.5e+47) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.5e+47: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.5e+47) 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.5e+47) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.5e+47], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.5 \cdot 10^{+47}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 2.50000000000000011e47Initial program 99.7%
Taylor expanded in x around inf 49.7%
if 2.50000000000000011e47 < z Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
fma-udef100.0%
+-commutative100.0%
distribute-lft-in100.0%
associate-+r+100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 76.1%
mul-1-neg76.1%
distribute-rgt-neg-in76.1%
Simplified76.1%
Final simplification59.8%
(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.8%
Taylor expanded in x around inf 40.4%
Final simplification40.4%
(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.8%
sub-neg99.8%
associate-+l+99.8%
distribute-rgt-in99.8%
*-lft-identity99.8%
associate-+r+99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
distribute-lft-neg-out99.8%
unsub-neg99.8%
fma-def99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 70.9%
Taylor expanded in y around inf 33.0%
Taylor expanded in z around 0 2.0%
Final simplification2.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 2023290
(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)))))