
(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 6 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 (or (<= z -1.5e+17) (not (<= z 21.0)))
(- t_1 (+ y z))
(+ t_1 (- (log t) y)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if ((z <= -1.5e+17) || !(z <= 21.0)) {
tmp = t_1 - (y + z);
} else {
tmp = t_1 + (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) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if ((z <= (-1.5d+17)) .or. (.not. (z <= 21.0d0))) then
tmp = t_1 - (y + z)
else
tmp = t_1 + (log(t) - y)
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 ((z <= -1.5e+17) || !(z <= 21.0)) {
tmp = t_1 - (y + z);
} else {
tmp = t_1 + (Math.log(t) - y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if (z <= -1.5e+17) or not (z <= 21.0): tmp = t_1 - (y + z) else: tmp = t_1 + (math.log(t) - y) return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if ((z <= -1.5e+17) || !(z <= 21.0)) tmp = Float64(t_1 - Float64(y + z)); else tmp = Float64(t_1 + Float64(log(t) - y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if ((z <= -1.5e+17) || ~((z <= 21.0))) tmp = t_1 - (y + z); else tmp = t_1 + (log(t) - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -1.5e+17], N[Not[LessEqual[z, 21.0]], $MachinePrecision]], N[(t$95$1 - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;z \leq -1.5 \cdot 10^{+17} \lor \neg \left(z \leq 21\right):\\
\;\;\;\;t\_1 - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\log t - y\right)\\
\end{array}
\end{array}
if z < -1.5e17 or 21 < z Initial program 100.0%
associate-+l-100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in z around inf 99.4%
if -1.5e17 < z < 21Initial program 99.8%
associate-+l-99.8%
associate--l-99.8%
Simplified99.8%
Taylor expanded in z around 0 99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (<= y 1.6e+108) (* x (log y)) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.6e+108) {
tmp = x * log(y);
} 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 <= 1.6d+108) then
tmp = x * log(y)
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 <= 1.6e+108) {
tmp = x * Math.log(y);
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.6e+108: tmp = x * math.log(y) else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.6e+108) tmp = Float64(x * log(y)); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.6e+108) tmp = x * log(y); else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.6e+108], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.6 \cdot 10^{+108}:\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 1.6e108Initial program 99.9%
associate-+l-99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in y around inf 46.8%
add-log-exp10.7%
*-commutative10.7%
exp-to-pow10.7%
Applied egg-rr10.7%
Taylor expanded in y around 0 4.7%
log-pow39.2%
*-commutative39.2%
Applied egg-rr39.2%
if 1.6e108 < y Initial program 99.9%
associate-+l-99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in y around inf 86.3%
add-log-exp50.2%
*-commutative50.2%
exp-to-pow50.2%
Applied egg-rr50.2%
Taylor expanded in y around inf 76.4%
neg-mul-176.4%
Simplified76.4%
Final simplification50.9%
(FPCore (x y z t) :precision binary64 (- (* x (log y)) (+ y z)))
double code(double x, double y, double z, double t) {
return (x * log(y)) - (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 = (x * log(y)) - (y + z)
end function
public static double code(double x, double y, double z, double t) {
return (x * Math.log(y)) - (y + z);
}
def code(x, y, z, t): return (x * math.log(y)) - (y + z)
function code(x, y, z, t) return Float64(Float64(x * log(y)) - Float64(y + z)) end
function tmp = code(x, y, z, t) tmp = (x * log(y)) - (y + z); end
code[x_, y_, z_, t_] := N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log y - \left(y + z\right)
\end{array}
Initial program 99.9%
associate-+l-99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in z around inf 87.1%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (- (* x (log y)) y))
double code(double x, double y, double z, double t) {
return (x * log(y)) - 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 = (x * log(y)) - y
end function
public static double code(double x, double y, double z, double t) {
return (x * Math.log(y)) - y;
}
def code(x, y, z, t): return (x * math.log(y)) - y
function code(x, y, z, t) return Float64(Float64(x * log(y)) - y) end
function tmp = code(x, y, z, t) tmp = (x * log(y)) - y; end
code[x_, y_, z_, t_] := N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log y - y
\end{array}
Initial program 99.9%
associate-+l-99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in y around inf 59.3%
Final simplification59.3%
(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%
associate--l-99.9%
Simplified99.9%
Taylor expanded in y around inf 59.3%
add-log-exp23.2%
*-commutative23.2%
exp-to-pow23.2%
Applied egg-rr23.2%
Taylor expanded in y around inf 30.7%
neg-mul-130.7%
Simplified30.7%
Final simplification30.7%
herbie shell --seed 2024079
(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)))