
(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 (if (or (<= x -2.8e+132) (not (<= x 195000000000.0))) (+ (log t) (- (* x (log y)) z)) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.8e+132) || !(x <= 195000000000.0)) {
tmp = log(t) + ((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 <= (-2.8d+132)) .or. (.not. (x <= 195000000000.0d0))) then
tmp = log(t) + ((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 <= -2.8e+132) || !(x <= 195000000000.0)) {
tmp = Math.log(t) + ((x * Math.log(y)) - z);
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.8e+132) or not (x <= 195000000000.0): tmp = math.log(t) + ((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 <= -2.8e+132) || !(x <= 195000000000.0)) tmp = Float64(log(t) + 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 <= -2.8e+132) || ~((x <= 195000000000.0))) tmp = log(t) + ((x * log(y)) - z); else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.8e+132], N[Not[LessEqual[x, 195000000000.0]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+132} \lor \neg \left(x \leq 195000000000\right):\\
\;\;\;\;\log t + \left(x \cdot \log y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -2.7999999999999999e132 or 1.95e11 < x Initial program 99.7%
add-sqr-sqrt40.6%
pow240.6%
Applied egg-rr40.6%
Taylor expanded in y around 0 44.5%
unpow244.5%
add-sqr-sqrt90.1%
*-commutative90.1%
Applied egg-rr90.1%
if -2.7999999999999999e132 < x < 1.95e11Initial program 100.0%
Taylor expanded in x around 0 94.1%
neg-mul-194.1%
Simplified94.1%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.3e+132) (not (<= x 6.8e+52))) (+ (* x (log y)) (log t)) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.3e+132) || !(x <= 6.8e+52)) {
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 <= (-5.3d+132)) .or. (.not. (x <= 6.8d+52))) 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 <= -5.3e+132) || !(x <= 6.8e+52)) {
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 <= -5.3e+132) or not (x <= 6.8e+52): 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 <= -5.3e+132) || !(x <= 6.8e+52)) 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 <= -5.3e+132) || ~((x <= 6.8e+52))) 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, -5.3e+132], N[Not[LessEqual[x, 6.8e+52]], $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 -5.3 \cdot 10^{+132} \lor \neg \left(x \leq 6.8 \cdot 10^{+52}\right):\\
\;\;\;\;x \cdot \log y + \log t\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -5.3e132 or 6.8e52 < x Initial program 99.7%
add-sqr-sqrt43.2%
pow243.2%
Applied egg-rr43.2%
Taylor expanded in y around 0 45.8%
unpow245.8%
add-sqr-sqrt90.5%
*-commutative90.5%
Applied egg-rr90.5%
Taylor expanded in z around 0 75.9%
if -5.3e132 < x < 6.8e52Initial program 100.0%
Taylor expanded in x around 0 92.6%
neg-mul-192.6%
Simplified92.6%
Final simplification86.0%
(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 65.4%
neg-mul-165.4%
Simplified65.4%
Final simplification65.4%
(FPCore (x y z t) :precision binary64 (- (log t) z))
double code(double x, double y, double z, double t) {
return log(t) - 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) - z
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) - z;
}
def code(x, y, z, t): return math.log(t) - z
function code(x, y, z, t) return Float64(log(t) - z) end
function tmp = code(x, y, z, t) tmp = log(t) - z; end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\log t - z
\end{array}
Initial program 99.9%
add-sqr-sqrt23.3%
pow223.3%
Applied egg-rr23.3%
Taylor expanded in y around 0 32.0%
unpow232.0%
add-sqr-sqrt71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in x around 0 37.4%
Final simplification37.4%
(FPCore (x y z t) :precision binary64 (- z))
double code(double x, double y, double z, double t) {
return -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 = -z
end function
public static double code(double x, double y, double z, double t) {
return -z;
}
def code(x, y, z, t): return -z
function code(x, y, z, t) return Float64(-z) end
function tmp = code(x, y, z, t) tmp = -z; end
code[x_, y_, z_, t_] := (-z)
\begin{array}{l}
\\
-z
\end{array}
Initial program 99.9%
add-sqr-sqrt23.3%
pow223.3%
Applied egg-rr23.3%
Taylor expanded in y around 0 32.0%
unpow232.0%
add-sqr-sqrt71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in z around inf 30.5%
neg-mul-130.5%
Simplified30.5%
Final simplification30.5%
herbie shell --seed 2023268
(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)))