function y = abs(x)
%MATLAB Code Generation Library Function

%   Copyright 2002-2019 The MathWorks, Inc.
%#codegen

coder.internal.allowHalfInputs;
eml_invariant(nargin > 0,'MATLAB:minrhs');
eml_invariant(coder.internal.isBuiltInNumeric(x) || isa(x,'half') || ...
    ischar(x) || islogical(x), ...
    'Coder:toolbox:unsupportedClass',mfilename,class(x));
eml_invariant(isfloat(x) || isreal(x),'MATLAB:complexInteger');
if ischar(x) || islogical(x)
    zero = 0;
else
    zero = zeros('like',real(x));
end
y = coder.internal.applyScalarFunction(mfilename,zero,@coder.internal.scalar.abs,x);
