function tf = allfinite(A)
%ALLFINITE True if every element of a codistributed array is finite.
%   TF = ALLFINITE(X)
%   
%   See also ALLFINITE, codistributed.
%   


%   Copyright 2021-2022 The MathWorks, Inc.


% Use the metadata for numeric-ish types. For everything else use the
% standard MATLAB code.
if isnumeric(A) || islogical(A) || ischar(A)
    tf = codistributed(~hasNaN(A) && ~hasInf(A));
else
    tf = all(isfinite(A), "all");
end
