
(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 10 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 (+ (- (+ (* -2.0 y) (+ y (* (log y) x))) z) (log t)))
double code(double x, double y, double z, double t) {
return (((-2.0 * y) + (y + (log(y) * x))) - 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 = ((((-2.0d0) * y) + (y + (log(y) * x))) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((-2.0 * y) + (y + (Math.log(y) * x))) - z) + Math.log(t);
}
def code(x, y, z, t): return (((-2.0 * y) + (y + (math.log(y) * x))) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-2.0 * y) + Float64(y + Float64(log(y) * x))) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((-2.0 * y) + (y + (log(y) * x))) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-2.0 * y), $MachinePrecision] + N[(y + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-2 \cdot y + \left(y + \log y \cdot x\right)\right) - z\right) + \log t
\end{array}
Initial program 99.9%
flip--44.3%
pow244.3%
Applied egg-rr44.3%
Taylor expanded in x around inf 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.05e+29) (not (<= z 7.4e+121))) (- (- z) y) (- (+ (* (log y) x) (log t)) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.05e+29) || !(z <= 7.4e+121)) {
tmp = -z - y;
} else {
tmp = ((log(y) * x) + log(t)) - 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 <= (-1.05d+29)) .or. (.not. (z <= 7.4d+121))) then
tmp = -z - y
else
tmp = ((log(y) * x) + log(t)) - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.05e+29) || !(z <= 7.4e+121)) {
tmp = -z - y;
} else {
tmp = ((Math.log(y) * x) + Math.log(t)) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.05e+29) or not (z <= 7.4e+121): tmp = -z - y else: tmp = ((math.log(y) * x) + math.log(t)) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.05e+29) || !(z <= 7.4e+121)) tmp = Float64(Float64(-z) - y); else tmp = Float64(Float64(Float64(log(y) * x) + log(t)) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.05e+29) || ~((z <= 7.4e+121))) tmp = -z - y; else tmp = ((log(y) * x) + log(t)) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.05e+29], N[Not[LessEqual[z, 7.4e+121]], $MachinePrecision]], N[((-z) - y), $MachinePrecision], N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+29} \lor \neg \left(z \leq 7.4 \cdot 10^{+121}\right):\\
\;\;\;\;\left(-z\right) - y\\
\mathbf{else}:\\
\;\;\;\;\left(\log y \cdot x + \log t\right) - y\\
\end{array}
\end{array}
if z < -1.0500000000000001e29 or 7.40000000000000025e121 < z Initial program 100.0%
Taylor expanded in x around 0 89.8%
+-commutative89.8%
associate--r+89.8%
Simplified89.8%
Taylor expanded in z around inf 89.8%
neg-mul-189.8%
Simplified89.8%
if -1.0500000000000001e29 < z < 7.40000000000000025e121Initial program 99.8%
Taylor expanded in z around 0 94.9%
Final simplification92.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.1e+212) (not (<= x 5e+142))) (+ (* (log y) x) (log t)) (- (- (log t) z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e+212) || !(x <= 5e+142)) {
tmp = (log(y) * x) + log(t);
} else {
tmp = (log(t) - z) - 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 ((x <= (-1.1d+212)) .or. (.not. (x <= 5d+142))) then
tmp = (log(y) * x) + log(t)
else
tmp = (log(t) - z) - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e+212) || !(x <= 5e+142)) {
tmp = (Math.log(y) * x) + Math.log(t);
} else {
tmp = (Math.log(t) - z) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.1e+212) or not (x <= 5e+142): tmp = (math.log(y) * x) + math.log(t) else: tmp = (math.log(t) - z) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.1e+212) || !(x <= 5e+142)) tmp = Float64(Float64(log(y) * x) + log(t)); else tmp = Float64(Float64(log(t) - z) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.1e+212) || ~((x <= 5e+142))) tmp = (log(y) * x) + log(t); else tmp = (log(t) - z) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.1e+212], N[Not[LessEqual[x, 5e+142]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+212} \lor \neg \left(x \leq 5 \cdot 10^{+142}\right):\\
\;\;\;\;\log y \cdot x + \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - z\right) - y\\
\end{array}
\end{array}
if x < -1.09999999999999998e212 or 5.0000000000000001e142 < x Initial program 99.7%
Taylor expanded in z around 0 90.4%
Taylor expanded in y around 0 84.7%
if -1.09999999999999998e212 < x < 5.0000000000000001e142Initial program 99.9%
Taylor expanded in x around 0 89.0%
+-commutative89.0%
associate--r+89.0%
Simplified89.0%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (+ (log t) (- (- (* (log y) x) y) z)))
double code(double x, double y, double z, double t) {
return log(t) + (((log(y) * x) - 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 = log(t) + (((log(y) * x) - y) - z)
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) + (((Math.log(y) * x) - y) - z);
}
def code(x, y, z, t): return math.log(t) + (((math.log(y) * x) - y) - z)
function code(x, y, z, t) return Float64(log(t) + Float64(Float64(Float64(log(y) * x) - y) - z)) end
function tmp = code(x, y, z, t) tmp = log(t) + (((log(y) * x) - y) - z); end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] + N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log t + \left(\left(\log y \cdot x - y\right) - z\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -17.0) (not (<= z 1.15e-50))) (- (- z) y) (- (log t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -17.0) || !(z <= 1.15e-50)) {
tmp = -z - y;
} else {
tmp = log(t) - 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 <= (-17.0d0)) .or. (.not. (z <= 1.15d-50))) then
tmp = -z - y
else
tmp = log(t) - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -17.0) || !(z <= 1.15e-50)) {
tmp = -z - y;
} else {
tmp = Math.log(t) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -17.0) or not (z <= 1.15e-50): tmp = -z - y else: tmp = math.log(t) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -17.0) || !(z <= 1.15e-50)) tmp = Float64(Float64(-z) - y); else tmp = Float64(log(t) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -17.0) || ~((z <= 1.15e-50))) tmp = -z - y; else tmp = log(t) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -17.0], N[Not[LessEqual[z, 1.15e-50]], $MachinePrecision]], N[((-z) - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -17 \lor \neg \left(z \leq 1.15 \cdot 10^{-50}\right):\\
\;\;\;\;\left(-z\right) - y\\
\mathbf{else}:\\
\;\;\;\;\log t - y\\
\end{array}
\end{array}
if z < -17 or 1.1500000000000001e-50 < z Initial program 99.9%
Taylor expanded in x around 0 81.5%
+-commutative81.5%
associate--r+81.5%
Simplified81.5%
Taylor expanded in z around inf 80.7%
neg-mul-180.7%
Simplified80.7%
if -17 < z < 1.1500000000000001e-50Initial program 99.8%
Taylor expanded in z around 0 99.4%
Taylor expanded in x around 0 64.3%
Final simplification73.3%
(FPCore (x y z t) :precision binary64 (if (<= y 7.2e-19) (- (log t) z) (- (- z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e-19) {
tmp = log(t) - z;
} else {
tmp = -z - 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 (y <= 7.2d-19) then
tmp = log(t) - z
else
tmp = -z - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e-19) {
tmp = Math.log(t) - z;
} else {
tmp = -z - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 7.2e-19: tmp = math.log(t) - z else: tmp = -z - y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 7.2e-19) tmp = Float64(log(t) - z); else tmp = Float64(Float64(-z) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 7.2e-19) tmp = log(t) - z; else tmp = -z - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.2e-19], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], N[((-z) - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.2 \cdot 10^{-19}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - y\\
\end{array}
\end{array}
if y < 7.2000000000000002e-19Initial program 99.8%
Taylor expanded in z around inf 63.4%
neg-mul-163.4%
Simplified63.4%
Taylor expanded in z around 0 63.4%
mul-1-neg63.4%
+-commutative63.4%
sub-neg63.4%
Simplified63.4%
if 7.2000000000000002e-19 < y Initial program 99.9%
Taylor expanded in x around 0 82.8%
+-commutative82.8%
associate--r+82.8%
Simplified82.8%
Taylor expanded in z around inf 82.7%
neg-mul-182.7%
Simplified82.7%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (- (- (log t) z) y))
double code(double x, double y, double z, double t) {
return (log(t) - z) - 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 = (log(t) - z) - y
end function
public static double code(double x, double y, double z, double t) {
return (Math.log(t) - z) - y;
}
def code(x, y, z, t): return (math.log(t) - z) - y
function code(x, y, z, t) return Float64(Float64(log(t) - z) - y) end
function tmp = code(x, y, z, t) tmp = (log(t) - z) - y; end
code[x_, y_, z_, t_] := N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}
\\
\left(\log t - z\right) - y
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 73.9%
+-commutative73.9%
associate--r+73.9%
Simplified73.9%
Final simplification73.9%
(FPCore (x y z t) :precision binary64 (if (<= y 90000000000.0) (- z) (if (<= y 4.8e+70) (- y) (if (<= y 6.2e+112) (- z) (- y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 90000000000.0) {
tmp = -z;
} else if (y <= 4.8e+70) {
tmp = -y;
} else if (y <= 6.2e+112) {
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 (y <= 90000000000.0d0) then
tmp = -z
else if (y <= 4.8d+70) then
tmp = -y
else if (y <= 6.2d+112) 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 (y <= 90000000000.0) {
tmp = -z;
} else if (y <= 4.8e+70) {
tmp = -y;
} else if (y <= 6.2e+112) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 90000000000.0: tmp = -z elif y <= 4.8e+70: tmp = -y elif y <= 6.2e+112: tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 90000000000.0) tmp = Float64(-z); elseif (y <= 4.8e+70) tmp = Float64(-y); elseif (y <= 6.2e+112) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 90000000000.0) tmp = -z; elseif (y <= 4.8e+70) tmp = -y; elseif (y <= 6.2e+112) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 90000000000.0], (-z), If[LessEqual[y, 4.8e+70], (-y), If[LessEqual[y, 6.2e+112], (-z), (-y)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 90000000000:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+70}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+112}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 9e10 or 4.79999999999999974e70 < y < 6.19999999999999965e112Initial program 99.9%
Taylor expanded in z around inf 64.0%
neg-mul-164.0%
Simplified64.0%
Taylor expanded in z around inf 42.2%
mul-1-neg42.2%
Simplified42.2%
if 9e10 < y < 4.79999999999999974e70 or 6.19999999999999965e112 < y Initial program 99.9%
Taylor expanded in x around 0 82.4%
+-commutative82.4%
associate--r+82.4%
Simplified82.4%
Taylor expanded in y around inf 69.7%
neg-mul-169.7%
Simplified69.7%
Final simplification54.8%
(FPCore (x y z t) :precision binary64 (- (- z) y))
double code(double x, double y, double z, double t) {
return -z - 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 = -z - y
end function
public static double code(double x, double y, double z, double t) {
return -z - y;
}
def code(x, y, z, t): return -z - y
function code(x, y, z, t) return Float64(Float64(-z) - y) end
function tmp = code(x, y, z, t) tmp = -z - y; end
code[x_, y_, z_, t_] := N[((-z) - y), $MachinePrecision]
\begin{array}{l}
\\
\left(-z\right) - y
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 73.9%
+-commutative73.9%
associate--r+73.9%
Simplified73.9%
Taylor expanded in z around inf 62.1%
neg-mul-162.1%
Simplified62.1%
Final simplification62.1%
(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%
Taylor expanded in x around 0 73.9%
+-commutative73.9%
associate--r+73.9%
Simplified73.9%
Taylor expanded in y around inf 34.6%
neg-mul-134.6%
Simplified34.6%
Final simplification34.6%
herbie shell --seed 2023221
(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)))