02-21-04 05:33 AM
In article <4036B2B8.302F3738@alcyone.com>,
Erik Max Francis <max@alcyone.com> wrote:
>"Gregory L. Hansen" wrote:
>
>
>#define sgn(x) ((x) > 0 ? +1 : (x) < 0 ? -1 : 0)
For some reason, the ()?x:y construct has always made me nervous, I'd
never used it to do anything real, and it didn't occur to me at all. But
it seems to work. I only needed it once, so I skipped the #define part.
But I felt sure that a function like that would have been included in the
math library.
--
"When the fool walks through the street, in his lack of understanding he
calls everything foolish." -- Ecclesiastes 10:3, New American Bible
[ Post a follow-up to this message ]
|