
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + 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 - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + 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 - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (+ x (- (fma (log y) (- -0.5 y) y) z)))
double code(double x, double y, double z) {
return x + (fma(log(y), (-0.5 - y), y) - z);
}
function code(x, y, z) return Float64(x + Float64(fma(log(y), Float64(-0.5 - y), y) - z)) end
code[x_, y_, z_] := N[(x + N[(N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\mathsf{fma}\left(\log y, -0.5 - y, y\right) - z\right)
\end{array}
Initial program 99.8%
sub-neg99.8%
sub-neg99.8%
associate-+l+99.8%
associate-+l+99.8%
sub-neg99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
neg-mul-199.8%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y 2e+60) (and (not (<= y 1.36e+160)) (<= y 3.5e+174))) (- x z) (+ x (* y (- 1.0 (log y))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= 2e+60) || (!(y <= 1.36e+160) && (y <= 3.5e+174))) {
tmp = x - z;
} else {
tmp = x + (y * (1.0 - log(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 <= 2d+60) .or. (.not. (y <= 1.36d+160)) .and. (y <= 3.5d+174)) then
tmp = x - z
else
tmp = x + (y * (1.0d0 - log(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= 2e+60) || (!(y <= 1.36e+160) && (y <= 3.5e+174))) {
tmp = x - z;
} else {
tmp = x + (y * (1.0 - Math.log(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= 2e+60) or (not (y <= 1.36e+160) and (y <= 3.5e+174)): tmp = x - z else: tmp = x + (y * (1.0 - math.log(y))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= 2e+60) || (!(y <= 1.36e+160) && (y <= 3.5e+174))) tmp = Float64(x - z); else tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= 2e+60) || (~((y <= 1.36e+160)) && (y <= 3.5e+174))) tmp = x - z; else tmp = x + (y * (1.0 - log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, 2e+60], And[N[Not[LessEqual[y, 1.36e+160]], $MachinePrecision], LessEqual[y, 3.5e+174]]], N[(x - z), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+60} \lor \neg \left(y \leq 1.36 \cdot 10^{+160}\right) \land y \leq 3.5 \cdot 10^{+174}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 1.9999999999999999e60 or 1.35999999999999997e160 < y < 3.5000000000000001e174Initial program 100.0%
add-cube-cbrt98.9%
pow298.9%
+-commutative98.9%
*-commutative98.9%
+-commutative98.9%
*-commutative98.9%
Applied egg-rr98.9%
Taylor expanded in x around inf 76.7%
if 1.9999999999999999e60 < y < 1.35999999999999997e160 or 3.5000000000000001e174 < y Initial program 99.6%
add-cbrt-cube22.1%
pow322.1%
*-commutative22.1%
Applied egg-rr22.1%
Taylor expanded in y around inf 22.1%
mul-1-neg22.1%
distribute-rgt-neg-in22.1%
log-rec22.1%
remove-double-neg22.1%
Simplified22.1%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around 0 84.9%
Final simplification80.2%
(FPCore (x y z) :precision binary64 (if (or (<= y 9e+55) (and (not (<= y 1.26e+160)) (<= y 3e+174))) (- x (+ z (* (log y) 0.5))) (+ x (* y (- 1.0 (log y))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= 9e+55) || (!(y <= 1.26e+160) && (y <= 3e+174))) {
tmp = x - (z + (log(y) * 0.5));
} else {
tmp = x + (y * (1.0 - log(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 <= 9d+55) .or. (.not. (y <= 1.26d+160)) .and. (y <= 3d+174)) then
tmp = x - (z + (log(y) * 0.5d0))
else
tmp = x + (y * (1.0d0 - log(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= 9e+55) || (!(y <= 1.26e+160) && (y <= 3e+174))) {
tmp = x - (z + (Math.log(y) * 0.5));
} else {
tmp = x + (y * (1.0 - Math.log(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= 9e+55) or (not (y <= 1.26e+160) and (y <= 3e+174)): tmp = x - (z + (math.log(y) * 0.5)) else: tmp = x + (y * (1.0 - math.log(y))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= 9e+55) || (!(y <= 1.26e+160) && (y <= 3e+174))) tmp = Float64(x - Float64(z + Float64(log(y) * 0.5))); else tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= 9e+55) || (~((y <= 1.26e+160)) && (y <= 3e+174))) tmp = x - (z + (log(y) * 0.5)); else tmp = x + (y * (1.0 - log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, 9e+55], And[N[Not[LessEqual[y, 1.26e+160]], $MachinePrecision], LessEqual[y, 3e+174]]], N[(x - N[(z + N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{+55} \lor \neg \left(y \leq 1.26 \cdot 10^{+160}\right) \land y \leq 3 \cdot 10^{+174}:\\
\;\;\;\;x - \left(z + \log y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 8.99999999999999996e55 or 1.26000000000000001e160 < y < 3e174Initial program 100.0%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 96.7%
if 8.99999999999999996e55 < y < 1.26000000000000001e160 or 3e174 < y Initial program 99.6%
add-cbrt-cube22.1%
pow322.1%
*-commutative22.1%
Applied egg-rr22.1%
Taylor expanded in y around inf 22.1%
mul-1-neg22.1%
distribute-rgt-neg-in22.1%
log-rec22.1%
remove-double-neg22.1%
Simplified22.1%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around 0 84.9%
Final simplification91.7%
(FPCore (x y z) :precision binary64 (if (or (<= y 3.6e+62) (and (not (<= y 6e+94)) (<= y 2.6e+180))) (- x z) (- y (* y (log y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= 3.6e+62) || (!(y <= 6e+94) && (y <= 2.6e+180))) {
tmp = x - z;
} else {
tmp = y - (y * log(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 <= 3.6d+62) .or. (.not. (y <= 6d+94)) .and. (y <= 2.6d+180)) then
tmp = x - z
else
tmp = y - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= 3.6e+62) || (!(y <= 6e+94) && (y <= 2.6e+180))) {
tmp = x - z;
} else {
tmp = y - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= 3.6e+62) or (not (y <= 6e+94) and (y <= 2.6e+180)): tmp = x - z else: tmp = y - (y * math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= 3.6e+62) || (!(y <= 6e+94) && (y <= 2.6e+180))) tmp = Float64(x - z); else tmp = Float64(y - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= 3.6e+62) || (~((y <= 6e+94)) && (y <= 2.6e+180))) tmp = x - z; else tmp = y - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, 3.6e+62], And[N[Not[LessEqual[y, 6e+94]], $MachinePrecision], LessEqual[y, 2.6e+180]]], N[(x - z), $MachinePrecision], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.6 \cdot 10^{+62} \lor \neg \left(y \leq 6 \cdot 10^{+94}\right) \land y \leq 2.6 \cdot 10^{+180}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \log y\\
\end{array}
\end{array}
if y < 3.6e62 or 6.0000000000000001e94 < y < 2.60000000000000021e180Initial program 99.9%
add-cube-cbrt98.7%
pow298.7%
+-commutative98.7%
*-commutative98.7%
+-commutative98.7%
*-commutative98.7%
Applied egg-rr98.7%
Taylor expanded in x around inf 73.2%
if 3.6e62 < y < 6.0000000000000001e94 or 2.60000000000000021e180 < y Initial program 99.5%
sub-neg99.5%
sub-neg99.5%
associate-+l+99.5%
associate-+l+99.5%
sub-neg99.5%
neg-sub099.5%
associate-+l-99.5%
neg-sub099.5%
neg-mul-199.5%
Simplified99.7%
Taylor expanded in z around 0 89.8%
+-commutative89.8%
mul-1-neg89.8%
sub-neg89.8%
associate--l+89.8%
+-commutative89.8%
*-commutative89.8%
sub-neg89.8%
+-commutative89.8%
distribute-rgt-neg-in89.8%
fma-def89.8%
+-commutative89.8%
distribute-neg-in89.8%
metadata-eval89.8%
sub-neg89.8%
Simplified89.8%
Taylor expanded in x around 0 78.2%
associate-*r*78.2%
+-commutative78.2%
neg-mul-178.2%
*-commutative78.2%
distribute-neg-in78.2%
metadata-eval78.2%
Simplified78.2%
Taylor expanded in y around inf 78.2%
*-commutative78.2%
log-rec78.2%
distribute-lft-neg-in78.2%
distribute-rgt-neg-in78.2%
Simplified78.2%
Final simplification74.5%
(FPCore (x y z)
:precision binary64
(if (<= y 3.6e+62)
(- x z)
(if (<= y 5.7e+94)
(+ y (* (log y) (- -0.5 y)))
(if (<= y 1.12e+180) (- x z) (- y (* y (log y)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.6e+62) {
tmp = x - z;
} else if (y <= 5.7e+94) {
tmp = y + (log(y) * (-0.5 - y));
} else if (y <= 1.12e+180) {
tmp = x - z;
} else {
tmp = y - (y * log(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 <= 3.6d+62) then
tmp = x - z
else if (y <= 5.7d+94) then
tmp = y + (log(y) * ((-0.5d0) - y))
else if (y <= 1.12d+180) then
tmp = x - z
else
tmp = y - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.6e+62) {
tmp = x - z;
} else if (y <= 5.7e+94) {
tmp = y + (Math.log(y) * (-0.5 - y));
} else if (y <= 1.12e+180) {
tmp = x - z;
} else {
tmp = y - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.6e+62: tmp = x - z elif y <= 5.7e+94: tmp = y + (math.log(y) * (-0.5 - y)) elif y <= 1.12e+180: tmp = x - z else: tmp = y - (y * math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.6e+62) tmp = Float64(x - z); elseif (y <= 5.7e+94) tmp = Float64(y + Float64(log(y) * Float64(-0.5 - y))); elseif (y <= 1.12e+180) tmp = Float64(x - z); else tmp = Float64(y - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.6e+62) tmp = x - z; elseif (y <= 5.7e+94) tmp = y + (log(y) * (-0.5 - y)); elseif (y <= 1.12e+180) tmp = x - z; else tmp = y - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.6e+62], N[(x - z), $MachinePrecision], If[LessEqual[y, 5.7e+94], N[(y + N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.12e+180], N[(x - z), $MachinePrecision], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.6 \cdot 10^{+62}:\\
\;\;\;\;x - z\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+94}:\\
\;\;\;\;y + \log y \cdot \left(-0.5 - y\right)\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+180}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \log y\\
\end{array}
\end{array}
if y < 3.6e62 or 5.7000000000000002e94 < y < 1.12e180Initial program 99.9%
add-cube-cbrt98.7%
pow298.7%
+-commutative98.7%
*-commutative98.7%
+-commutative98.7%
*-commutative98.7%
Applied egg-rr98.7%
Taylor expanded in x around inf 73.2%
if 3.6e62 < y < 5.7000000000000002e94Initial program 99.6%
sub-neg99.6%
sub-neg99.6%
associate-+l+99.6%
associate-+l+99.6%
sub-neg99.6%
neg-sub099.6%
associate-+l-99.6%
neg-sub099.6%
neg-mul-199.6%
Simplified99.6%
Taylor expanded in z around 0 88.6%
+-commutative88.6%
mul-1-neg88.6%
sub-neg88.6%
associate--l+88.6%
+-commutative88.6%
*-commutative88.6%
sub-neg88.6%
+-commutative88.6%
distribute-rgt-neg-in88.6%
fma-def88.6%
+-commutative88.6%
distribute-neg-in88.6%
metadata-eval88.6%
sub-neg88.6%
Simplified88.6%
Taylor expanded in x around 0 73.3%
associate-*r*73.3%
+-commutative73.3%
neg-mul-173.3%
*-commutative73.3%
distribute-neg-in73.3%
metadata-eval73.3%
Simplified73.3%
Taylor expanded in y around 0 73.3%
+-commutative73.3%
fma-def73.3%
mul-1-neg73.3%
fma-neg73.3%
distribute-rgt-out--73.3%
Simplified73.3%
if 1.12e180 < y Initial program 99.5%
sub-neg99.5%
sub-neg99.5%
associate-+l+99.5%
associate-+l+99.5%
sub-neg99.5%
neg-sub099.5%
associate-+l-99.5%
neg-sub099.5%
neg-mul-199.5%
Simplified99.7%
Taylor expanded in z around 0 90.1%
+-commutative90.1%
mul-1-neg90.1%
sub-neg90.1%
associate--l+90.1%
+-commutative90.1%
*-commutative90.1%
sub-neg90.1%
+-commutative90.1%
distribute-rgt-neg-in90.1%
fma-def90.1%
+-commutative90.1%
distribute-neg-in90.1%
metadata-eval90.1%
sub-neg90.1%
Simplified90.1%
Taylor expanded in x around 0 79.3%
associate-*r*79.3%
+-commutative79.3%
neg-mul-179.3%
*-commutative79.3%
distribute-neg-in79.3%
metadata-eval79.3%
Simplified79.3%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
log-rec79.3%
distribute-lft-neg-in79.3%
distribute-rgt-neg-in79.3%
Simplified79.3%
Final simplification74.5%
(FPCore (x y z) :precision binary64 (if (<= y 7.5e-25) (- x (+ z (* (log y) 0.5))) (+ x (- (* y (- 1.0 (log y))) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 7.5e-25) {
tmp = x - (z + (log(y) * 0.5));
} else {
tmp = x + ((y * (1.0 - log(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 <= 7.5d-25) then
tmp = x - (z + (log(y) * 0.5d0))
else
tmp = x + ((y * (1.0d0 - log(y))) - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 7.5e-25) {
tmp = x - (z + (Math.log(y) * 0.5));
} else {
tmp = x + ((y * (1.0 - Math.log(y))) - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7.5e-25: tmp = x - (z + (math.log(y) * 0.5)) else: tmp = x + ((y * (1.0 - math.log(y))) - z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7.5e-25) tmp = Float64(x - Float64(z + Float64(log(y) * 0.5))); else tmp = Float64(x + Float64(Float64(y * Float64(1.0 - log(y))) - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 7.5e-25) tmp = x - (z + (log(y) * 0.5)); else tmp = x + ((y * (1.0 - log(y))) - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7.5e-25], N[(x - N[(z + N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.5 \cdot 10^{-25}:\\
\;\;\;\;x - \left(z + \log y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot \left(1 - \log y\right) - z\right)\\
\end{array}
\end{array}
if y < 7.49999999999999989e-25Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
if 7.49999999999999989e-25 < y Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-+l+99.7%
associate-+l+99.7%
sub-neg99.7%
neg-sub099.7%
associate-+l-99.7%
neg-sub099.7%
neg-mul-199.7%
Simplified99.8%
Taylor expanded in y around inf 99.7%
log-rec99.7%
sub-neg99.7%
Simplified99.7%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (+ (- x (* (log y) (+ y 0.5))) (- y z)))
double code(double x, double y, double z) {
return (x - (log(y) * (y + 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 - (log(y) * (y + 0.5d0))) + (y - z)
end function
public static double code(double x, double y, double z) {
return (x - (Math.log(y) * (y + 0.5))) + (y - z);
}
def code(x, y, z): return (x - (math.log(y) * (y + 0.5))) + (y - z)
function code(x, y, z) return Float64(Float64(x - Float64(log(y) * Float64(y + 0.5))) + Float64(y - z)) end
function tmp = code(x, y, z) tmp = (x - (log(y) * (y + 0.5))) + (y - z); end
code[x_, y_, z_] := N[(N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \log y \cdot \left(y + 0.5\right)\right) + \left(y - z\right)
\end{array}
Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (- (+ y (- x (* (log y) (+ y 0.5)))) z))
double code(double x, double y, double z) {
return (y + (x - (log(y) * (y + 0.5)))) - 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 + (x - (log(y) * (y + 0.5d0)))) - z
end function
public static double code(double x, double y, double z) {
return (y + (x - (Math.log(y) * (y + 0.5)))) - z;
}
def code(x, y, z): return (y + (x - (math.log(y) * (y + 0.5)))) - z
function code(x, y, z) return Float64(Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) - z) end
function tmp = code(x, y, z) tmp = (y + (x - (log(y) * (y + 0.5)))) - z; end
code[x_, y_, z_] := N[(N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z -1.05e+64) (- z) (if (<= z 2.6e+129) x (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e+64) {
tmp = -z;
} else if (z <= 2.6e+129) {
tmp = x;
} else {
tmp = -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.05d+64)) then
tmp = -z
else if (z <= 2.6d+129) then
tmp = x
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e+64) {
tmp = -z;
} else if (z <= 2.6e+129) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.05e+64: tmp = -z elif z <= 2.6e+129: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.05e+64) tmp = Float64(-z); elseif (z <= 2.6e+129) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.05e+64) tmp = -z; elseif (z <= 2.6e+129) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.05e+64], (-z), If[LessEqual[z, 2.6e+129], x, (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+64}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+129}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -1.05e64 or 2.60000000000000012e129 < z Initial program 99.9%
Taylor expanded in y around inf 88.4%
*-commutative88.4%
log-rec88.4%
distribute-lft-neg-in88.4%
distribute-rgt-neg-in88.4%
Simplified88.4%
Taylor expanded in y around 0 68.6%
neg-mul-168.6%
Simplified68.6%
if -1.05e64 < z < 2.60000000000000012e129Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-+l+99.8%
associate-+l+99.8%
sub-neg99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
neg-mul-199.8%
Simplified99.8%
Taylor expanded in x around inf 41.1%
Final simplification51.2%
(FPCore (x y z) :precision binary64 (- x z))
double code(double x, double y, double z) {
return x - 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 - z
end function
public static double code(double x, double y, double z) {
return x - z;
}
def code(x, y, z): return x - z
function code(x, y, z) return Float64(x - z) end
function tmp = code(x, y, z) tmp = x - z; end
code[x_, y_, z_] := N[(x - z), $MachinePrecision]
\begin{array}{l}
\\
x - z
\end{array}
Initial program 99.8%
add-cube-cbrt98.6%
pow298.6%
+-commutative98.6%
*-commutative98.6%
+-commutative98.6%
*-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 59.8%
Final simplification59.8%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
sub-neg99.8%
sub-neg99.8%
associate-+l+99.8%
associate-+l+99.8%
sub-neg99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
neg-mul-199.8%
Simplified99.9%
Taylor expanded in x around inf 30.5%
Final simplification30.5%
(FPCore (x y z) :precision binary64 (- (- (+ y x) z) (* (+ y 0.5) (log y))))
double code(double x, double y, double z) {
return ((y + x) - z) - ((y + 0.5) * log(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 + x) - z) - ((y + 0.5d0) * log(y))
end function
public static double code(double x, double y, double z) {
return ((y + x) - z) - ((y + 0.5) * Math.log(y));
}
def code(x, y, z): return ((y + x) - z) - ((y + 0.5) * math.log(y))
function code(x, y, z) return Float64(Float64(Float64(y + x) - z) - Float64(Float64(y + 0.5) * log(y))) end
function tmp = code(x, y, z) tmp = ((y + x) - z) - ((y + 0.5) * log(y)); end
code[x_, y_, z_] := N[(N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision] - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y + x\right) - z\right) - \left(y + 0.5\right) \cdot \log y
\end{array}
herbie shell --seed 2023228
(FPCore (x y z)
:name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(- (- (+ y x) z) (* (+ y 0.5) (log y)))
(- (+ (- x (* (+ y 0.5) (log y))) y) z))