C++ Math signbit()The function checks whether the sign of a given number is negative or not. If the sign of a number is negative, it returns 1 otherwise 0. The signbit() function can also be applied to infinite, NAN and zero value. SyntaxSuppose a number is 'x'.Syntax would be: Parameterx: It is a floating point value. Return valueIt returns 1, if the value of x is negative otherwise 0(false). Example 1Let's see the simple example when the value of x is 9. Output: value of x is :9 signbit(x) : 0 In this example, signbit(x) function determines that the value of x is positive. Therefore, it returns 0. Example 2Let's see the simple example when the value of x is -2. Output: value of x is : -2 signbit(x) : 1 In this example, signbit(x) function determines that the value of x is negative. Therefore, it returns 1. Example 3Let's see the simple example when the value of x is infinite. Output: value of x is : inf signbit(x) : 0 In this example, signbit(x) function determines that the value of x is positive infinite. Therefore, it returns 0 value. Next TopicC++ Math Functions |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India