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
  • 26,257
  • 48
  • 141
  • 229

1 Answers1

2

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

xtofl
  • 39,598
  • 12
  • 100
  • 188