C++ Math fabs()Last Updated : 17 Mar 2025 It computes the absolute value of a given number. Suppose a number is 'x': SyntaxParameterx: The value whose absolute value is to be determined. Return valueIt returns the absolute value of x. Example 1Let's see the simple example when the value of x is positive. Output: Value of x is :11.2 Absolute value of x is : 11.2 In this example, fabs() function determines the absolute value of x=11.2. Example 2Let's see the simple example when the value of x is negative. Output: Value of x is :-9.4 Absolute value of x is : 9.4 In this example, fabs() function computes the absolute value of x when the value of x is equal to -9.4. Next TopicC++ Math Functions |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India