home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / ELMAT.DI$ / REALMIN.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  842 b   |  35 lines

  1. function xmin = realmin
  2. %REALMIN Smallest positive floating point number.
  3. %    x = realmin is the smallest positive normalized floating point
  4. %    number on this computer.  Anything smaller underflows or is
  5. %    an IEEE "denormal".
  6. %
  7. %    See also EPS, REALMAX, POW2.
  8.  
  9. %    C. Moler, 7-26-91, 6-10-92.
  10. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  11.  
  12. % Most computers have IEEE floating point arithmetic,
  13. % but there are a few important exceptions.
  14.  
  15. comp = computer;
  16.  
  17. if isieee
  18.    minexp = -1022;
  19. elseif strcmp(comp,'CRAY')
  20.    minexp = -8190;
  21. elseif strcmp(comp(1:3),'VAX')
  22.    % Check if D or G floating point
  23.    if comp(7) == 'D',
  24.       minexp = -128;
  25.    else
  26.       minexp = -1024;
  27.    end
  28. else
  29.    error('Unknown computer type.')
  30. end
  31.  
  32. % pow2(f,e) is f*2^e, computed by adding e to the exponent of f.
  33.  
  34. xmin = pow2(1,minexp);
  35.