Re: Rounding off double precision



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

.