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
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week