2

Possible Duplicate:
Is there a standard sign function (signum, sgn) in C/C++?

I mean something like an analog to abs() which removes sign but in this case a function that takes any negative integer and returns -1, 1 for positive and 0 remains unchanged ?

(Yes, I know I could easily write that on my own, but I ask here if such a function is provided in a language.)

Community
  • 1
  • 1
rsk82
  • 28,217
  • 50
  • 150
  • 240

1 Answers1

2

No. It doesn't exist in the standard lib.

xtofl
  • 40,723
  • 12
  • 105
  • 192