
(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 11 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.1e+55) (not (<= z 3.1e+63))) (- (- z) y) (- (+ (* x (log y)) (log t)) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.1e+55) || !(z <= 3.1e+63)) {
tmp = -z - y;
} else {
tmp = ((x * log(y)) + 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 <= (-1.1d+55)) .or. (.not. (z <= 3.1d+63))) then
tmp = -z - y
else
tmp = ((x * log(y)) + 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 <= -1.1e+55) || !(z <= 3.1e+63)) {
tmp = -z - y;
} else {
tmp = ((x * Math.log(y)) + Math.log(t)) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.1e+55) or not (z <= 3.1e+63): tmp = -z - y else: tmp = ((x * math.log(y)) + math.log(t)) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.1e+55) || !(z <= 3.1e+63)) tmp = Float64(Float64(-z) - y); else tmp = Float64(Float64(Float64(x * log(y)) + log(t)) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.1e+55) || ~((z <= 3.1e+63))) tmp = -z - y; else tmp = ((x * log(y)) + log(t)) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.1e+55], N[Not[LessEqual[z, 3.1e+63]], $MachinePrecision]], N[((-z) - y), $MachinePrecision], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+55} \lor \neg \left(z \leq 3.1 \cdot 10^{+63}\right):\\
\;\;\;\;\left(-z\right) - y\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \log y + \log t\right) - y\\
\end{array}
\end{array}
if z < -1.10000000000000005e55 or 3.1000000000000001e63 < z Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
associate--l+100.0%
*-commutative100.0%
add-sqr-sqrt54.8%
associate-*r*54.8%
fma-def54.8%
Applied egg-rr54.8%
Taylor expanded in z around inf 54.8%
Taylor expanded in x around 0 91.3%
distribute-lft-in91.3%
neg-mul-191.3%
unsub-neg91.3%
mul-1-neg91.3%
Simplified91.3%
if -1.10000000000000005e55 < z < 3.1000000000000001e63Initial program 99.8%
Taylor expanded in z around 0 96.1%
Final simplification94.1%
(FPCore (x y z t) :precision binary64 (if (<= y 20000000.0) (- (+ (* x (log y)) (log t)) z) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 20000000.0) {
tmp = ((x * log(y)) + log(t)) - 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 (y <= 20000000.0d0) then
tmp = ((x * log(y)) + log(t)) - 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 (y <= 20000000.0) {
tmp = ((x * Math.log(y)) + Math.log(t)) - z;
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 20000000.0: tmp = ((x * math.log(y)) + math.log(t)) - z else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 20000000.0) tmp = Float64(Float64(Float64(x * log(y)) + log(t)) - 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 (y <= 20000000.0) tmp = ((x * log(y)) + log(t)) - z; else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 20000000.0], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 20000000:\\
\;\;\;\;\left(x \cdot \log y + \log t\right) - z\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if y < 2e7Initial program 99.8%
Taylor expanded in y around 0 99.2%
if 2e7 < y Initial program 99.9%
Taylor expanded in x around 0 87.7%
Final simplification94.2%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -6e+46)
(not (or (<= x 7.5e+73) (and (not (<= x 3.7e+94)) (<= x 1.02e+138)))))
(* x (log y))
(- (- z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6e+46) || !((x <= 7.5e+73) || (!(x <= 3.7e+94) && (x <= 1.02e+138)))) {
tmp = x * log(y);
} else {
tmp = -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 <= (-6d+46)) .or. (.not. (x <= 7.5d+73) .or. (.not. (x <= 3.7d+94)) .and. (x <= 1.02d+138))) then
tmp = x * log(y)
else
tmp = -z - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6e+46) || !((x <= 7.5e+73) || (!(x <= 3.7e+94) && (x <= 1.02e+138)))) {
tmp = x * Math.log(y);
} else {
tmp = -z - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6e+46) or not ((x <= 7.5e+73) or (not (x <= 3.7e+94) and (x <= 1.02e+138))): tmp = x * math.log(y) else: tmp = -z - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6e+46) || !((x <= 7.5e+73) || (!(x <= 3.7e+94) && (x <= 1.02e+138)))) tmp = Float64(x * log(y)); else tmp = Float64(Float64(-z) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6e+46) || ~(((x <= 7.5e+73) || (~((x <= 3.7e+94)) && (x <= 1.02e+138))))) tmp = x * log(y); else tmp = -z - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6e+46], N[Not[Or[LessEqual[x, 7.5e+73], And[N[Not[LessEqual[x, 3.7e+94]], $MachinePrecision], LessEqual[x, 1.02e+138]]]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[((-z) - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+46} \lor \neg \left(x \leq 7.5 \cdot 10^{+73} \lor \neg \left(x \leq 3.7 \cdot 10^{+94}\right) \land x \leq 1.02 \cdot 10^{+138}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - y\\
\end{array}
\end{array}
if x < -6.00000000000000047e46 or 7.5e73 < x < 3.7000000000000001e94 or 1.02e138 < x Initial program 99.7%
Taylor expanded in x around inf 71.2%
if -6.00000000000000047e46 < x < 7.5e73 or 3.7000000000000001e94 < x < 1.02e138Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
associate--l+99.9%
*-commutative99.9%
add-sqr-sqrt56.1%
associate-*r*56.1%
fma-def56.1%
Applied egg-rr56.1%
Taylor expanded in z around inf 44.4%
Taylor expanded in x around 0 75.5%
distribute-lft-in75.5%
neg-mul-175.5%
unsub-neg75.5%
mul-1-neg75.5%
Simplified75.5%
Final simplification74.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -7.2e+53)
t_1
(if (<= x 4e+73)
(- (log t) (+ y z))
(if (or (<= x 8.8e+95) (not (<= x 2.2e+136))) t_1 (- (- z) y))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -7.2e+53) {
tmp = t_1;
} else if (x <= 4e+73) {
tmp = log(t) - (y + z);
} else if ((x <= 8.8e+95) || !(x <= 2.2e+136)) {
tmp = t_1;
} else {
tmp = -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) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if (x <= (-7.2d+53)) then
tmp = t_1
else if (x <= 4d+73) then
tmp = log(t) - (y + z)
else if ((x <= 8.8d+95) .or. (.not. (x <= 2.2d+136))) then
tmp = t_1
else
tmp = -z - 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 (x <= -7.2e+53) {
tmp = t_1;
} else if (x <= 4e+73) {
tmp = Math.log(t) - (y + z);
} else if ((x <= 8.8e+95) || !(x <= 2.2e+136)) {
tmp = t_1;
} else {
tmp = -z - y;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -7.2e+53: tmp = t_1 elif x <= 4e+73: tmp = math.log(t) - (y + z) elif (x <= 8.8e+95) or not (x <= 2.2e+136): tmp = t_1 else: tmp = -z - y return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -7.2e+53) tmp = t_1; elseif (x <= 4e+73) tmp = Float64(log(t) - Float64(y + z)); elseif ((x <= 8.8e+95) || !(x <= 2.2e+136)) tmp = t_1; else tmp = Float64(Float64(-z) - y); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -7.2e+53) tmp = t_1; elseif (x <= 4e+73) tmp = log(t) - (y + z); elseif ((x <= 8.8e+95) || ~((x <= 2.2e+136))) tmp = t_1; else tmp = -z - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.2e+53], t$95$1, If[LessEqual[x, 4e+73], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 8.8e+95], N[Not[LessEqual[x, 2.2e+136]], $MachinePrecision]], t$95$1, N[((-z) - y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+53}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+73}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+95} \lor \neg \left(x \leq 2.2 \cdot 10^{+136}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - y\\
\end{array}
\end{array}
if x < -7.2e53 or 3.99999999999999993e73 < x < 8.7999999999999996e95 or 2.1999999999999999e136 < x Initial program 99.7%
Taylor expanded in x around inf 71.2%
if -7.2e53 < x < 3.99999999999999993e73Initial program 99.9%
Taylor expanded in x around 0 94.9%
if 8.7999999999999996e95 < x < 2.1999999999999999e136Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
associate--l+100.0%
*-commutative100.0%
add-sqr-sqrt99.9%
associate-*r*99.5%
fma-def99.5%
Applied egg-rr99.5%
Taylor expanded in z around inf 99.5%
Taylor expanded in x around 0 73.8%
distribute-lft-in73.8%
neg-mul-173.8%
unsub-neg73.8%
mul-1-neg73.8%
Simplified73.8%
Final simplification85.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (- z) y)) (t_2 (* x (log y))))
(if (<= z -1.02e+55)
t_1
(if (<= z -1.65e-131)
t_2
(if (<= z 7.2e-22) (- (log t) y) (if (<= z 4.7e+32) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = -z - y;
double t_2 = x * log(y);
double tmp;
if (z <= -1.02e+55) {
tmp = t_1;
} else if (z <= -1.65e-131) {
tmp = t_2;
} else if (z <= 7.2e-22) {
tmp = log(t) - y;
} else if (z <= 4.7e+32) {
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 = -z - y
t_2 = x * log(y)
if (z <= (-1.02d+55)) then
tmp = t_1
else if (z <= (-1.65d-131)) then
tmp = t_2
else if (z <= 7.2d-22) then
tmp = log(t) - y
else if (z <= 4.7d+32) 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 = -z - y;
double t_2 = x * Math.log(y);
double tmp;
if (z <= -1.02e+55) {
tmp = t_1;
} else if (z <= -1.65e-131) {
tmp = t_2;
} else if (z <= 7.2e-22) {
tmp = Math.log(t) - y;
} else if (z <= 4.7e+32) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -z - y t_2 = x * math.log(y) tmp = 0 if z <= -1.02e+55: tmp = t_1 elif z <= -1.65e-131: tmp = t_2 elif z <= 7.2e-22: tmp = math.log(t) - y elif z <= 4.7e+32: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-z) - y) t_2 = Float64(x * log(y)) tmp = 0.0 if (z <= -1.02e+55) tmp = t_1; elseif (z <= -1.65e-131) tmp = t_2; elseif (z <= 7.2e-22) tmp = Float64(log(t) - y); elseif (z <= 4.7e+32) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -z - y; t_2 = x * log(y); tmp = 0.0; if (z <= -1.02e+55) tmp = t_1; elseif (z <= -1.65e-131) tmp = t_2; elseif (z <= 7.2e-22) tmp = log(t) - y; elseif (z <= 4.7e+32) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-z) - y), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.02e+55], t$95$1, If[LessEqual[z, -1.65e-131], t$95$2, If[LessEqual[z, 7.2e-22], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[z, 4.7e+32], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) - y\\
t_2 := x \cdot \log y\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-131}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-22}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+32}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.02000000000000002e55 or 4.70000000000000023e32 < z Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
associate--l+100.0%
*-commutative100.0%
add-sqr-sqrt54.0%
associate-*r*54.0%
fma-def54.0%
Applied egg-rr54.0%
Taylor expanded in z around inf 54.0%
Taylor expanded in x around 0 89.2%
distribute-lft-in89.2%
neg-mul-189.2%
unsub-neg89.2%
mul-1-neg89.2%
Simplified89.2%
if -1.02000000000000002e55 < z < -1.6500000000000001e-131 or 7.1999999999999996e-22 < z < 4.70000000000000023e32Initial program 99.7%
Taylor expanded in x around inf 62.5%
if -1.6500000000000001e-131 < z < 7.1999999999999996e-22Initial program 99.9%
Taylor expanded in x around 0 69.3%
Taylor expanded in z around 0 69.3%
Final simplification76.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.7e+52) (not (<= x 8e+71))) (- (* x (log y)) y) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.7e+52) || !(x <= 8e+71)) {
tmp = (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 <= (-1.7d+52)) .or. (.not. (x <= 8d+71))) then
tmp = (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 <= -1.7e+52) || !(x <= 8e+71)) {
tmp = (x * Math.log(y)) - y;
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.7e+52) or not (x <= 8e+71): tmp = (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 <= -1.7e+52) || !(x <= 8e+71)) tmp = Float64(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 <= -1.7e+52) || ~((x <= 8e+71))) tmp = (x * log(y)) - y; else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.7e+52], N[Not[LessEqual[x, 8e+71]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+52} \lor \neg \left(x \leq 8 \cdot 10^{+71}\right):\\
\;\;\;\;x \cdot \log y - y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -1.7e52 or 8.0000000000000003e71 < x Initial program 99.7%
associate-+l-99.7%
sub-neg99.7%
associate--l+99.7%
*-commutative99.7%
add-sqr-sqrt57.9%
associate-*r*57.8%
fma-def57.8%
Applied egg-rr57.8%
Taylor expanded in z around inf 57.8%
Taylor expanded in z around 0 80.1%
*-commutative80.1%
Simplified80.1%
if -1.7e52 < x < 8.0000000000000003e71Initial program 99.9%
Taylor expanded in x around 0 94.9%
Final simplification89.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.6e+46) (not (<= x 5e+56))) (- (* x (log y)) z) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e+46) || !(x <= 5e+56)) {
tmp = (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.6d+46)) .or. (.not. (x <= 5d+56))) then
tmp = (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.6e+46) || !(x <= 5e+56)) {
tmp = (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.6e+46) or not (x <= 5e+56): tmp = (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.6e+46) || !(x <= 5e+56)) tmp = 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.6e+46) || ~((x <= 5e+56))) tmp = (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.6e+46], N[Not[LessEqual[x, 5e+56]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+46} \lor \neg \left(x \leq 5 \cdot 10^{+56}\right):\\
\;\;\;\;x \cdot \log y - z\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -2.60000000000000013e46 or 5.00000000000000024e56 < x Initial program 99.7%
associate-+l-99.7%
sub-neg99.7%
associate--l+99.7%
*-commutative99.7%
add-sqr-sqrt59.9%
associate-*r*59.8%
fma-def59.8%
Applied egg-rr59.8%
Taylor expanded in z around inf 59.8%
Taylor expanded in y around 0 85.3%
*-commutative85.3%
Simplified85.3%
if -2.60000000000000013e46 < x < 5.00000000000000024e56Initial program 99.9%
Taylor expanded in x around 0 96.0%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (if (<= z -350000.0) (- z) (if (<= z 1.05e+61) (- y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -350000.0) {
tmp = -z;
} else if (z <= 1.05e+61) {
tmp = -y;
} 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 <= (-350000.0d0)) then
tmp = -z
else if (z <= 1.05d+61) then
tmp = -y
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 <= -350000.0) {
tmp = -z;
} else if (z <= 1.05e+61) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -350000.0: tmp = -z elif z <= 1.05e+61: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -350000.0) tmp = Float64(-z); elseif (z <= 1.05e+61) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -350000.0) tmp = -z; elseif (z <= 1.05e+61) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -350000.0], (-z), If[LessEqual[z, 1.05e+61], (-y), (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -350000:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+61}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -3.5e5 or 1.0500000000000001e61 < z Initial program 99.9%
Taylor expanded in z around inf 71.1%
neg-mul-171.1%
Simplified71.1%
if -3.5e5 < z < 1.0500000000000001e61Initial program 99.8%
Taylor expanded in y around inf 38.1%
neg-mul-138.1%
Simplified38.1%
Final simplification53.1%
(FPCore (x y z t) :precision binary64 (- (- z) y))
double code(double x, double y, double z, double t) {
return -z - 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 = -z - y
end function
public static double code(double x, double y, double z, double t) {
return -z - y;
}
def code(x, y, z, t): return -z - y
function code(x, y, z, t) return Float64(Float64(-z) - y) end
function tmp = code(x, y, z, t) tmp = -z - y; end
code[x_, y_, z_, t_] := N[((-z) - y), $MachinePrecision]
\begin{array}{l}
\\
\left(-z\right) - y
\end{array}
Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
associate--l+99.9%
*-commutative99.9%
add-sqr-sqrt54.9%
associate-*r*54.9%
fma-def54.9%
Applied egg-rr54.9%
Taylor expanded in z around inf 47.2%
Taylor expanded in x around 0 60.1%
distribute-lft-in60.1%
neg-mul-160.1%
unsub-neg60.1%
mul-1-neg60.1%
Simplified60.1%
Final simplification60.1%
(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 y around inf 27.6%
neg-mul-127.6%
Simplified27.6%
Final simplification27.6%
herbie shell --seed 2023290
(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)))