home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16847 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  861 b 

  1. Path: sparky!uunet!stanford.edu!morrow.stanford.edu!forsythe.stanford.edu!nova!maurer
  2. From: maurer@nova.stanford.edu (Michael Maurer)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: the abs() function in C
  5. Date: 20 Nov 92 08:04:09 GMT
  6. Organization: STAR Lab, Stanford University, California USA
  7. Lines: 15
  8. Distribution: world
  9. Message-ID: <maurer.722246649@magellan.stanford.edu>
  10. References: <pebi.722223424@zephyr.aem.umn.edu>
  11. NNTP-Posting-Host: magellan.stanford.edu
  12.  
  13. In <pebi.722223424@zephyr.aem.umn.edu> pebi@aem.umn.edu (Peter A. Bidian) writes:
  14.  
  15.  
  16. >Isn't abs(-2)=2 in C?
  17. >I always get 0.
  18.  
  19. >Confused!
  20.  
  21. >Peter
  22.  
  23. you probably want to say abs(-2.0), if the abs() function expects a
  24. floating point argument.  or abs((double)-2).
  25. --
  26. ______________________________________________________________________
  27. Michael Maurer          maurer@nova.stanford.edu        (415) 723-1024
  28.