function retVal = fixptCompMinMaxValue( DblValue, TotalBits, IsSigned, FixExp, FracSlope, Bias)
% fixptCompMinMaxValue
% 
%   Determine whether the input DblValue with the maximum value or 
% minimum value represented by the fixed point data type.
%
% 1 means input value is larger than to the fixed point maximum value. 
% 0.5 means input value is equal to the fixed point maximum value.
% 0 means input value is less than fixed point maximum value but greater than 
% fixed point minimum value
% -1 means that the input value is less than fixed point minimum value.
% -0.5 means input value is equal to the fixed point minimum value.
%
%   This function can compare fixed point value which can not be held by double.
%
% Usage:
%   retVal = fixptCompMinMaxValue( DblValue, TotalBits, IsSigned, FixExp, FracSlope, Bias)

%   Copyright 2007-2012 The MathWorks, Inc.

if nargin < 6
    DAStudio.error('modelexplorer:numericType:fixptCompValue');
else    
    retVal = compDblWithMinMaxFixPtValue(DblValue,double(TotalBits), double(IsSigned),...
        double(FixExp), double(FracSlope), double(Bias));
    if retVal == 0; return; end;
    
    fiObj = fi(DblValue,IsSigned,TotalBits,FracSlope,FixExp,Bias)  ;
    fiObjBigger = fi(DblValue,1,TotalBits+2,FracSlope,FixExp,Bias);
    if   fiObj == fiObjBigger
        retVal = retVal*0.5;
    end
end    
