function yfi = realmin(xfi)
% MATLAB Code Generation Library function for @fi/realmin.
%
% REALMIN(A) Value of fixed-point object with stored-integer 1.

% $INCLUDE(DOC) toolbox/eml/lib/fixedpoint/@embedded/@fi/realmin.m $
% Copyright 2002-2016 The MathWorks, Inc.
%#codegen
 
eml_allow_mx_inputs;
if eml_ambiguous_types
    yfi = coder.ignoreConst(0);
    return;
end

Tx    = eml_typeof(xfi);
Fx    = eml_fimath(xfi);
if isscaledtype(xfi)
    if isfixed(xfi)
        % Fixed FI
        % Set 1 in the least-significant bit of the integer equivalent type,
        % then reinterpret cast to the input type.
        ytemp = eml_dress(uint32(1),Tx,Fx);
    else
        ytemp = eml_cast(Tx.Slope+Tx.Bias,Tx,Fx);
    end
    if coder.const(eml_fimathislocal(xfi))
        yfi = ytemp;
    else
        yfi = eml_fimathislocal(ytemp,false);
    end  
elseif isfloat(xfi)
    % True Double or True Single FI
    dType = eml_fi_getDType(xfi);
    yfi   = eml_fimathislocal(eml_cast(realmin(dType),Tx,Fx),eml_fimathislocal(xfi));
else
    % FI datatype not supported
    eml_fi_assert_dataTypeNotSupported('REALMIN');
end
