
(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 12 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 (fma x (log y) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (log(t) - (y + z)));
}
function code(x, y, z, t) return fma(x, log(y), Float64(log(t) - Float64(y + z))) end
code[x_, y_, z_, t_] := N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \log t - \left(y + z\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate--l-99.9%
associate-+r-99.9%
+-commutative99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8.6e+14) (not (<= x 7.6e+56))) (- (+ (log t) (* x (log y))) y) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.6e+14) || !(x <= 7.6e+56)) {
tmp = (log(t) + (x * log(y))) - y;
} 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 <= (-8.6d+14)) .or. (.not. (x <= 7.6d+56))) then
tmp = (log(t) + (x * log(y))) - y
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 <= -8.6e+14) || !(x <= 7.6e+56)) {
tmp = (Math.log(t) + (x * Math.log(y))) - y;
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8.6e+14) or not (x <= 7.6e+56): tmp = (math.log(t) + (x * math.log(y))) - y else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -8.6e+14) || !(x <= 7.6e+56)) tmp = Float64(Float64(log(t) + Float64(x * log(y))) - y); 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 <= -8.6e+14) || ~((x <= 7.6e+56))) tmp = (log(t) + (x * log(y))) - y; else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -8.6e+14], N[Not[LessEqual[x, 7.6e+56]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{+14} \lor \neg \left(x \leq 7.6 \cdot 10^{+56}\right):\\
\;\;\;\;\left(\log t + x \cdot \log y\right) - y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -8.6e14 or 7.59999999999999991e56 < x Initial program 99.7%
Taylor expanded in z around 0 85.2%
if -8.6e14 < x < 7.59999999999999991e56Initial program 100.0%
Taylor expanded in x around 0 99.4%
Final simplification93.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (log t) (* x (log y)))))
(if (<= x -3.9e+14)
(- t_1 y)
(if (<= x 4.2e+61) (- (log t) (+ y z)) (- t_1 z)))))
double code(double x, double y, double z, double t) {
double t_1 = log(t) + (x * log(y));
double tmp;
if (x <= -3.9e+14) {
tmp = t_1 - y;
} else if (x <= 4.2e+61) {
tmp = log(t) - (y + z);
} else {
tmp = t_1 - 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 = log(t) + (x * log(y))
if (x <= (-3.9d+14)) then
tmp = t_1 - y
else if (x <= 4.2d+61) then
tmp = log(t) - (y + z)
else
tmp = t_1 - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(t) + (x * Math.log(y));
double tmp;
if (x <= -3.9e+14) {
tmp = t_1 - y;
} else if (x <= 4.2e+61) {
tmp = Math.log(t) - (y + z);
} else {
tmp = t_1 - z;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(t) + (x * math.log(y)) tmp = 0 if x <= -3.9e+14: tmp = t_1 - y elif x <= 4.2e+61: tmp = math.log(t) - (y + z) else: tmp = t_1 - z return tmp
function code(x, y, z, t) t_1 = Float64(log(t) + Float64(x * log(y))) tmp = 0.0 if (x <= -3.9e+14) tmp = Float64(t_1 - y); elseif (x <= 4.2e+61) tmp = Float64(log(t) - Float64(y + z)); else tmp = Float64(t_1 - z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(t) + (x * log(y)); tmp = 0.0; if (x <= -3.9e+14) tmp = t_1 - y; elseif (x <= 4.2e+61) tmp = log(t) - (y + z); else tmp = t_1 - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.9e+14], N[(t$95$1 - y), $MachinePrecision], If[LessEqual[x, 4.2e+61], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t + x \cdot \log y\\
\mathbf{if}\;x \leq -3.9 \cdot 10^{+14}:\\
\;\;\;\;t_1 - y\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+61}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 - z\\
\end{array}
\end{array}
if x < -3.9e14Initial program 99.7%
Taylor expanded in z around 0 86.9%
if -3.9e14 < x < 4.2000000000000002e61Initial program 100.0%
Taylor expanded in x around 0 99.4%
if 4.2000000000000002e61 < x Initial program 99.7%
Taylor expanded in y around 0 85.5%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (- (log t) (+ z (+ y (* x (log (/ 1.0 y)))))))
double code(double x, double y, double z, double t) {
return log(t) - (z + (y + (x * log((1.0 / 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 + (x * log((1.0d0 / y)))))
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) - (z + (y + (x * Math.log((1.0 / y)))));
}
def code(x, y, z, t): return math.log(t) - (z + (y + (x * math.log((1.0 / y)))))
function code(x, y, z, t) return Float64(log(t) - Float64(z + Float64(y + Float64(x * log(Float64(1.0 / y)))))) end
function tmp = code(x, y, z, t) tmp = log(t) - (z + (y + (x * log((1.0 / y))))); end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] - N[(z + N[(y + N[(x * N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log t - \left(z + \left(y + x \cdot \log \left(\frac{1}{y}\right)\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (+ (log t) (- (- (* x (log y)) y) z)))
double code(double x, double y, double z, double t) {
return log(t) + (((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 = log(t) + (((x * log(y)) - y) - z)
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) + (((x * Math.log(y)) - y) - z);
}
def code(x, y, z, t): return math.log(t) + (((x * math.log(y)) - y) - z)
function code(x, y, z, t) return Float64(log(t) + Float64(Float64(Float64(x * log(y)) - y) - z)) end
function tmp = code(x, y, z, t) tmp = log(t) + (((x * log(y)) - y) - z); end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] + N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log t + \left(\left(x \cdot \log y - y\right) - z\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (log t) y)) (t_2 (* x (log y))) (t_3 (- (log t) z)))
(if (<= x -1.72e+16)
t_2
(if (<= x -2.7e-85)
t_3
(if (<= x -5.7e-111)
t_1
(if (<= x -5.4e-263) t_3 (if (<= x 5.5e+66) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = log(t) - y;
double t_2 = x * log(y);
double t_3 = log(t) - z;
double tmp;
if (x <= -1.72e+16) {
tmp = t_2;
} else if (x <= -2.7e-85) {
tmp = t_3;
} else if (x <= -5.7e-111) {
tmp = t_1;
} else if (x <= -5.4e-263) {
tmp = t_3;
} else if (x <= 5.5e+66) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = log(t) - y
t_2 = x * log(y)
t_3 = log(t) - z
if (x <= (-1.72d+16)) then
tmp = t_2
else if (x <= (-2.7d-85)) then
tmp = t_3
else if (x <= (-5.7d-111)) then
tmp = t_1
else if (x <= (-5.4d-263)) then
tmp = t_3
else if (x <= 5.5d+66) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(t) - y;
double t_2 = x * Math.log(y);
double t_3 = Math.log(t) - z;
double tmp;
if (x <= -1.72e+16) {
tmp = t_2;
} else if (x <= -2.7e-85) {
tmp = t_3;
} else if (x <= -5.7e-111) {
tmp = t_1;
} else if (x <= -5.4e-263) {
tmp = t_3;
} else if (x <= 5.5e+66) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(t) - y t_2 = x * math.log(y) t_3 = math.log(t) - z tmp = 0 if x <= -1.72e+16: tmp = t_2 elif x <= -2.7e-85: tmp = t_3 elif x <= -5.7e-111: tmp = t_1 elif x <= -5.4e-263: tmp = t_3 elif x <= 5.5e+66: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(log(t) - y) t_2 = Float64(x * log(y)) t_3 = Float64(log(t) - z) tmp = 0.0 if (x <= -1.72e+16) tmp = t_2; elseif (x <= -2.7e-85) tmp = t_3; elseif (x <= -5.7e-111) tmp = t_1; elseif (x <= -5.4e-263) tmp = t_3; elseif (x <= 5.5e+66) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(t) - y; t_2 = x * log(y); t_3 = log(t) - z; tmp = 0.0; if (x <= -1.72e+16) tmp = t_2; elseif (x <= -2.7e-85) tmp = t_3; elseif (x <= -5.7e-111) tmp = t_1; elseif (x <= -5.4e-263) tmp = t_3; elseif (x <= 5.5e+66) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[x, -1.72e+16], t$95$2, If[LessEqual[x, -2.7e-85], t$95$3, If[LessEqual[x, -5.7e-111], t$95$1, If[LessEqual[x, -5.4e-263], t$95$3, If[LessEqual[x, 5.5e+66], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t - y\\
t_2 := x \cdot \log y\\
t_3 := \log t - z\\
\mathbf{if}\;x \leq -1.72 \cdot 10^{+16}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-85}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -5.7 \cdot 10^{-111}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{-263}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+66}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -1.72e16 or 5.5e66 < x Initial program 99.7%
Taylor expanded in z around 0 85.1%
Taylor expanded in y around 0 66.9%
Taylor expanded in x around inf 66.9%
if -1.72e16 < x < -2.7000000000000001e-85 or -5.7e-111 < x < -5.40000000000000007e-263Initial program 100.0%
Taylor expanded in y around 0 81.1%
associate--l+81.1%
fma-def81.1%
Simplified81.1%
Taylor expanded in x around 0 81.0%
if -2.7000000000000001e-85 < x < -5.7e-111 or -5.40000000000000007e-263 < x < 5.5e66Initial program 100.0%
Taylor expanded in z around 0 66.3%
Taylor expanded in x around 0 65.2%
Final simplification69.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -52000000000000.0)
t_1
(if (<= x -4e-177)
(- z)
(if (<= x 1.06e-226) (log t) (if (<= x 3.9e+86) (- z) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -52000000000000.0) {
tmp = t_1;
} else if (x <= -4e-177) {
tmp = -z;
} else if (x <= 1.06e-226) {
tmp = log(t);
} else if (x <= 3.9e+86) {
tmp = -z;
} else {
tmp = t_1;
}
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 (x <= (-52000000000000.0d0)) then
tmp = t_1
else if (x <= (-4d-177)) then
tmp = -z
else if (x <= 1.06d-226) then
tmp = log(t)
else if (x <= 3.9d+86) then
tmp = -z
else
tmp = t_1
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 (x <= -52000000000000.0) {
tmp = t_1;
} else if (x <= -4e-177) {
tmp = -z;
} else if (x <= 1.06e-226) {
tmp = Math.log(t);
} else if (x <= 3.9e+86) {
tmp = -z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -52000000000000.0: tmp = t_1 elif x <= -4e-177: tmp = -z elif x <= 1.06e-226: tmp = math.log(t) elif x <= 3.9e+86: tmp = -z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -52000000000000.0) tmp = t_1; elseif (x <= -4e-177) tmp = Float64(-z); elseif (x <= 1.06e-226) tmp = log(t); elseif (x <= 3.9e+86) tmp = Float64(-z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -52000000000000.0) tmp = t_1; elseif (x <= -4e-177) tmp = -z; elseif (x <= 1.06e-226) tmp = log(t); elseif (x <= 3.9e+86) tmp = -z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -52000000000000.0], t$95$1, If[LessEqual[x, -4e-177], (-z), If[LessEqual[x, 1.06e-226], N[Log[t], $MachinePrecision], If[LessEqual[x, 3.9e+86], (-z), t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -52000000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-177}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-226}:\\
\;\;\;\;\log t\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+86}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -5.2e13 or 3.9000000000000002e86 < x Initial program 99.7%
Taylor expanded in z around 0 86.3%
Taylor expanded in y around 0 67.5%
Taylor expanded in x around inf 67.5%
if -5.2e13 < x < -3.99999999999999981e-177 or 1.0599999999999999e-226 < x < 3.9000000000000002e86Initial program 100.0%
Taylor expanded in y around 0 60.8%
associate--l+60.8%
fma-def60.8%
Simplified60.8%
Taylor expanded in z around inf 44.1%
neg-mul-144.1%
Simplified44.1%
if -3.99999999999999981e-177 < x < 1.0599999999999999e-226Initial program 100.0%
Taylor expanded in z around 0 72.2%
Taylor expanded in x around 0 72.2%
Taylor expanded in y around 0 47.5%
Final simplification54.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (log t) y)))
(if (<= x -900000000000.0)
t_1
(if (<= x -2.2e-121)
t_2
(if (<= x -1.5e-166) (- z) (if (<= x 2.5e+60) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double t_2 = log(t) - y;
double tmp;
if (x <= -900000000000.0) {
tmp = t_1;
} else if (x <= -2.2e-121) {
tmp = t_2;
} else if (x <= -1.5e-166) {
tmp = -z;
} else if (x <= 2.5e+60) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = x * log(y)
t_2 = log(t) - y
if (x <= (-900000000000.0d0)) then
tmp = t_1
else if (x <= (-2.2d-121)) then
tmp = t_2
else if (x <= (-1.5d-166)) then
tmp = -z
else if (x <= 2.5d+60) then
tmp = t_2
else
tmp = t_1
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 t_2 = Math.log(t) - y;
double tmp;
if (x <= -900000000000.0) {
tmp = t_1;
} else if (x <= -2.2e-121) {
tmp = t_2;
} else if (x <= -1.5e-166) {
tmp = -z;
} else if (x <= 2.5e+60) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) t_2 = math.log(t) - y tmp = 0 if x <= -900000000000.0: tmp = t_1 elif x <= -2.2e-121: tmp = t_2 elif x <= -1.5e-166: tmp = -z elif x <= 2.5e+60: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) t_2 = Float64(log(t) - y) tmp = 0.0 if (x <= -900000000000.0) tmp = t_1; elseif (x <= -2.2e-121) tmp = t_2; elseif (x <= -1.5e-166) tmp = Float64(-z); elseif (x <= 2.5e+60) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); t_2 = log(t) - y; tmp = 0.0; if (x <= -900000000000.0) tmp = t_1; elseif (x <= -2.2e-121) tmp = t_2; elseif (x <= -1.5e-166) tmp = -z; elseif (x <= 2.5e+60) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[x, -900000000000.0], t$95$1, If[LessEqual[x, -2.2e-121], t$95$2, If[LessEqual[x, -1.5e-166], (-z), If[LessEqual[x, 2.5e+60], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \log t - y\\
\mathbf{if}\;x \leq -900000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-121}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-166}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+60}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -9e11 or 2.49999999999999987e60 < x Initial program 99.7%
Taylor expanded in z around 0 84.4%
Taylor expanded in y around 0 66.3%
Taylor expanded in x around inf 66.3%
if -9e11 < x < -2.20000000000000021e-121 or -1.5000000000000001e-166 < x < 2.49999999999999987e60Initial program 100.0%
Taylor expanded in z around 0 65.1%
Taylor expanded in x around 0 64.4%
if -2.20000000000000021e-121 < x < -1.5000000000000001e-166Initial program 100.0%
Taylor expanded in y around 0 91.0%
associate--l+91.0%
fma-def91.0%
Simplified91.0%
Taylor expanded in z around inf 82.1%
neg-mul-182.1%
Simplified82.1%
Final simplification66.0%
(FPCore (x y z t) :precision binary64 (if (<= x -2.4e+163) (* x (log y)) (if (<= x 1.75e+165) (- (log t) (+ y z)) (* x (- (log (/ 1.0 y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e+163) {
tmp = x * log(y);
} else if (x <= 1.75e+165) {
tmp = log(t) - (y + z);
} else {
tmp = x * -log((1.0 / 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 <= (-2.4d+163)) then
tmp = x * log(y)
else if (x <= 1.75d+165) then
tmp = log(t) - (y + z)
else
tmp = x * -log((1.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e+163) {
tmp = x * Math.log(y);
} else if (x <= 1.75e+165) {
tmp = Math.log(t) - (y + z);
} else {
tmp = x * -Math.log((1.0 / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.4e+163: tmp = x * math.log(y) elif x <= 1.75e+165: tmp = math.log(t) - (y + z) else: tmp = x * -math.log((1.0 / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.4e+163) tmp = Float64(x * log(y)); elseif (x <= 1.75e+165) tmp = Float64(log(t) - Float64(y + z)); else tmp = Float64(x * Float64(-log(Float64(1.0 / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.4e+163) tmp = x * log(y); elseif (x <= 1.75e+165) tmp = log(t) - (y + z); else tmp = x * -log((1.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.4e+163], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.75e+165], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(x * (-N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+163}:\\
\;\;\;\;x \cdot \log y\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+165}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-\log \left(\frac{1}{y}\right)\right)\\
\end{array}
\end{array}
if x < -2.3999999999999999e163Initial program 99.7%
Taylor expanded in z around 0 92.4%
Taylor expanded in y around 0 79.0%
Taylor expanded in x around inf 79.0%
if -2.3999999999999999e163 < x < 1.74999999999999998e165Initial program 100.0%
Taylor expanded in x around 0 89.9%
if 1.74999999999999998e165 < x Initial program 99.6%
Taylor expanded in z around 0 90.2%
Taylor expanded in y around 0 79.2%
Taylor expanded in y around inf 79.3%
Taylor expanded in x around inf 79.3%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.15e+163) (not (<= x 4.1e+164))) (* x (log y)) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.15e+163) || !(x <= 4.1e+164)) {
tmp = x * log(y);
} 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.15d+163)) .or. (.not. (x <= 4.1d+164))) then
tmp = x * log(y)
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.15e+163) || !(x <= 4.1e+164)) {
tmp = x * Math.log(y);
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.15e+163) or not (x <= 4.1e+164): tmp = x * math.log(y) else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.15e+163) || !(x <= 4.1e+164)) tmp = Float64(x * log(y)); 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.15e+163) || ~((x <= 4.1e+164))) tmp = x * log(y); else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.15e+163], N[Not[LessEqual[x, 4.1e+164]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{+163} \lor \neg \left(x \leq 4.1 \cdot 10^{+164}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -2.1500000000000001e163 or 4.10000000000000016e164 < x Initial program 99.6%
Taylor expanded in z around 0 91.5%
Taylor expanded in y around 0 79.1%
Taylor expanded in x around inf 79.1%
if -2.1500000000000001e163 < x < 4.10000000000000016e164Initial program 100.0%
Taylor expanded in x around 0 89.9%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1800000000000.0) (- z) (if (<= z 3.7e-36) (log t) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1800000000000.0) {
tmp = -z;
} else if (z <= 3.7e-36) {
tmp = log(t);
} else {
tmp = -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 (z <= (-1800000000000.0d0)) then
tmp = -z
else if (z <= 3.7d-36) then
tmp = log(t)
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1800000000000.0) {
tmp = -z;
} else if (z <= 3.7e-36) {
tmp = Math.log(t);
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1800000000000.0: tmp = -z elif z <= 3.7e-36: tmp = math.log(t) else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1800000000000.0) tmp = Float64(-z); elseif (z <= 3.7e-36) tmp = log(t); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1800000000000.0) tmp = -z; elseif (z <= 3.7e-36) tmp = log(t); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1800000000000.0], (-z), If[LessEqual[z, 3.7e-36], N[Log[t], $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1800000000000:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-36}:\\
\;\;\;\;\log t\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -1.8e12 or 3.70000000000000002e-36 < z Initial program 99.9%
Taylor expanded in y around 0 74.4%
associate--l+74.4%
fma-def74.4%
Simplified74.4%
Taylor expanded in z around inf 52.6%
neg-mul-152.6%
Simplified52.6%
if -1.8e12 < z < 3.70000000000000002e-36Initial program 99.9%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around 0 62.8%
Taylor expanded in y around 0 30.0%
Final simplification42.3%
(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%
Taylor expanded in y around 0 70.9%
associate--l+70.9%
fma-def70.9%
Simplified70.9%
Taylor expanded in z around inf 29.8%
neg-mul-129.8%
Simplified29.8%
Final simplification29.8%
herbie shell --seed 2023181
(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)))