home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / LABS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  1.3 KB  |  37 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - labs.c
  3.  *
  4.  * function(s)
  5.  *        labs - gives long absolute value
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*[]------------------------------------------------------------[]*/
  9. /*|                                                              |*/
  10. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  11. /*|                                                              |*/
  12. /*|                                                              |*/
  13. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  14. /*|     All Rights Reserved.                                     |*/
  15. /*|                                                              |*/
  16. /*[]------------------------------------------------------------[]*/
  17.  
  18. #include <stdlib.h>
  19.  
  20. /*---------------------------------------------------------------------*
  21.  
  22. Name        labs - gives long absolute value
  23.  
  24. Usage        long labs(long n);
  25.  
  26. Prototype in    stdlib.h
  27.  
  28. Description    calculates the absolute value of n, a long integer.
  29.  
  30. Return value    the absolute value of n.
  31.  
  32. *---------------------------------------------------------------------*/
  33. long labs(long n)
  34. {
  35.     return(n < 0 ? -n : n);
  36. }
  37.