
(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 (if (or (<= z -1.25e+114) (not (<= z 1.65e+111))) (- (log t) (+ y z)) (+ (- (* x (log y)) y) (log t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+114) || !(z <= 1.65e+111)) {
tmp = log(t) - (y + z);
} 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 <= (-1.25d+114)) .or. (.not. (z <= 1.65d+111))) then
tmp = log(t) - (y + z)
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 <= -1.25e+114) || !(z <= 1.65e+111)) {
tmp = Math.log(t) - (y + z);
} else {
tmp = ((x * Math.log(y)) - y) + Math.log(t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e+114) or not (z <= 1.65e+111): tmp = math.log(t) - (y + z) else: tmp = ((x * math.log(y)) - y) + math.log(t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e+114) || !(z <= 1.65e+111)) tmp = Float64(log(t) - Float64(y + z)); 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 <= -1.25e+114) || ~((z <= 1.65e+111))) tmp = log(t) - (y + z); else tmp = ((x * log(y)) - y) + log(t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e+114], N[Not[LessEqual[z, 1.65e+111]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] - N[(y + z), $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 -1.25 \cdot 10^{+114} \lor \neg \left(z \leq 1.65 \cdot 10^{+111}\right):\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \log y - y\right) + \log t\\
\end{array}
\end{array}
if z < -1.25e114 or 1.6500000000000001e111 < z Initial program 100.0%
Taylor expanded in x around 0 87.9%
mul-1-neg87.9%
+-commutative87.9%
distribute-neg-in87.9%
sub-neg87.9%
Simplified87.9%
if -1.25e114 < z < 1.6500000000000001e111Initial program 99.8%
add-cube-cbrt99.2%
pow399.2%
Applied egg-rr99.2%
Taylor expanded in z around 0 94.9%
pow-base-194.9%
*-lft-identity94.9%
Simplified94.9%
Final simplification92.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= y 9.6e+14)
(+ (log t) (- t_1 z))
(if (<= y 4.8e+141) (+ (- t_1 y) (log t)) (- (log t) (+ y z))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (y <= 9.6e+14) {
tmp = log(t) + (t_1 - z);
} else if (y <= 4.8e+141) {
tmp = (t_1 - y) + log(t);
} 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) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if (y <= 9.6d+14) then
tmp = log(t) + (t_1 - z)
else if (y <= 4.8d+141) then
tmp = (t_1 - y) + log(t)
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 t_1 = x * Math.log(y);
double tmp;
if (y <= 9.6e+14) {
tmp = Math.log(t) + (t_1 - z);
} else if (y <= 4.8e+141) {
tmp = (t_1 - y) + Math.log(t);
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if y <= 9.6e+14: tmp = math.log(t) + (t_1 - z) elif y <= 4.8e+141: tmp = (t_1 - y) + math.log(t) else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (y <= 9.6e+14) tmp = Float64(log(t) + Float64(t_1 - z)); elseif (y <= 4.8e+141) tmp = Float64(Float64(t_1 - y) + log(t)); else tmp = Float64(log(t) - Float64(y + z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (y <= 9.6e+14) tmp = log(t) + (t_1 - z); elseif (y <= 4.8e+141) tmp = (t_1 - y) + log(t); else tmp = log(t) - (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, 9.6e+14], N[(N[Log[t], $MachinePrecision] + N[(t$95$1 - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+141], N[(N[(t$95$1 - y), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;y \leq 9.6 \cdot 10^{+14}:\\
\;\;\;\;\log t + \left(t_1 - z\right)\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+141}:\\
\;\;\;\;\left(t_1 - y\right) + \log t\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if y < 9.6e14Initial program 99.8%
Taylor expanded in y around 0 98.8%
if 9.6e14 < y < 4.79999999999999995e141Initial program 99.9%
add-cube-cbrt99.4%
pow399.4%
Applied egg-rr99.4%
Taylor expanded in z around 0 84.1%
pow-base-184.1%
*-lft-identity84.1%
Simplified84.1%
if 4.79999999999999995e141 < y Initial program 100.0%
Taylor expanded in x around 0 94.0%
mul-1-neg94.0%
+-commutative94.0%
distribute-neg-in94.0%
sub-neg94.0%
Simplified94.0%
Final simplification95.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.2e+79) (not (<= x 2.3e+101))) (+ (* x (log y)) (log t)) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.2e+79) || !(x <= 2.3e+101)) {
tmp = (x * log(y)) + log(t);
} 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 <= (-6.2d+79)) .or. (.not. (x <= 2.3d+101))) then
tmp = (x * log(y)) + log(t)
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 <= -6.2e+79) || !(x <= 2.3e+101)) {
tmp = (x * Math.log(y)) + Math.log(t);
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.2e+79) or not (x <= 2.3e+101): tmp = (x * math.log(y)) + math.log(t) else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.2e+79) || !(x <= 2.3e+101)) tmp = Float64(Float64(x * log(y)) + log(t)); 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 <= -6.2e+79) || ~((x <= 2.3e+101))) tmp = (x * log(y)) + log(t); else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.2e+79], N[Not[LessEqual[x, 2.3e+101]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+79} \lor \neg \left(x \leq 2.3 \cdot 10^{+101}\right):\\
\;\;\;\;x \cdot \log y + \log t\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -6.1999999999999998e79 or 2.3000000000000001e101 < x Initial program 99.7%
Taylor expanded in y around 0 91.6%
Taylor expanded in z around 0 74.6%
+-commutative74.6%
Simplified74.6%
if -6.1999999999999998e79 < x < 2.3000000000000001e101Initial program 100.0%
Taylor expanded in x around 0 95.1%
mul-1-neg95.1%
+-commutative95.1%
distribute-neg-in95.1%
sub-neg95.1%
Simplified95.1%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e+100) (not (<= z 2.7e+99))) (- (log t) z) (- (log t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+100) || !(z <= 2.7e+99)) {
tmp = log(t) - 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.5d+100)) .or. (.not. (z <= 2.7d+99))) then
tmp = log(t) - 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.5e+100) || !(z <= 2.7e+99)) {
tmp = Math.log(t) - z;
} else {
tmp = Math.log(t) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e+100) or not (z <= 2.7e+99): tmp = math.log(t) - z else: tmp = math.log(t) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e+100) || !(z <= 2.7e+99)) tmp = Float64(log(t) - 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.5e+100) || ~((z <= 2.7e+99))) tmp = log(t) - z; else tmp = log(t) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e+100], N[Not[LessEqual[z, 2.7e+99]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+100} \lor \neg \left(z \leq 2.7 \cdot 10^{+99}\right):\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;\log t - y\\
\end{array}
\end{array}
if z < -7.49999999999999983e100 or 2.69999999999999989e99 < z Initial program 99.9%
Taylor expanded in z around inf 71.9%
neg-mul-171.9%
Simplified71.9%
Taylor expanded in z around 0 71.9%
mul-1-neg71.9%
sub-neg71.9%
Simplified71.9%
if -7.49999999999999983e100 < z < 2.69999999999999989e99Initial program 99.9%
add-cube-cbrt99.2%
pow399.2%
Applied egg-rr99.2%
Taylor expanded in y around inf 58.6%
neg-mul-158.6%
Simplified58.6%
Taylor expanded in y around 0 58.6%
mul-1-neg58.6%
sub-neg58.6%
Simplified58.6%
Final simplification63.1%
(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 68.9%
mul-1-neg68.9%
+-commutative68.9%
distribute-neg-in68.9%
sub-neg68.9%
Simplified68.9%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (<= y 105.0) (log t) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 105.0) {
tmp = log(t);
} 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 <= 105.0d0) then
tmp = log(t)
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 <= 105.0) {
tmp = Math.log(t);
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 105.0: tmp = math.log(t) else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 105.0) tmp = log(t); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 105.0) tmp = log(t); else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 105.0], N[Log[t], $MachinePrecision], (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 105:\\
\;\;\;\;\log t\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 105Initial program 99.8%
Taylor expanded in z around inf 57.3%
neg-mul-157.3%
Simplified57.3%
Taylor expanded in z around 0 26.1%
if 105 < y Initial program 100.0%
add-cube-cbrt99.7%
pow399.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 63.9%
neg-mul-163.9%
Simplified63.9%
Taylor expanded in y around inf 62.9%
mul-1-neg62.9%
Simplified62.9%
Final simplification42.5%
(FPCore (x y z t) :precision binary64 (- (log t) y))
double code(double x, double y, double z, double t) {
return log(t) - 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) - y
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) - y;
}
def code(x, y, z, t): return math.log(t) - y
function code(x, y, z, t) return Float64(log(t) - y) end
function tmp = code(x, y, z, t) tmp = log(t) - y; end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}
\\
\log t - y
\end{array}
Initial program 99.9%
add-cube-cbrt99.4%
pow399.4%
Applied egg-rr99.4%
Taylor expanded in y around inf 43.2%
neg-mul-143.2%
Simplified43.2%
Taylor expanded in y around 0 43.2%
mul-1-neg43.2%
sub-neg43.2%
Simplified43.2%
Final simplification43.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%
add-cube-cbrt99.4%
pow399.4%
Applied egg-rr99.4%
Taylor expanded in y around inf 43.2%
neg-mul-143.2%
Simplified43.2%
Taylor expanded in y around inf 29.4%
mul-1-neg29.4%
Simplified29.4%
Final simplification29.4%
herbie shell --seed 2023298
(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)))