
(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 (+ 1.0 (- (log z) z)) y (* x 0.5)))
double code(double x, double y, double z) {
return fma((1.0 + (log(z) - z)), y, (x * 0.5));
}
function code(x, y, z) return fma(Float64(1.0 + Float64(log(z) - z)), y, Float64(x * 0.5)) end
code[x_, y_, z_] := N[(N[(1.0 + N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 + \left(\log z - z\right), y, x \cdot 0.5\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
fma-def99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
sub-neg99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z 2.4e-237) (and (not (<= z 1.55e-124)) (<= z 1.9e-8))) (* y (+ (log z) 1.0)) (- (* x 0.5) (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= 2.4e-237) || (!(z <= 1.55e-124) && (z <= 1.9e-8))) {
tmp = y * (log(z) + 1.0);
} else {
tmp = (x * 0.5) - (z * y);
}
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.4d-237) .or. (.not. (z <= 1.55d-124)) .and. (z <= 1.9d-8)) then
tmp = y * (log(z) + 1.0d0)
else
tmp = (x * 0.5d0) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= 2.4e-237) || (!(z <= 1.55e-124) && (z <= 1.9e-8))) {
tmp = y * (Math.log(z) + 1.0);
} else {
tmp = (x * 0.5) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= 2.4e-237) or (not (z <= 1.55e-124) and (z <= 1.9e-8)): tmp = y * (math.log(z) + 1.0) else: tmp = (x * 0.5) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= 2.4e-237) || (!(z <= 1.55e-124) && (z <= 1.9e-8))) tmp = Float64(y * Float64(log(z) + 1.0)); else tmp = Float64(Float64(x * 0.5) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= 2.4e-237) || (~((z <= 1.55e-124)) && (z <= 1.9e-8))) tmp = y * (log(z) + 1.0); else tmp = (x * 0.5) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, 2.4e-237], And[N[Not[LessEqual[z, 1.55e-124]], $MachinePrecision], LessEqual[z, 1.9e-8]]], N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.4 \cdot 10^{-237} \lor \neg \left(z \leq 1.55 \cdot 10^{-124}\right) \land z \leq 1.9 \cdot 10^{-8}:\\
\;\;\;\;y \cdot \left(\log z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\end{array}
\end{array}
if z < 2.4e-237 or 1.5499999999999999e-124 < z < 1.90000000000000014e-8Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
distribute-lft-in99.5%
*-rgt-identity99.5%
associate-+r+99.5%
fma-def99.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in z around 0 98.9%
Taylor expanded in y around inf 64.0%
if 2.4e-237 < z < 1.5499999999999999e-124 or 1.90000000000000014e-8 < z Initial program 99.9%
Taylor expanded in z around 0 98.9%
Taylor expanded in z around inf 88.5%
associate-*r*88.5%
mul-1-neg88.5%
Simplified88.5%
Taylor expanded in x around 0 88.5%
fma-def88.5%
mul-1-neg88.5%
fma-neg88.5%
Simplified88.5%
Final simplification82.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.05e+65) (not (<= y 9.2e+57))) (+ y (* y (- (log z) z))) (- (* x 0.5) (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.05e+65) || !(y <= 9.2e+57)) {
tmp = y + (y * (log(z) - z));
} else {
tmp = (x * 0.5) - (z * y);
}
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.05d+65)) .or. (.not. (y <= 9.2d+57))) then
tmp = y + (y * (log(z) - z))
else
tmp = (x * 0.5d0) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.05e+65) || !(y <= 9.2e+57)) {
tmp = y + (y * (Math.log(z) - z));
} else {
tmp = (x * 0.5) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.05e+65) or not (y <= 9.2e+57): tmp = y + (y * (math.log(z) - z)) else: tmp = (x * 0.5) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.05e+65) || !(y <= 9.2e+57)) tmp = Float64(y + Float64(y * Float64(log(z) - z))); else tmp = Float64(Float64(x * 0.5) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.05e+65) || ~((y <= 9.2e+57))) tmp = y + (y * (log(z) - z)); else tmp = (x * 0.5) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.05e+65], N[Not[LessEqual[y, 9.2e+57]], $MachinePrecision]], N[(y + N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{+65} \lor \neg \left(y \leq 9.2 \cdot 10^{+57}\right):\\
\;\;\;\;y + y \cdot \left(\log z - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\end{array}
\end{array}
if y < -2.0500000000000001e65 or 9.1999999999999995e57 < y Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-lft-in99.7%
*-rgt-identity99.7%
associate-+r+99.7%
fma-def99.7%
+-commutative99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in x around 0 93.8%
if -2.0500000000000001e65 < y < 9.1999999999999995e57Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in z around inf 90.9%
associate-*r*90.9%
mul-1-neg90.9%
Simplified90.9%
Taylor expanded in x around 0 90.9%
fma-def90.9%
mul-1-neg90.9%
fma-neg90.9%
Simplified90.9%
Final simplification92.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (log z) z)))
(if (<= y -1.02e+65)
(* y (+ 1.0 t_0))
(if (<= y 1.9e+62) (- (* x 0.5) (* z y)) (+ y (* y t_0))))))
double code(double x, double y, double z) {
double t_0 = log(z) - z;
double tmp;
if (y <= -1.02e+65) {
tmp = y * (1.0 + t_0);
} else if (y <= 1.9e+62) {
tmp = (x * 0.5) - (z * y);
} else {
tmp = y + (y * 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 = log(z) - z
if (y <= (-1.02d+65)) then
tmp = y * (1.0d0 + t_0)
else if (y <= 1.9d+62) then
tmp = (x * 0.5d0) - (z * y)
else
tmp = y + (y * t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.log(z) - z;
double tmp;
if (y <= -1.02e+65) {
tmp = y * (1.0 + t_0);
} else if (y <= 1.9e+62) {
tmp = (x * 0.5) - (z * y);
} else {
tmp = y + (y * t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.log(z) - z tmp = 0 if y <= -1.02e+65: tmp = y * (1.0 + t_0) elif y <= 1.9e+62: tmp = (x * 0.5) - (z * y) else: tmp = y + (y * t_0) return tmp
function code(x, y, z) t_0 = Float64(log(z) - z) tmp = 0.0 if (y <= -1.02e+65) tmp = Float64(y * Float64(1.0 + t_0)); elseif (y <= 1.9e+62) tmp = Float64(Float64(x * 0.5) - Float64(z * y)); else tmp = Float64(y + Float64(y * t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = log(z) - z; tmp = 0.0; if (y <= -1.02e+65) tmp = y * (1.0 + t_0); elseif (y <= 1.9e+62) tmp = (x * 0.5) - (z * y); else tmp = y + (y * t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[y, -1.02e+65], N[(y * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+62], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log z - z\\
\mathbf{if}\;y \leq -1.02 \cdot 10^{+65}:\\
\;\;\;\;y \cdot \left(1 + t_0\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+62}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot t_0\\
\end{array}
\end{array}
if y < -1.02000000000000005e65Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
distribute-lft-in99.6%
*-rgt-identity99.6%
associate-+r+99.6%
fma-def99.6%
+-commutative99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in y around -inf 92.6%
mul-1-neg92.6%
distribute-rgt-neg-in92.6%
sub-neg92.6%
mul-1-neg92.6%
sub-neg92.6%
+-commutative92.6%
distribute-neg-in92.6%
remove-double-neg92.6%
sub-neg92.6%
metadata-eval92.6%
+-commutative92.6%
Simplified92.6%
if -1.02000000000000005e65 < y < 1.89999999999999992e62Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in z around inf 90.9%
associate-*r*90.9%
mul-1-neg90.9%
Simplified90.9%
Taylor expanded in x around 0 90.9%
fma-def90.9%
mul-1-neg90.9%
fma-neg90.9%
Simplified90.9%
if 1.89999999999999992e62 < y Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-lft-in99.7%
*-rgt-identity99.7%
associate-+r+99.7%
fma-def99.7%
+-commutative99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in x around 0 94.9%
Final simplification92.2%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (+ (* (log z) y) (+ y (* x 0.5))) (- (* x 0.5) (* z y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (log(z) * y) + (y + (x * 0.5));
} else {
tmp = (x * 0.5) - (z * y);
}
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 = (log(z) * y) + (y + (x * 0.5d0))
else
tmp = (x * 0.5d0) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (Math.log(z) * y) + (y + (x * 0.5));
} else {
tmp = (x * 0.5) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.28: tmp = (math.log(z) * y) + (y + (x * 0.5)) else: tmp = (x * 0.5) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.28) tmp = Float64(Float64(log(z) * y) + Float64(y + Float64(x * 0.5))); else tmp = Float64(Float64(x * 0.5) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 0.28) tmp = (log(z) * y) + (y + (x * 0.5)); else tmp = (x * 0.5) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.28], N[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] + N[(y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.28:\\
\;\;\;\;\log z \cdot y + \left(y + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\end{array}
\end{array}
if z < 0.28000000000000003Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-lft-in99.6%
*-rgt-identity99.6%
associate-+r+99.6%
fma-def99.6%
+-commutative99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in z around 0 98.8%
if 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around 0 98.5%
Taylor expanded in z around inf 99.6%
associate-*r*99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in x around 0 99.6%
fma-def99.6%
mul-1-neg99.6%
fma-neg99.6%
Simplified99.6%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (- (* x 0.5) (* y (- (+ z -1.0) (log z)))))
double code(double x, double y, double z) {
return (x * 0.5) - (y * ((z + -1.0) - 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 * ((z + (-1.0d0)) - log(z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) - (y * ((z + -1.0) - Math.log(z)));
}
def code(x, y, z): return (x * 0.5) - (y * ((z + -1.0) - math.log(z)))
function code(x, y, z) return Float64(Float64(x * 0.5) - Float64(y * Float64(Float64(z + -1.0) - log(z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) - (y * ((z + -1.0) - log(z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] - N[(y * N[(N[(z + -1.0), $MachinePrecision] - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 - y \cdot \left(\left(z + -1\right) - \log z\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (- (* x 0.5) (* z y)))
double code(double x, double y, double z) {
return (x * 0.5) - (z * y);
}
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) - (z * y)
end function
public static double code(double x, double y, double z) {
return (x * 0.5) - (z * y);
}
def code(x, y, z): return (x * 0.5) - (z * y)
function code(x, y, z) return Float64(Float64(x * 0.5) - Float64(z * y)) end
function tmp = code(x, y, z) tmp = (x * 0.5) - (z * y); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 - z \cdot y
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 99.1%
Taylor expanded in z around inf 75.7%
associate-*r*75.7%
mul-1-neg75.7%
Simplified75.7%
Taylor expanded in x around 0 75.7%
fma-def75.7%
mul-1-neg75.7%
fma-neg75.7%
Simplified75.7%
Final simplification75.7%
(FPCore (x y z) :precision binary64 (if (<= z 1.8e+26) (* x 0.5) (* z (- y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.8e+26) {
tmp = x * 0.5;
} else {
tmp = z * -y;
}
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 <= 1.8d+26) then
tmp = x * 0.5d0
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.8e+26) {
tmp = x * 0.5;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.8e+26: tmp = x * 0.5 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.8e+26) tmp = Float64(x * 0.5); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.8e+26) tmp = x * 0.5; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.8e+26], N[(x * 0.5), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.8 \cdot 10^{+26}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 1.80000000000000012e26Initial program 99.7%
Taylor expanded in x around inf 48.4%
if 1.80000000000000012e26 < z Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
fma-def100.0%
sub-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sub-neg100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 76.8%
associate-*r*76.8%
*-commutative76.8%
neg-mul-176.8%
Simplified76.8%
Final simplification62.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 36.7%
Final simplification36.7%
(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-lft-in99.8%
*-rgt-identity99.8%
associate-+r+99.8%
fma-def99.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
add-cube-cbrt99.0%
pow399.0%
Applied egg-rr99.0%
Taylor expanded in y around inf 1.7%
Final simplification1.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 2023252
(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)))))