function D = eps(varargin)
%EPS Spacing of floating point numbers for codistributed array
%   E = EPS(D)
%   
%   Example:
%   spmd
%       N = 1000;
%       D = codistributed.ones(N,'single');
%       E = eps(D)
%   end
%   
%   returns E = eps('single')*codistributed.ones(N).
%   
%   See also EPS, CODISTRIBUTED, CODISTRIBUTED/ONES.


%   Copyright 2006-2021 The MathWorks, Inc.

narginchk(1,2);
if nargin>1
    if ~matlab.internal.datatypes.isScalarText(varargin{1}) ...
            || ~startsWith("like",varargin{1},"IgnoreCase",true)
        error(message("MATLAB:eps:mustBeLike"));
    end
    D = epsLike(varargin{2});
else
    D = codistributed.pElementwiseUnaryOp(@eps,varargin{1});
end

