Re: Rounding off double precision
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Sun, 30 Mar 2008 22:06:29 -0800
Louis Krupp wrote:
(snip)
I think you mean MIN instead of ABS. ABS would be something like:
#define ABS(x) ((x) >= 0 ? (x) : -(x))
Unlike a FORTRAN statement function, which this vaguely resembles, macros that use an argument in more than one place do weird things when passed an expression with side effects, e.g., ABS(x++).
Yes, both are often written as macros in C. I was thinking
about both and wrote something in between.
The side effects are something to remember, but it doesn't
take too long as long as you know it is a macro.
-- glen
.
- Follow-Ups:
- Re: Rounding off double precision
- From: Gerry Ford
- Re: Rounding off double precision
- References:
- Rounding off double precision
- From: Bamm
- Re: Rounding off double precision
- From: Bamm
- Re: Rounding off double precision
- From: Richard Maine
- Re: Rounding off double precision
- From: Bamm
- Re: Rounding off double precision
- From: e p chandler
- Re: Rounding off double precision
- From: Bamm
- Re: Rounding off double precision
- From: glen herrmannsfeldt
- Re: Rounding off double precision
- From: Charles Coldwell
- Re: Rounding off double precision
- From: glen herrmannsfeldt
- Re: Rounding off double precision
- From: Louis Krupp
- Rounding off double precision
- Prev by Date: Re: F2003 standard: Can Class(*) be used in generic proogramming?
- Next by Date: Re: Rounding off double precision
- Previous by thread: Re: Rounding off double precision
- Next by thread: Re: Rounding off double precision
- Index(es):