
(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 (- (log z) z)) (* x 0.5)))
double code(double x, double y, double z) {
return fma(y, (1.0 + (log(z) - z)), (x * 0.5));
}
function code(x, y, z) return fma(y, Float64(1.0 + Float64(log(z) - z)), Float64(x * 0.5)) end
code[x_, y_, z_] := N[(y * N[(1.0 + N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 1 + \left(\log z - z\right), x \cdot 0.5\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -1e-111) (not (<= (* x 0.5) 2e-85))) (- (* x 0.5) (* y z)) (* y (+ 1.0 (- (log z) z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -1e-111) || !((x * 0.5) <= 2e-85)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (1.0 + (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) <= (-1d-111)) .or. (.not. ((x * 0.5d0) <= 2d-85))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y * (1.0d0 + (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) <= -1e-111) || !((x * 0.5) <= 2e-85)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (1.0 + (Math.log(z) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -1e-111) or not ((x * 0.5) <= 2e-85): tmp = (x * 0.5) - (y * z) else: tmp = y * (1.0 + (math.log(z) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -1e-111) || !(Float64(x * 0.5) <= 2e-85)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y * Float64(1.0 + Float64(log(z) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -1e-111) || ~(((x * 0.5) <= 2e-85))) tmp = (x * 0.5) - (y * z); else tmp = y * (1.0 + (log(z) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -1e-111], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 2e-85]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 + N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -1 \cdot 10^{-111} \lor \neg \left(x \cdot 0.5 \leq 2 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \left(\log z - z\right)\right)\\
\end{array}
\end{array}
if (*.f64 x #s(literal 1/2 binary64)) < -1.00000000000000009e-111 or 2e-85 < (*.f64 x #s(literal 1/2 binary64)) Initial program 99.9%
Taylor expanded in z around inf 87.2%
associate-*r*87.2%
mul-1-neg87.2%
Simplified87.2%
fma-define87.2%
distribute-lft-neg-out87.2%
fmm-undef87.2%
add-sqr-sqrt48.4%
sqrt-unprod70.5%
sqr-neg70.5%
sqrt-unprod24.7%
add-sqr-sqrt56.9%
*-commutative56.9%
add-sqr-sqrt24.7%
sqrt-unprod70.5%
sqr-neg70.5%
sqrt-unprod48.4%
add-sqr-sqrt87.2%
Applied egg-rr87.2%
if -1.00000000000000009e-111 < (*.f64 x #s(literal 1/2 binary64)) < 2e-85Initial program 99.8%
+-commutative99.8%
fma-define99.8%
sub-neg99.8%
associate-+l+99.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
associate-+r-99.8%
+-commutative99.8%
associate-+r-99.8%
+-commutative99.8%
fma-define99.8%
+-commutative99.8%
distribute-rgt-in99.8%
associate-+r+99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 93.3%
associate-+r-93.3%
+-commutative93.3%
Applied egg-rr93.3%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (+ (* y (log z)) (+ y (* 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)) + (y + (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)) + (y + (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)) + (y + (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)) + (y + (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 * log(z)) + Float64(y + 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)) + (y + (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[Log[z], $MachinePrecision]), $MachinePrecision] + N[(y + N[(x * 0.5), $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:\\
\;\;\;\;y \cdot \log z + \left(y + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 0.28000000000000003Initial program 99.8%
+-commutative99.8%
fma-define99.8%
sub-neg99.8%
associate-+l+99.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
associate-+r-99.8%
+-commutative99.8%
associate-+r-99.8%
+-commutative99.8%
fma-define99.8%
+-commutative99.8%
distribute-rgt-in99.8%
associate-+r+99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 99.6%
if 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around inf 98.9%
associate-*r*98.9%
mul-1-neg98.9%
Simplified98.9%
fma-define98.9%
distribute-lft-neg-out98.9%
fmm-undef98.9%
add-sqr-sqrt51.5%
sqrt-unprod61.3%
sqr-neg61.3%
sqrt-unprod12.7%
add-sqr-sqrt30.2%
*-commutative30.2%
add-sqr-sqrt12.7%
sqrt-unprod61.3%
sqr-neg61.3%
sqrt-unprod51.5%
add-sqr-sqrt98.9%
Applied egg-rr98.9%
Final simplification99.2%
(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.8%
Taylor expanded in z around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around inf 98.9%
associate-*r*98.9%
mul-1-neg98.9%
Simplified98.9%
fma-define98.9%
distribute-lft-neg-out98.9%
fmm-undef98.9%
add-sqr-sqrt51.5%
sqrt-unprod61.3%
sqr-neg61.3%
sqrt-unprod12.7%
add-sqr-sqrt30.2%
*-commutative30.2%
add-sqr-sqrt12.7%
sqrt-unprod61.3%
sqr-neg61.3%
sqrt-unprod51.5%
add-sqr-sqrt98.9%
Applied egg-rr98.9%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (+ (+ (* x 0.5) (* y (- 1.0 z))) (* y (log z))))
double code(double x, double y, double z) {
return ((x * 0.5) + (y * (1.0 - z))) + (y * 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))) + (y * log(z))
end function
public static double code(double x, double y, double z) {
return ((x * 0.5) + (y * (1.0 - z))) + (y * Math.log(z));
}
def code(x, y, z): return ((x * 0.5) + (y * (1.0 - z))) + (y * math.log(z))
function code(x, y, z) return Float64(Float64(Float64(x * 0.5) + Float64(y * Float64(1.0 - z))) + Float64(y * log(z))) end
function tmp = code(x, y, z) tmp = ((x * 0.5) + (y * (1.0 - z))) + (y * log(z)); end
code[x_, y_, z_] := N[(N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 + y \cdot \left(1 - z\right)\right) + y \cdot \log z
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
associate-+r-99.9%
+-commutative99.9%
associate-+r-99.9%
+-commutative99.9%
fma-define99.9%
+-commutative99.9%
distribute-rgt-in99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (+ y (* y (- (log z) z)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y + (y * (log(z) - 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 + (y * (log(z) - z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y + (y * (Math.log(z) - z)));
}
def code(x, y, z): return (x * 0.5) + (y + (y * (math.log(z) - z)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y + Float64(y * Float64(log(z) - z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y + (y * (log(z) - z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y + N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + \left(y + y \cdot \left(\log z - z\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+r-99.9%
+-commutative99.9%
associate-+r-99.9%
+-commutative99.9%
distribute-rgt-in99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (log z) (- 1.0 z)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * (log(z) + (1.0 - 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 * (log(z) + (1.0d0 - z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * (Math.log(z) + (1.0 - z)));
}
def code(x, y, z): return (x * 0.5) + (y * (math.log(z) + (1.0 - z)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(log(z) + Float64(1.0 - z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * (log(z) + (1.0 - z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\log z + \left(1 - z\right)\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z 2.2e+95) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.2e+95) {
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.2d+95) 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.2e+95) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.2e+95: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.2e+95) 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.2e+95) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.2e+95], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.2 \cdot 10^{+95}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 2.1999999999999999e95Initial program 99.8%
Taylor expanded in x around inf 92.0%
+-commutative92.0%
associate-+r-92.0%
associate-/l*91.9%
fma-define91.9%
associate-+r-91.9%
+-commutative91.9%
associate-+r-91.9%
Simplified91.9%
Taylor expanded in y around 0 57.7%
if 2.1999999999999999e95 < z Initial program 100.0%
Taylor expanded in x around inf 93.7%
+-commutative93.7%
associate-+r-93.7%
associate-/l*80.8%
fma-define80.8%
associate-+r-80.8%
+-commutative80.8%
associate-+r-80.8%
Simplified80.8%
Taylor expanded in z around inf 76.5%
associate-*r*76.5%
clear-num76.4%
un-div-inv77.0%
*-commutative77.0%
neg-mul-177.0%
*-commutative77.0%
Applied egg-rr77.0%
Taylor expanded in x around 0 82.8%
mul-1-neg82.8%
distribute-rgt-neg-out82.8%
Simplified82.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.9%
Taylor expanded in z around inf 78.7%
associate-*r*78.7%
mul-1-neg78.7%
Simplified78.7%
fma-define78.7%
distribute-lft-neg-out78.7%
fmm-undef78.7%
add-sqr-sqrt40.9%
sqrt-unprod57.9%
sqr-neg57.9%
sqrt-unprod19.6%
add-sqr-sqrt42.9%
*-commutative42.9%
add-sqr-sqrt19.6%
sqrt-unprod57.9%
sqr-neg57.9%
sqrt-unprod40.9%
add-sqr-sqrt78.7%
Applied egg-rr78.7%
Final simplification78.7%
(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 92.6%
+-commutative92.6%
associate-+r-92.6%
associate-/l*88.0%
fma-define88.0%
associate-+r-88.0%
+-commutative88.0%
associate-+r-88.0%
Simplified88.0%
Taylor expanded in y around 0 43.9%
(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 2024170
(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)))))