
(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 (+ (* 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 (let* ((t_0 (+ (- 1.0 z) (log z))) (t_1 (- (* x 0.5) (* y z)))) (if (<= t_0 -350.0) t_1 (if (<= t_0 -278.5) (+ y (* y (log z))) t_1))))
double code(double x, double y, double z) {
double t_0 = (1.0 - z) + log(z);
double t_1 = (x * 0.5) - (y * z);
double tmp;
if (t_0 <= -350.0) {
tmp = t_1;
} else if (t_0 <= -278.5) {
tmp = y + (y * log(z));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = (1.0d0 - z) + log(z)
t_1 = (x * 0.5d0) - (y * z)
if (t_0 <= (-350.0d0)) then
tmp = t_1
else if (t_0 <= (-278.5d0)) then
tmp = y + (y * log(z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (1.0 - z) + Math.log(z);
double t_1 = (x * 0.5) - (y * z);
double tmp;
if (t_0 <= -350.0) {
tmp = t_1;
} else if (t_0 <= -278.5) {
tmp = y + (y * Math.log(z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 - z) + math.log(z) t_1 = (x * 0.5) - (y * z) tmp = 0 if t_0 <= -350.0: tmp = t_1 elif t_0 <= -278.5: tmp = y + (y * math.log(z)) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 - z) + log(z)) t_1 = Float64(Float64(x * 0.5) - Float64(y * z)) tmp = 0.0 if (t_0 <= -350.0) tmp = t_1; elseif (t_0 <= -278.5) tmp = Float64(y + Float64(y * log(z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 - z) + log(z); t_1 = (x * 0.5) - (y * z); tmp = 0.0; if (t_0 <= -350.0) tmp = t_1; elseif (t_0 <= -278.5) tmp = y + (y * log(z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -350.0], t$95$1, If[LessEqual[t$95$0, -278.5], N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) + \log z\\
t_1 := x \cdot 0.5 - y \cdot z\\
\mathbf{if}\;t\_0 \leq -350:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -278.5:\\
\;\;\;\;y + y \cdot \log z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) < -350 or -278.5 < (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6480.2
Simplified80.2%
if -350 < (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) < -278.5Initial program 99.5%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6481.5
Simplified81.5%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
log-lowering-log.f6481.8
Applied egg-rr81.8%
Taylor expanded in z around 0
log-lowering-log.f6481.8
Simplified81.8%
Final simplification80.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (- 1.0 z) (log z))) (t_1 (- (* x 0.5) (* y z)))) (if (<= t_0 -350.0) t_1 (if (<= t_0 -278.5) (fma y (log z) y) t_1))))
double code(double x, double y, double z) {
double t_0 = (1.0 - z) + log(z);
double t_1 = (x * 0.5) - (y * z);
double tmp;
if (t_0 <= -350.0) {
tmp = t_1;
} else if (t_0 <= -278.5) {
tmp = fma(y, log(z), y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(1.0 - z) + log(z)) t_1 = Float64(Float64(x * 0.5) - Float64(y * z)) tmp = 0.0 if (t_0 <= -350.0) tmp = t_1; elseif (t_0 <= -278.5) tmp = fma(y, log(z), y); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -350.0], t$95$1, If[LessEqual[t$95$0, -278.5], N[(y * N[Log[z], $MachinePrecision] + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) + \log z\\
t_1 := x \cdot 0.5 - y \cdot z\\
\mathbf{if}\;t\_0 \leq -350:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -278.5:\\
\;\;\;\;\mathsf{fma}\left(y, \log z, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) < -350 or -278.5 < (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6480.2
Simplified80.2%
if -350 < (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) < -278.5Initial program 99.5%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6481.5
Simplified81.5%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6481.5
Simplified81.5%
Final simplification80.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (+ (- 1.0 z) (log z)))) (t_1 (- 0.0 (* y z)))) (if (<= t_0 -2e+191) t_1 (if (<= t_0 2e+47) (* x 0.5) t_1))))
double code(double x, double y, double z) {
double t_0 = y * ((1.0 - z) + log(z));
double t_1 = 0.0 - (y * z);
double tmp;
if (t_0 <= -2e+191) {
tmp = t_1;
} else if (t_0 <= 2e+47) {
tmp = x * 0.5;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = y * ((1.0d0 - z) + log(z))
t_1 = 0.0d0 - (y * z)
if (t_0 <= (-2d+191)) then
tmp = t_1
else if (t_0 <= 2d+47) then
tmp = x * 0.5d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * ((1.0 - z) + Math.log(z));
double t_1 = 0.0 - (y * z);
double tmp;
if (t_0 <= -2e+191) {
tmp = t_1;
} else if (t_0 <= 2e+47) {
tmp = x * 0.5;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y * ((1.0 - z) + math.log(z)) t_1 = 0.0 - (y * z) tmp = 0 if t_0 <= -2e+191: tmp = t_1 elif t_0 <= 2e+47: tmp = x * 0.5 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(Float64(1.0 - z) + log(z))) t_1 = Float64(0.0 - Float64(y * z)) tmp = 0.0 if (t_0 <= -2e+191) tmp = t_1; elseif (t_0 <= 2e+47) tmp = Float64(x * 0.5); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * ((1.0 - z) + log(z)); t_1 = 0.0 - (y * z); tmp = 0.0; if (t_0 <= -2e+191) tmp = t_1; elseif (t_0 <= 2e+47) tmp = x * 0.5; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+191], t$95$1, If[LessEqual[t$95$0, 2e+47], N[(x * 0.5), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\left(1 - z\right) + \log z\right)\\
t_1 := 0 - y \cdot z\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+47}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 y (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z))) < -2.00000000000000015e191 or 2.0000000000000001e47 < (*.f64 y (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z))) Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6469.1
Simplified69.1%
if -2.00000000000000015e191 < (*.f64 y (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z))) < 2.0000000000000001e47Initial program 99.9%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6464.0
Simplified64.0%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f6464.0
Applied egg-rr64.0%
(FPCore (x y z) :precision binary64 (if (<= (+ (- 1.0 z) (log z)) -200000000000.0) (fma (- 1.0 z) y (* x 0.5)) (fma x 0.5 (fma y (log z) y))))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - z) + log(z)) <= -200000000000.0) {
tmp = fma((1.0 - z), y, (x * 0.5));
} else {
tmp = fma(x, 0.5, fma(y, log(z), y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(1.0 - z) + log(z)) <= -200000000000.0) tmp = fma(Float64(1.0 - z), y, Float64(x * 0.5)); else tmp = fma(x, 0.5, fma(y, log(z), y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], -200000000000.0], N[(N[(1.0 - z), $MachinePrecision] * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(x * 0.5 + N[(y * N[Log[z], $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - z\right) + \log z \leq -200000000000:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 0.5, \mathsf{fma}\left(y, \log z, y\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) < -2e11Initial program 100.0%
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.0%
Taylor expanded in y around 0
*-lowering-*.f6499.7
Simplified99.7%
if -2e11 < (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6499.1
Simplified99.1%
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6499.1
Applied egg-rr99.1%
Final simplification99.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* x 0.5) (* y z))))
(if (<= (* x 0.5) -2e-13)
t_0
(if (<= (* x 0.5) 1e-39) (fma y (- (log z) z) y) t_0))))
double code(double x, double y, double z) {
double t_0 = (x * 0.5) - (y * z);
double tmp;
if ((x * 0.5) <= -2e-13) {
tmp = t_0;
} else if ((x * 0.5) <= 1e-39) {
tmp = fma(y, (log(z) - z), y);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x * 0.5) - Float64(y * z)) tmp = 0.0 if (Float64(x * 0.5) <= -2e-13) tmp = t_0; elseif (Float64(x * 0.5) <= 1e-39) tmp = fma(y, Float64(log(z) - z), y); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * 0.5), $MachinePrecision], -2e-13], t$95$0, If[LessEqual[N[(x * 0.5), $MachinePrecision], 1e-39], N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot 0.5 - y \cdot z\\
\mathbf{if}\;x \cdot 0.5 \leq -2 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \cdot 0.5 \leq 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(y, \log z - z, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 x #s(literal 1/2 binary64)) < -2.0000000000000001e-13 or 9.99999999999999929e-40 < (*.f64 x #s(literal 1/2 binary64)) Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6489.1
Simplified89.1%
if -2.0000000000000001e-13 < (*.f64 x #s(literal 1/2 binary64)) < 9.99999999999999929e-40Initial program 99.8%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6487.6
Simplified87.6%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (fma (- 1.0 z) y (* x 0.5)))
double code(double x, double y, double z) {
return fma((1.0 - z), y, (x * 0.5));
}
function code(x, y, z) return fma(Float64(1.0 - z), y, Float64(x * 0.5)) end
code[x_, y_, z_] := N[(N[(1.0 - z), $MachinePrecision] * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - z, y, x \cdot 0.5\right)
\end{array}
Initial program 99.9%
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f6499.9
Applied egg-rr99.9%
Taylor expanded in y around 0
*-lowering-*.f6476.2
Simplified76.2%
Final simplification76.2%
(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
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6477.1
Simplified77.1%
Final simplification77.1%
(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
+-rgt-identityN/A
accelerator-lowering-fma.f6441.8
Simplified41.8%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f6441.8
Applied egg-rr41.8%
(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 2024196
(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)))))