
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (<= y 160.0) (- (+ t_1 (log t)) z) (- (- t_1 y) z))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (y <= 160.0) {
tmp = (t_1 + log(t)) - z;
} else {
tmp = (t_1 - y) - z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if (y <= 160.0d0) then
tmp = (t_1 + log(t)) - z
else
tmp = (t_1 - y) - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double tmp;
if (y <= 160.0) {
tmp = (t_1 + Math.log(t)) - z;
} else {
tmp = (t_1 - y) - z;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if y <= 160.0: tmp = (t_1 + math.log(t)) - z else: tmp = (t_1 - y) - z return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (y <= 160.0) tmp = Float64(Float64(t_1 + log(t)) - z); else tmp = Float64(Float64(t_1 - y) - z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (y <= 160.0) tmp = (t_1 + log(t)) - z; else tmp = (t_1 - y) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 160.0], N[(N[(t$95$1 + N[Log[t], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(t$95$1 - y), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;y \leq 160:\\
\;\;\;\;\left(t_1 + \log t\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - y\right) - z\\
\end{array}
\end{array}
if y < 160Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in y around 0 99.0%
if 160 < y Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 99.2%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.95) (not (<= x 1.35))) (- (- (* x (log y)) y) z) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.95) || !(x <= 1.35)) {
tmp = ((x * log(y)) - y) - z;
} else {
tmp = log(t) - (y + z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-0.95d0)) .or. (.not. (x <= 1.35d0))) then
tmp = ((x * log(y)) - y) - z
else
tmp = log(t) - (y + z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.95) || !(x <= 1.35)) {
tmp = ((x * Math.log(y)) - y) - z;
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.95) or not (x <= 1.35): tmp = ((x * math.log(y)) - y) - z else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.95) || !(x <= 1.35)) tmp = Float64(Float64(Float64(x * log(y)) - y) - z); else tmp = Float64(log(t) - Float64(y + z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.95) || ~((x <= 1.35))) tmp = ((x * log(y)) - y) - z; else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.95], N[Not[LessEqual[x, 1.35]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.95 \lor \neg \left(x \leq 1.35\right):\\
\;\;\;\;\left(x \cdot \log y - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -0.94999999999999996 or 1.3500000000000001 < x Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 98.7%
if -0.94999999999999996 < x < 1.3500000000000001Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in x around 0 99.7%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.7e+154) (not (<= x 3.6e+105))) (* x (log y)) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.7e+154) || !(x <= 3.6e+105)) {
tmp = x * log(y);
} else {
tmp = log(t) - (y + z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-2.7d+154)) .or. (.not. (x <= 3.6d+105))) then
tmp = x * log(y)
else
tmp = log(t) - (y + z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.7e+154) || !(x <= 3.6e+105)) {
tmp = x * Math.log(y);
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.7e+154) or not (x <= 3.6e+105): tmp = x * math.log(y) else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.7e+154) || !(x <= 3.6e+105)) tmp = Float64(x * log(y)); else tmp = Float64(log(t) - Float64(y + z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.7e+154) || ~((x <= 3.6e+105))) tmp = x * log(y); else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.7e+154], N[Not[LessEqual[x, 3.6e+105]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{+154} \lor \neg \left(x \leq 3.6 \cdot 10^{+105}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -2.70000000000000006e154 or 3.5999999999999999e105 < x Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
sub-neg99.7%
associate--l+99.7%
*-commutative99.7%
add-cube-cbrt98.8%
associate-*l*98.7%
fma-def98.7%
pow298.7%
Applied egg-rr98.7%
Taylor expanded in x around inf 79.6%
pow-base-179.6%
*-commutative79.6%
*-lft-identity79.6%
Simplified79.6%
if -2.70000000000000006e154 < x < 3.5999999999999999e105Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in x around 0 89.8%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.6e+56) (not (<= x 4.2e+79))) (- (* x (log y)) z) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.6e+56) || !(x <= 4.2e+79)) {
tmp = (x * log(y)) - z;
} else {
tmp = log(t) - (y + z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-5.6d+56)) .or. (.not. (x <= 4.2d+79))) then
tmp = (x * log(y)) - z
else
tmp = log(t) - (y + z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.6e+56) || !(x <= 4.2e+79)) {
tmp = (x * Math.log(y)) - z;
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.6e+56) or not (x <= 4.2e+79): tmp = (x * math.log(y)) - z else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.6e+56) || !(x <= 4.2e+79)) tmp = Float64(Float64(x * log(y)) - z); else tmp = Float64(log(t) - Float64(y + z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.6e+56) || ~((x <= 4.2e+79))) tmp = (x * log(y)) - z; else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.6e+56], N[Not[LessEqual[x, 4.2e+79]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{+56} \lor \neg \left(x \leq 4.2 \cdot 10^{+79}\right):\\
\;\;\;\;x \cdot \log y - z\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -5.60000000000000017e56 or 4.20000000000000016e79 < x Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in y around 0 85.6%
Taylor expanded in x around inf 85.6%
if -5.60000000000000017e56 < x < 4.20000000000000016e79Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in x around 0 95.0%
Final simplification91.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.8e+154) (not (<= x 3.6e+105))) (* x (log y)) (- (- y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e+154) || !(x <= 3.6e+105)) {
tmp = x * log(y);
} else {
tmp = -y - z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-3.8d+154)) .or. (.not. (x <= 3.6d+105))) then
tmp = x * log(y)
else
tmp = -y - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e+154) || !(x <= 3.6e+105)) {
tmp = x * Math.log(y);
} else {
tmp = -y - z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.8e+154) or not (x <= 3.6e+105): tmp = x * math.log(y) else: tmp = -y - z return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.8e+154) || !(x <= 3.6e+105)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(-y) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.8e+154) || ~((x <= 3.6e+105))) tmp = x * log(y); else tmp = -y - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.8e+154], N[Not[LessEqual[x, 3.6e+105]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[((-y) - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+154} \lor \neg \left(x \leq 3.6 \cdot 10^{+105}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) - z\\
\end{array}
\end{array}
if x < -3.7999999999999998e154 or 3.5999999999999999e105 < x Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
sub-neg99.7%
associate--l+99.7%
*-commutative99.7%
add-cube-cbrt98.8%
associate-*l*98.7%
fma-def98.7%
pow298.7%
Applied egg-rr98.7%
Taylor expanded in x around inf 79.6%
pow-base-179.6%
*-commutative79.6%
*-lft-identity79.6%
Simplified79.6%
if -3.7999999999999998e154 < x < 3.5999999999999999e105Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
sub-neg100.0%
associate--l+100.0%
*-commutative100.0%
add-cube-cbrt99.8%
associate-*l*99.8%
fma-def99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 89.8%
associate--r+89.8%
Simplified89.8%
Taylor expanded in y around inf 73.4%
neg-mul-173.4%
Simplified73.4%
Final simplification75.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5800000000000.0) (not (<= z 1e+40))) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5800000000000.0) || !(z <= 1e+40)) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5800000000000.0d0)) .or. (.not. (z <= 1d+40))) then
tmp = -z
else
tmp = -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5800000000000.0) || !(z <= 1e+40)) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5800000000000.0) or not (z <= 1e+40): tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5800000000000.0) || !(z <= 1e+40)) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5800000000000.0) || ~((z <= 1e+40))) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5800000000000.0], N[Not[LessEqual[z, 1e+40]], $MachinePrecision]], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5800000000000 \lor \neg \left(z \leq 10^{+40}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if z < -5.8e12 or 1.00000000000000003e40 < z Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 65.9%
mul-1-neg65.9%
Simplified65.9%
if -5.8e12 < z < 1.00000000000000003e40Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
sub-neg99.8%
associate--l+99.8%
*-commutative99.8%
add-cube-cbrt99.4%
associate-*l*99.3%
fma-def99.3%
pow299.3%
Applied egg-rr99.3%
Taylor expanded in y around inf 41.0%
mul-1-neg41.0%
Simplified41.0%
Final simplification51.8%
(FPCore (x y z t) :precision binary64 (- (- y) z))
double code(double x, double y, double z, double t) {
return -y - z;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -y - z
end function
public static double code(double x, double y, double z, double t) {
return -y - z;
}
def code(x, y, z, t): return -y - z
function code(x, y, z, t) return Float64(Float64(-y) - z) end
function tmp = code(x, y, z, t) tmp = -y - z; end
code[x_, y_, z_, t_] := N[((-y) - z), $MachinePrecision]
\begin{array}{l}
\\
\left(-y\right) - z
\end{array}
Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
sub-neg99.9%
associate--l+99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 71.7%
associate--r+71.7%
Simplified71.7%
Taylor expanded in y around inf 59.7%
neg-mul-159.7%
Simplified59.7%
Final simplification59.7%
(FPCore (x y z t) :precision binary64 (- y))
double code(double x, double y, double z, double t) {
return -y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -y
end function
public static double code(double x, double y, double z, double t) {
return -y;
}
def code(x, y, z, t): return -y
function code(x, y, z, t) return Float64(-y) end
function tmp = code(x, y, z, t) tmp = -y; end
code[x_, y_, z_, t_] := (-y)
\begin{array}{l}
\\
-y
\end{array}
Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
sub-neg99.9%
associate--l+99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 30.8%
mul-1-neg30.8%
Simplified30.8%
Final simplification30.8%
herbie shell --seed 2024024
(FPCore (x y z t)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (- (* x (log y)) y) z) (log t)))