home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!daffodil!wyvern!waggen!alpha
- From: alpha@waggen.twuug.com (Joe Wright)
- Subject: Re: the abs() function in C
- Message-ID: <1992Nov22.022357.20377@waggen.twuug.com>
- Organization: ALPHA, Box 68621, Va. Beach, VA 23455
- X-Newsreader: TIN [version 1.1 PL6]
- References: <pebi.722223424@zephyr.aem.umn.edu>
- Date: Sun, 22 Nov 1992 02:23:57 GMT
- Lines: 19
-
- Peter A. Bidian (pebi@aem.umn.edu) wrote:
- :
- : Isn't abs(-2)=2 in C?
- : I always get 0.
- :
- : Confused!
-
- This is almost always a macro like:
-
- #define abs(x) ((x)>=0 ? (x) : -(x))
-
- Some systems have abs(), fabs(), labs(), etc., as functions.
- Look around. Maybe you can simply declare it ..
-
- extern int abs();
-
- --
- Joe Wright alpha@waggen.twuug.com
- "If we could only see the source code.." (Dave Olson)
-