home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / MATH.ZIP / FABS.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.4 KB  |  46 lines

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