
(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 (+ (* 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%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.2e+101) (not (<= y 3.2e-145))) (* y (- (+ 1.0 (log z)) z)) (fma y (- z) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e+101) || !(y <= 3.2e-145)) {
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 ((y <= -7.2e+101) || !(y <= 3.2e-145)) 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[Or[LessEqual[y, -7.2e+101], N[Not[LessEqual[y, 3.2e-145]], $MachinePrecision]], 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}\;y \leq -7.2 \cdot 10^{+101} \lor \neg \left(y \leq 3.2 \cdot 10^{-145}\right):\\
\;\;\;\;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 y < -7.20000000000000058e101 or 3.20000000000000008e-145 < y Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
distribute-lft-in99.2%
associate-+r+99.2%
*-commutative99.2%
fma-def99.2%
*-commutative99.2%
Applied egg-rr99.2%
Taylor expanded in y around inf 87.0%
if -7.20000000000000058e101 < y < 3.20000000000000008e-145Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 88.5%
mul-1-neg88.5%
Simplified88.5%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (<= z 0.0038) (+ (* 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 <= 0.0038) {
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 <= 0.0038) 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, 0.0038], 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 0.0038:\\
\;\;\;\;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 < 0.00379999999999999999Initial program 99.8%
Taylor expanded in z around 0 99.7%
if 0.00379999999999999999 < z Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around inf 99.8%
mul-1-neg99.8%
Simplified99.8%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (<= z 0.0038) (+ (+ (* x 0.5) y) (* y (log z))) (fma y (- z) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.0038) {
tmp = ((x * 0.5) + y) + (y * log(z));
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 0.0038) tmp = Float64(Float64(Float64(x * 0.5) + y) + Float64(y * log(z))); else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 0.0038], N[(N[(N[(x * 0.5), $MachinePrecision] + y), $MachinePrecision] + N[(y * 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 0.0038:\\
\;\;\;\;\left(x \cdot 0.5 + y\right) + y \cdot \log z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 0.00379999999999999999Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
distribute-lft-in99.8%
associate-+r+99.9%
*-commutative99.9%
fma-def99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 99.8%
if 0.00379999999999999999 < z Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around inf 99.8%
mul-1-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z 1.18e-268) (- (* x 0.5) (* y z)) (if (<= z 4.1e-17) (+ y (* y (log z))) (fma y (- z) (* x 0.5)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.18e-268) {
tmp = (x * 0.5) - (y * z);
} else if (z <= 4.1e-17) {
tmp = y + (y * log(z));
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 1.18e-268) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); elseif (z <= 4.1e-17) tmp = Float64(y + Float64(y * log(z))); else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 1.18e-268], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.1e-17], N[(y + N[(y * 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 1.18 \cdot 10^{-268}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-17}:\\
\;\;\;\;y + y \cdot \log z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 1.18e-268Initial program 99.9%
Taylor expanded in z around inf 71.2%
mul-1-neg71.2%
*-commutative71.2%
distribute-rgt-neg-in71.2%
Simplified71.2%
*-commutative71.2%
distribute-rgt-neg-out71.2%
distribute-lft-neg-in71.2%
add-sqr-sqrt39.8%
sqrt-unprod64.0%
sqr-neg64.0%
sqrt-unprod31.4%
add-sqr-sqrt70.8%
cancel-sign-sub-inv70.8%
*-commutative70.8%
*-commutative70.8%
add-sqr-sqrt31.4%
sqrt-unprod64.0%
sqr-neg64.0%
sqrt-unprod39.8%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
if 1.18e-268 < z < 4.1000000000000001e-17Initial program 99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
fma-udef99.8%
+-commutative99.8%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
fma-def99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around 0 63.8%
if 4.1000000000000001e-17 < z Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around inf 99.0%
mul-1-neg99.0%
Simplified99.0%
Final simplification81.6%
(FPCore (x y z) :precision binary64 (if (or (<= z 1.9e-268) (not (<= z 1.32e-17))) (- (* x 0.5) (* y z)) (* y (+ 1.0 (log z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= 1.9e-268) || !(z <= 1.32e-17)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (1.0 + log(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 <= 1.9d-268) .or. (.not. (z <= 1.32d-17))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y * (1.0d0 + log(z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= 1.9e-268) || !(z <= 1.32e-17)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (1.0 + Math.log(z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= 1.9e-268) or not (z <= 1.32e-17): tmp = (x * 0.5) - (y * z) else: tmp = y * (1.0 + math.log(z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= 1.9e-268) || !(z <= 1.32e-17)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y * Float64(1.0 + log(z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= 1.9e-268) || ~((z <= 1.32e-17))) tmp = (x * 0.5) - (y * z); else tmp = y * (1.0 + log(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, 1.9e-268], N[Not[LessEqual[z, 1.32e-17]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.9 \cdot 10^{-268} \lor \neg \left(z \leq 1.32 \cdot 10^{-17}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \log z\right)\\
\end{array}
\end{array}
if z < 1.9000000000000001e-268 or 1.3200000000000001e-17 < z Initial program 100.0%
Taylor expanded in z around inf 95.9%
mul-1-neg95.9%
*-commutative95.9%
distribute-rgt-neg-in95.9%
Simplified95.9%
*-commutative95.9%
distribute-rgt-neg-out95.9%
distribute-lft-neg-in95.9%
add-sqr-sqrt42.4%
sqrt-unprod51.6%
sqr-neg51.6%
sqrt-unprod18.3%
add-sqr-sqrt30.4%
cancel-sign-sub-inv30.4%
*-commutative30.4%
*-commutative30.4%
add-sqr-sqrt18.3%
sqrt-unprod51.6%
sqr-neg51.6%
sqrt-unprod42.4%
add-sqr-sqrt95.9%
Applied egg-rr95.9%
if 1.9000000000000001e-268 < z < 1.3200000000000001e-17Initial program 99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
fma-udef99.8%
+-commutative99.8%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
fma-def99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 63.7%
Taylor expanded in z around 0 63.7%
Final simplification81.5%
(FPCore (x y z) :precision binary64 (if (or (<= z 8.6e-269) (not (<= z 1.5e-16))) (- (* x 0.5) (* y z)) (+ y (* y (log z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= 8.6e-269) || !(z <= 1.5e-16)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * log(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 <= 8.6d-269) .or. (.not. (z <= 1.5d-16))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y + (y * log(z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= 8.6e-269) || !(z <= 1.5e-16)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * Math.log(z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= 8.6e-269) or not (z <= 1.5e-16): tmp = (x * 0.5) - (y * z) else: tmp = y + (y * math.log(z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= 8.6e-269) || !(z <= 1.5e-16)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y + Float64(y * log(z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= 8.6e-269) || ~((z <= 1.5e-16))) tmp = (x * 0.5) - (y * z); else tmp = y + (y * log(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, 8.6e-269], N[Not[LessEqual[z, 1.5e-16]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.6 \cdot 10^{-269} \lor \neg \left(z \leq 1.5 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \log z\\
\end{array}
\end{array}
if z < 8.59999999999999977e-269 or 1.49999999999999997e-16 < z Initial program 100.0%
Taylor expanded in z around inf 95.9%
mul-1-neg95.9%
*-commutative95.9%
distribute-rgt-neg-in95.9%
Simplified95.9%
*-commutative95.9%
distribute-rgt-neg-out95.9%
distribute-lft-neg-in95.9%
add-sqr-sqrt42.4%
sqrt-unprod51.6%
sqr-neg51.6%
sqrt-unprod18.3%
add-sqr-sqrt30.4%
cancel-sign-sub-inv30.4%
*-commutative30.4%
*-commutative30.4%
add-sqr-sqrt18.3%
sqrt-unprod51.6%
sqr-neg51.6%
sqrt-unprod42.4%
add-sqr-sqrt95.9%
Applied egg-rr95.9%
if 8.59999999999999977e-269 < z < 1.49999999999999997e-16Initial program 99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
fma-udef99.8%
+-commutative99.8%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
fma-def99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around 0 63.8%
Final simplification81.6%
(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 70.4%
mul-1-neg70.4%
*-commutative70.4%
distribute-rgt-neg-in70.4%
Simplified70.4%
*-commutative70.4%
distribute-rgt-neg-out70.4%
distribute-lft-neg-in70.4%
add-sqr-sqrt30.8%
sqrt-unprod43.4%
sqr-neg43.4%
sqrt-unprod19.9%
add-sqr-sqrt33.4%
cancel-sign-sub-inv33.4%
*-commutative33.4%
*-commutative33.4%
add-sqr-sqrt19.9%
sqrt-unprod43.4%
sqr-neg43.4%
sqrt-unprod30.8%
add-sqr-sqrt70.4%
Applied egg-rr70.4%
Final simplification70.4%
(FPCore (x y z) :precision binary64 (if (<= z 4.9e+33) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 4.9e+33) {
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 <= 4.9d+33) 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 <= 4.9e+33) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 4.9e+33: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 4.9e+33) 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 <= 4.9e+33) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 4.9e+33], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.9 \cdot 10^{+33}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 4.90000000000000014e33Initial program 99.8%
Taylor expanded in x around inf 44.6%
if 4.90000000000000014e33 < z Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
fma-udef100.0%
+-commutative100.0%
distribute-lft-in99.1%
associate-+r+99.1%
*-commutative99.1%
fma-def99.1%
*-commutative99.1%
Applied egg-rr99.1%
Taylor expanded in z around inf 80.9%
mul-1-neg80.9%
distribute-rgt-neg-out80.9%
Simplified80.9%
Final simplification60.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 34.6%
Final simplification34.6%
(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 2023318
(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)))))