
(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 (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 -2.6e+135) (not (<= x 9.6e+83))) (- (+ (log t) (* x (log y))) y) (- (- (log t) y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e+135) || !(x <= 9.6e+83)) {
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 <= (-2.6d+135)) .or. (.not. (x <= 9.6d+83))) 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 <= -2.6e+135) || !(x <= 9.6e+83)) {
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 <= -2.6e+135) or not (x <= 9.6e+83): 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 <= -2.6e+135) || !(x <= 9.6e+83)) tmp = Float64(Float64(log(t) + Float64(x * log(y))) - y); else tmp = Float64(Float64(log(t) - y) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.6e+135) || ~((x <= 9.6e+83))) 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, -2.6e+135], N[Not[LessEqual[x, 9.6e+83]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+135} \lor \neg \left(x \leq 9.6 \cdot 10^{+83}\right):\\
\;\;\;\;\left(\log t + x \cdot \log y\right) - y\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\end{array}
\end{array}
if x < -2.6e135 or 9.59999999999999965e83 < x Initial program 99.8%
Taylor expanded in z around 0 86.9%
if -2.6e135 < x < 9.59999999999999965e83Initial program 100.0%
Taylor expanded in x around 0 95.9%
associate--r+95.9%
Simplified95.9%
Final simplification92.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (log t) (* x (log y)))))
(if (<= x -2.3e+62)
(- t_1 z)
(if (<= x 1.15e+84) (- (- (log t) y) z) (- t_1 y)))))
double code(double x, double y, double z, double t) {
double t_1 = log(t) + (x * log(y));
double tmp;
if (x <= -2.3e+62) {
tmp = t_1 - z;
} else if (x <= 1.15e+84) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1 - 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 = log(t) + (x * log(y))
if (x <= (-2.3d+62)) then
tmp = t_1 - z
else if (x <= 1.15d+84) then
tmp = (log(t) - y) - z
else
tmp = t_1 - y
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 <= -2.3e+62) {
tmp = t_1 - z;
} else if (x <= 1.15e+84) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1 - y;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(t) + (x * math.log(y)) tmp = 0 if x <= -2.3e+62: tmp = t_1 - z elif x <= 1.15e+84: tmp = (math.log(t) - y) - z else: tmp = t_1 - y return tmp
function code(x, y, z, t) t_1 = Float64(log(t) + Float64(x * log(y))) tmp = 0.0 if (x <= -2.3e+62) tmp = Float64(t_1 - z); elseif (x <= 1.15e+84) tmp = Float64(Float64(log(t) - y) - z); else tmp = Float64(t_1 - y); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(t) + (x * log(y)); tmp = 0.0; if (x <= -2.3e+62) tmp = t_1 - z; elseif (x <= 1.15e+84) tmp = (log(t) - y) - z; else tmp = t_1 - y; 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, -2.3e+62], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[x, 1.15e+84], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(t$95$1 - y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t + x \cdot \log y\\
\mathbf{if}\;x \leq -2.3 \cdot 10^{+62}:\\
\;\;\;\;t_1 - z\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+84}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t_1 - y\\
\end{array}
\end{array}
if x < -2.29999999999999984e62Initial program 99.9%
Taylor expanded in y around 0 86.3%
if -2.29999999999999984e62 < x < 1.1499999999999999e84Initial program 100.0%
Taylor expanded in x around 0 97.0%
associate--r+97.0%
Simplified97.0%
if 1.1499999999999999e84 < x Initial program 99.6%
Taylor expanded in z around 0 89.7%
Final simplification93.4%
(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 (- (- (+ (log t) (* x (log y))) z) y))
double code(double x, double y, double z, double t) {
return ((log(t) + (x * log(y))) - 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 = ((log(t) + (x * log(y))) - z) - y
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(t) + (x * Math.log(y))) - z) - y;
}
def code(x, y, z, t): return ((math.log(t) + (x * math.log(y))) - z) - y
function code(x, y, z, t) return Float64(Float64(Float64(log(t) + Float64(x * log(y))) - z) - y) end
function tmp = code(x, y, z, t) tmp = ((log(t) + (x * log(y))) - z) - y; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log t + x \cdot \log y\right) - z\right) - y
\end{array}
Initial program 99.9%
Taylor expanded in z around 0 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -2.7e+135)
t_1
(if (<= x -2.5e-58)
(- y)
(if (<= x -6.9e-227)
(- z)
(if (<= x -6.6e-254)
(- y)
(if (<= x 1.32e-197) (- z) (if (<= x 3.3e+48) (- y) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -2.7e+135) {
tmp = t_1;
} else if (x <= -2.5e-58) {
tmp = -y;
} else if (x <= -6.9e-227) {
tmp = -z;
} else if (x <= -6.6e-254) {
tmp = -y;
} else if (x <= 1.32e-197) {
tmp = -z;
} else if (x <= 3.3e+48) {
tmp = -y;
} 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 <= (-2.7d+135)) then
tmp = t_1
else if (x <= (-2.5d-58)) then
tmp = -y
else if (x <= (-6.9d-227)) then
tmp = -z
else if (x <= (-6.6d-254)) then
tmp = -y
else if (x <= 1.32d-197) then
tmp = -z
else if (x <= 3.3d+48) then
tmp = -y
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 <= -2.7e+135) {
tmp = t_1;
} else if (x <= -2.5e-58) {
tmp = -y;
} else if (x <= -6.9e-227) {
tmp = -z;
} else if (x <= -6.6e-254) {
tmp = -y;
} else if (x <= 1.32e-197) {
tmp = -z;
} else if (x <= 3.3e+48) {
tmp = -y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -2.7e+135: tmp = t_1 elif x <= -2.5e-58: tmp = -y elif x <= -6.9e-227: tmp = -z elif x <= -6.6e-254: tmp = -y elif x <= 1.32e-197: tmp = -z elif x <= 3.3e+48: tmp = -y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -2.7e+135) tmp = t_1; elseif (x <= -2.5e-58) tmp = Float64(-y); elseif (x <= -6.9e-227) tmp = Float64(-z); elseif (x <= -6.6e-254) tmp = Float64(-y); elseif (x <= 1.32e-197) tmp = Float64(-z); elseif (x <= 3.3e+48) tmp = Float64(-y); 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 <= -2.7e+135) tmp = t_1; elseif (x <= -2.5e-58) tmp = -y; elseif (x <= -6.9e-227) tmp = -z; elseif (x <= -6.6e-254) tmp = -y; elseif (x <= 1.32e-197) tmp = -z; elseif (x <= 3.3e+48) tmp = -y; 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, -2.7e+135], t$95$1, If[LessEqual[x, -2.5e-58], (-y), If[LessEqual[x, -6.9e-227], (-z), If[LessEqual[x, -6.6e-254], (-y), If[LessEqual[x, 1.32e-197], (-z), If[LessEqual[x, 3.3e+48], (-y), t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{+135}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-58}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq -6.9 \cdot 10^{-227}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{-254}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{-197}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+48}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.69999999999999985e135 or 3.30000000000000023e48 < x Initial program 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around inf 72.0%
if -2.69999999999999985e135 < x < -2.49999999999999989e-58 or -6.89999999999999989e-227 < x < -6.60000000000000033e-254 or 1.32e-197 < x < 3.30000000000000023e48Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around inf 57.3%
neg-mul-157.3%
Simplified57.3%
if -2.49999999999999989e-58 < x < -6.89999999999999989e-227 or -6.60000000000000033e-254 < x < 1.32e-197Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in z around inf 53.5%
mul-1-neg53.5%
Simplified53.5%
Final simplification62.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (log t) y)))
(if (<= x -8e+135)
t_1
(if (<= x -8e-254)
t_2
(if (<= x -2.8e-272)
(- z)
(if (<= x 1.4e-291)
t_2
(if (<= x 7e-204) (- z) (if (<= x 6.8e+35) 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 <= -8e+135) {
tmp = t_1;
} else if (x <= -8e-254) {
tmp = t_2;
} else if (x <= -2.8e-272) {
tmp = -z;
} else if (x <= 1.4e-291) {
tmp = t_2;
} else if (x <= 7e-204) {
tmp = -z;
} else if (x <= 6.8e+35) {
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 <= (-8d+135)) then
tmp = t_1
else if (x <= (-8d-254)) then
tmp = t_2
else if (x <= (-2.8d-272)) then
tmp = -z
else if (x <= 1.4d-291) then
tmp = t_2
else if (x <= 7d-204) then
tmp = -z
else if (x <= 6.8d+35) 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 <= -8e+135) {
tmp = t_1;
} else if (x <= -8e-254) {
tmp = t_2;
} else if (x <= -2.8e-272) {
tmp = -z;
} else if (x <= 1.4e-291) {
tmp = t_2;
} else if (x <= 7e-204) {
tmp = -z;
} else if (x <= 6.8e+35) {
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 <= -8e+135: tmp = t_1 elif x <= -8e-254: tmp = t_2 elif x <= -2.8e-272: tmp = -z elif x <= 1.4e-291: tmp = t_2 elif x <= 7e-204: tmp = -z elif x <= 6.8e+35: 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 <= -8e+135) tmp = t_1; elseif (x <= -8e-254) tmp = t_2; elseif (x <= -2.8e-272) tmp = Float64(-z); elseif (x <= 1.4e-291) tmp = t_2; elseif (x <= 7e-204) tmp = Float64(-z); elseif (x <= 6.8e+35) 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 <= -8e+135) tmp = t_1; elseif (x <= -8e-254) tmp = t_2; elseif (x <= -2.8e-272) tmp = -z; elseif (x <= 1.4e-291) tmp = t_2; elseif (x <= 7e-204) tmp = -z; elseif (x <= 6.8e+35) 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, -8e+135], t$95$1, If[LessEqual[x, -8e-254], t$95$2, If[LessEqual[x, -2.8e-272], (-z), If[LessEqual[x, 1.4e-291], t$95$2, If[LessEqual[x, 7e-204], (-z), If[LessEqual[x, 6.8e+35], 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 -8 \cdot 10^{+135}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-254}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-272}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-291}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-204}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+35}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -7.99999999999999969e135 or 6.8000000000000002e35 < x Initial program 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around inf 72.0%
if -7.99999999999999969e135 < x < -7.9999999999999993e-254 or -2.79999999999999994e-272 < x < 1.4e-291 or 7.00000000000000054e-204 < x < 6.8000000000000002e35Initial program 100.0%
Taylor expanded in z around 0 70.7%
Taylor expanded in x around 0 68.1%
if -7.9999999999999993e-254 < x < -2.79999999999999994e-272 or 1.4e-291 < x < 7.00000000000000054e-204Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in z around inf 69.0%
mul-1-neg69.0%
Simplified69.0%
Final simplification69.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (log t) z)) (t_2 (* x (log y))) (t_3 (- (log t) y)))
(if (<= x -4.9e+135)
t_2
(if (<= x -2.5e-60)
t_3
(if (<= x -9e-227)
t_1
(if (<= x -4.6e-254)
t_3
(if (<= x 2.6e-203) t_1 (if (<= x 2.75e+47) t_3 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = log(t) - z;
double t_2 = x * log(y);
double t_3 = log(t) - y;
double tmp;
if (x <= -4.9e+135) {
tmp = t_2;
} else if (x <= -2.5e-60) {
tmp = t_3;
} else if (x <= -9e-227) {
tmp = t_1;
} else if (x <= -4.6e-254) {
tmp = t_3;
} else if (x <= 2.6e-203) {
tmp = t_1;
} else if (x <= 2.75e+47) {
tmp = t_3;
} 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) - z
t_2 = x * log(y)
t_3 = log(t) - y
if (x <= (-4.9d+135)) then
tmp = t_2
else if (x <= (-2.5d-60)) then
tmp = t_3
else if (x <= (-9d-227)) then
tmp = t_1
else if (x <= (-4.6d-254)) then
tmp = t_3
else if (x <= 2.6d-203) then
tmp = t_1
else if (x <= 2.75d+47) then
tmp = t_3
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) - z;
double t_2 = x * Math.log(y);
double t_3 = Math.log(t) - y;
double tmp;
if (x <= -4.9e+135) {
tmp = t_2;
} else if (x <= -2.5e-60) {
tmp = t_3;
} else if (x <= -9e-227) {
tmp = t_1;
} else if (x <= -4.6e-254) {
tmp = t_3;
} else if (x <= 2.6e-203) {
tmp = t_1;
} else if (x <= 2.75e+47) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(t) - z t_2 = x * math.log(y) t_3 = math.log(t) - y tmp = 0 if x <= -4.9e+135: tmp = t_2 elif x <= -2.5e-60: tmp = t_3 elif x <= -9e-227: tmp = t_1 elif x <= -4.6e-254: tmp = t_3 elif x <= 2.6e-203: tmp = t_1 elif x <= 2.75e+47: tmp = t_3 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(log(t) - z) t_2 = Float64(x * log(y)) t_3 = Float64(log(t) - y) tmp = 0.0 if (x <= -4.9e+135) tmp = t_2; elseif (x <= -2.5e-60) tmp = t_3; elseif (x <= -9e-227) tmp = t_1; elseif (x <= -4.6e-254) tmp = t_3; elseif (x <= 2.6e-203) tmp = t_1; elseif (x <= 2.75e+47) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(t) - z; t_2 = x * log(y); t_3 = log(t) - y; tmp = 0.0; if (x <= -4.9e+135) tmp = t_2; elseif (x <= -2.5e-60) tmp = t_3; elseif (x <= -9e-227) tmp = t_1; elseif (x <= -4.6e-254) tmp = t_3; elseif (x <= 2.6e-203) tmp = t_1; elseif (x <= 2.75e+47) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[x, -4.9e+135], t$95$2, If[LessEqual[x, -2.5e-60], t$95$3, If[LessEqual[x, -9e-227], t$95$1, If[LessEqual[x, -4.6e-254], t$95$3, If[LessEqual[x, 2.6e-203], t$95$1, If[LessEqual[x, 2.75e+47], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t - z\\
t_2 := x \cdot \log y\\
t_3 := \log t - y\\
\mathbf{if}\;x \leq -4.9 \cdot 10^{+135}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-60}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -9 \cdot 10^{-227}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.6 \cdot 10^{-254}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-203}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.75 \cdot 10^{+47}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -4.9000000000000001e135 or 2.7499999999999999e47 < x Initial program 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around inf 72.0%
if -4.9000000000000001e135 < x < -2.5000000000000001e-60 or -8.99999999999999986e-227 < x < -4.5999999999999997e-254 or 2.59999999999999975e-203 < x < 2.7499999999999999e47Initial program 100.0%
Taylor expanded in z around 0 75.8%
Taylor expanded in x around 0 71.9%
if -2.5000000000000001e-60 < x < -8.99999999999999986e-227 or -4.5999999999999997e-254 < x < 2.59999999999999975e-203Initial program 100.0%
Taylor expanded in y around 0 77.0%
Taylor expanded in x around 0 77.0%
Final simplification73.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4e+136) (not (<= x 1.15e+89))) (* x (log y)) (- (- (log t) y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4e+136) || !(x <= 1.15e+89)) {
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 <= (-4d+136)) .or. (.not. (x <= 1.15d+89))) 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 <= -4e+136) || !(x <= 1.15e+89)) {
tmp = x * Math.log(y);
} else {
tmp = (Math.log(t) - y) - z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4e+136) or not (x <= 1.15e+89): 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 <= -4e+136) || !(x <= 1.15e+89)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(log(t) - y) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4e+136) || ~((x <= 1.15e+89))) tmp = x * log(y); else tmp = (log(t) - y) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4e+136], N[Not[LessEqual[x, 1.15e+89]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+136} \lor \neg \left(x \leq 1.15 \cdot 10^{+89}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\end{array}
\end{array}
if x < -4.00000000000000023e136 or 1.1499999999999999e89 < x Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around inf 76.1%
if -4.00000000000000023e136 < x < 1.1499999999999999e89Initial program 100.0%
Taylor expanded in x around 0 95.4%
associate--r+95.4%
Simplified95.4%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (<= y 5.4e+107) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.4e+107) {
tmp = -z;
} 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 <= 5.4d+107) then
tmp = -z
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 <= 5.4e+107) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 5.4e+107: tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 5.4e+107) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 5.4e+107) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 5.4e+107], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.4 \cdot 10^{+107}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 5.4000000000000003e107Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in z around inf 36.7%
mul-1-neg36.7%
Simplified36.7%
if 5.4000000000000003e107 < y Initial program 99.9%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around inf 74.2%
neg-mul-174.2%
Simplified74.2%
Final simplification49.4%
(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 z around 0 99.9%
Taylor expanded in y around inf 31.2%
neg-mul-131.2%
Simplified31.2%
Final simplification31.2%
herbie shell --seed 2023230
(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)))