home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / MATHSRC.ZIP / FABS.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  1.0 KB  |  44 lines

  1. /*------------------------------------------------------------------------
  2.  * filename - fabs.cas
  3.  *
  4.  * function(s)
  5.  *        fabs - absolute value
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #pragma inline
  18. #include <asmrules.h>
  19.  
  20. #include <_math.h>
  21. #include <math.h>
  22.  
  23.  
  24. /*--------------------------------------------------------------------------*
  25.  
  26. Name            fabs - absolute value
  27.  
  28. Usage           double fabs(double x);
  29.  
  30. Prototype in    math.h
  31.  
  32. Description     fabs calculates the absolute value of x, which may have any
  33.                 value.
  34.  
  35. Return value    fabs returns the absolute value of x.
  36.  
  37. *---------------------------------------------------------------------------*/
  38. double  fabs (double  x)
  39. {
  40. asm     FWAIT
  41. asm     and     BY0 (x [7]), 7Fh        /* remove any sign bit */
  42.         return  x;
  43. }
  44.