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

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

coder.internal.allowHalfInputs;
eml_invariant(nargin > 0,'MATLAB:minrhs');
if islogical(x) || ischar(x)
    y = double(x);
elseif isinteger(x)
    y = x;
else
    eml_invariant(coder.internal.isBuiltInNumeric(x) || isa(x,'half'), ...
        'Coder:toolbox:unsupportedClass',mfilename,class(x));
    y = coder.internal.applyScalarFunctionInPlace(mfilename,@coder.internal.scalar.fix,x);
end