
(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 7 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 (if (or (<= z -5.2e+22) (not (<= z 8.8e+51))) (- (log t) (+ z y)) (+ (- (* x (log y)) y) (log t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+22) || !(z <= 8.8e+51)) {
tmp = log(t) - (z + y);
} else {
tmp = ((x * log(y)) - y) + log(t);
}
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 <= (-5.2d+22)) .or. (.not. (z <= 8.8d+51))) then
tmp = log(t) - (z + y)
else
tmp = ((x * log(y)) - y) + log(t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+22) || !(z <= 8.8e+51)) {
tmp = Math.log(t) - (z + y);
} else {
tmp = ((x * Math.log(y)) - y) + Math.log(t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e+22) or not (z <= 8.8e+51): tmp = math.log(t) - (z + y) else: tmp = ((x * math.log(y)) - y) + math.log(t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.2e+22) || !(z <= 8.8e+51)) tmp = Float64(log(t) - Float64(z + y)); else tmp = Float64(Float64(Float64(x * log(y)) - y) + log(t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.2e+22) || ~((z <= 8.8e+51))) tmp = log(t) - (z + y); else tmp = ((x * log(y)) - y) + log(t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e+22], N[Not[LessEqual[z, 8.8e+51]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+22} \lor \neg \left(z \leq 8.8 \cdot 10^{+51}\right):\\
\;\;\;\;\log t - \left(z + y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \log y - y\right) + \log t\\
\end{array}
\end{array}
if z < -5.2e22 or 8.79999999999999967e51 < z Initial program 100.0%
Taylor expanded in x around 0 88.0%
mul-1-neg88.0%
Simplified88.0%
Taylor expanded in y around 0 88.0%
mul-1-neg88.0%
sub-neg88.0%
associate--r+88.0%
+-commutative88.0%
Simplified88.0%
if -5.2e22 < z < 8.79999999999999967e51Initial program 99.8%
add-sqr-sqrt57.0%
pow257.0%
Applied egg-rr57.0%
Taylor expanded in z around 0 98.4%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.25e+182) (not (<= x 5.8e+183))) (+ (* x (log y)) (log t)) (- (log t) (+ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.25e+182) || !(x <= 5.8e+183)) {
tmp = (x * log(y)) + 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.25d+182)) .or. (.not. (x <= 5.8d+183))) then
tmp = (x * log(y)) + 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.25e+182) || !(x <= 5.8e+183)) {
tmp = (x * Math.log(y)) + Math.log(t);
} else {
tmp = Math.log(t) - (z + y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.25e+182) or not (x <= 5.8e+183): tmp = (x * math.log(y)) + math.log(t) else: tmp = math.log(t) - (z + y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.25e+182) || !(x <= 5.8e+183)) tmp = Float64(Float64(x * log(y)) + log(t)); else tmp = Float64(log(t) - Float64(z + y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.25e+182) || ~((x <= 5.8e+183))) tmp = (x * log(y)) + log(t); else tmp = log(t) - (z + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.25e+182], N[Not[LessEqual[x, 5.8e+183]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+182} \lor \neg \left(x \leq 5.8 \cdot 10^{+183}\right):\\
\;\;\;\;x \cdot \log y + \log t\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(z + y\right)\\
\end{array}
\end{array}
if x < -1.24999999999999993e182 or 5.8000000000000001e183 < x Initial program 99.6%
Taylor expanded in y around 0 87.8%
Taylor expanded in x around inf 79.1%
if -1.24999999999999993e182 < x < 5.8000000000000001e183Initial program 99.9%
Taylor expanded in x around 0 84.4%
mul-1-neg84.4%
Simplified84.4%
Taylor expanded in y around 0 84.4%
mul-1-neg84.4%
sub-neg84.4%
associate--r+84.4%
+-commutative84.4%
Simplified84.4%
Final simplification83.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e+59) (not (<= z 3.7e+68))) (- z) (- (log t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e+59) || !(z <= 3.7e+68)) {
tmp = -z;
} 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 <= (-7.8d+59)) .or. (.not. (z <= 3.7d+68))) then
tmp = -z
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 <= -7.8e+59) || !(z <= 3.7e+68)) {
tmp = -z;
} else {
tmp = Math.log(t) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.8e+59) or not (z <= 3.7e+68): tmp = -z else: tmp = math.log(t) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.8e+59) || !(z <= 3.7e+68)) tmp = Float64(-z); else tmp = Float64(log(t) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.8e+59) || ~((z <= 3.7e+68))) tmp = -z; else tmp = log(t) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.8e+59], N[Not[LessEqual[z, 3.7e+68]], $MachinePrecision]], (-z), N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+59} \lor \neg \left(z \leq 3.7 \cdot 10^{+68}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\log t - y\\
\end{array}
\end{array}
if z < -7.80000000000000043e59 or 3.69999999999999998e68 < z Initial program 100.0%
Taylor expanded in x around 0 87.3%
mul-1-neg87.3%
Simplified87.3%
Taylor expanded in z around inf 70.2%
mul-1-neg70.2%
Simplified70.2%
if -7.80000000000000043e59 < z < 3.69999999999999998e68Initial program 99.8%
Taylor expanded in x around 0 58.4%
mul-1-neg58.4%
Simplified58.4%
Taylor expanded in z around 0 55.6%
Final simplification61.9%
(FPCore (x y z t) :precision binary64 (- (log t) (+ y z)))
double code(double x, double y, double z, double t) {
return log(t) - (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) - (y + z)
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) - (y + z);
}
def code(x, y, z, t): return math.log(t) - (y + z)
function code(x, y, z, t) return Float64(log(t) - Float64(y + z)) end
function tmp = code(x, y, z, t) tmp = log(t) - (y + z); end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log t - \left(y + z\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 70.8%
mul-1-neg70.8%
Simplified70.8%
Taylor expanded in y around 0 70.8%
mul-1-neg70.8%
sub-neg70.8%
associate--r+70.8%
+-commutative70.8%
Simplified70.8%
Final simplification70.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.6e+59) (not (<= z 8.2e+70))) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e+59) || !(z <= 8.2e+70)) {
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 <= (-7.6d+59)) .or. (.not. (z <= 8.2d+70))) 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 <= -7.6e+59) || !(z <= 8.2e+70)) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.6e+59) or not (z <= 8.2e+70): tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.6e+59) || !(z <= 8.2e+70)) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.6e+59) || ~((z <= 8.2e+70))) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.6e+59], N[Not[LessEqual[z, 8.2e+70]], $MachinePrecision]], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{+59} \lor \neg \left(z \leq 8.2 \cdot 10^{+70}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if z < -7.6000000000000002e59 or 8.2000000000000004e70 < z Initial program 100.0%
Taylor expanded in x around 0 87.3%
mul-1-neg87.3%
Simplified87.3%
Taylor expanded in z around inf 70.2%
mul-1-neg70.2%
Simplified70.2%
if -7.6000000000000002e59 < z < 8.2000000000000004e70Initial program 99.8%
Taylor expanded in x around 0 58.4%
mul-1-neg58.4%
Simplified58.4%
Taylor expanded in y around inf 40.3%
mul-1-neg40.3%
Simplified40.3%
Final simplification53.2%
(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 70.8%
mul-1-neg70.8%
Simplified70.8%
Taylor expanded in y around inf 30.7%
mul-1-neg30.7%
Simplified30.7%
Final simplification30.7%
herbie shell --seed 2024046
(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)))