C++ Math cos()30 Aug 2024 | 1 min read The function is used to find the cosine of an angle expressed in terms of radian. SyntaxConsider a radian 'x'. Syntax would be: Note: If the value passed is an integer type, then it is cast to double.Parameterx: Value specified in terms of radian. Return valueIt returns the cosine of an angle in the range of[-1,1]. Example 1Let's see a simple example when the value of x is positive. Output: Cosine of an angle is : 0.50046 In this example, cos() function calculates the cosine of an angle when the degree is equal to 60. Example 2Let's see a simple example when the value of x is negative. Output: Cosine of an angle is :0.000796327 In this example, cos() function finds the cosine of an angle when the value is negative but it remains the same as cos(-x) =cos(x). Next TopicC++ Math Functions |
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. Syntax Suppose a number is 'x'.Syntax would...
2 min read
C++ Math isinf() The function determines whether the number is infinite or not. It can be positive or negative infinite. If the number is infinite, it returns 1 otherwise 0. Syntax Suppose a number is 'x'. Syntax would be: bool isinf(float x); bool isinf(double x); bool isinf(long double x); bool isinf(integral x); Parameter x:...
1 min read
C++ Math isgreater() The isgreater() function determines whether the value of first argument given in function is greater than the value of second argument. If the first number is greater, it returns 1 otherwise 0. Note: If one or both the arguments of a function are NAN then...
2 min read
C++ Math lround() This function is used to round off the given value and cast to long integer. Syntax Suppose a number is 'x'. Syntax would be: long int lround(data_type x); Parameter x: The value which can be either float or double. Return value It returns the rounded value of x. The return type...
1 min read
C++ Math fmax() The function returns the maximum value between two numbers. Conditions: Consider two numbers 'x' and 'y'. If(x>y): It returns x. If(y>x): It returns y. if (x=nan): It returns y. if (y=nan): It returns x. Syntax float fmax(float x, float y); double fmax(double x, double y); long double fmax(long double x, long double y); promoted fmax(Arithmetic...
1 min read
C++ Math erf() The erf() function computes the error function value of a parameter passed to the function. Syntax Suppose a number is 'x': float erf( float x); double erf( double x); long double erf( long double x); double erf( integral x); Parameter x: It is a floating point value. Return value It returns the error function...
2 min read
C++ Math fabs() It computes the absolute value of a given number. Suppose a number is 'x': fabs(x) = |x|; Syntax float fabs(float x); double fabs(double x); int fabs(int x); Parameter x: The value whose absolute value is to be determined. Return value It returns the absolute value of x. Example 1 Let's see the simple example...
1 min read
C++ Math after() The after() function represents the representable value in a specific direction. Suppose two numbers are 'from' and 'to'. Therefore, the after() function finds the value of 'from' in the direction of 'to'. Syntax float after( float from, float to); double after( double from, double to); long double...
2 min read
C++ Math log2() The function computes the base 2 logarithm of a given number. Suppose a number is 'x': log2(x) = log2x; Syntax float log2(float x); double log2(double x); long double log2(long double x); double log2(integral x); Note: The return_type can be float, double or long double. Parameter x: The value whose logarithm is to be...
2 min read
C++ Math sinh() The function computes the hyperbolic sine of an angle given in radian. Mathematically, sinhx = (ex-e-x/2 Syntax Suppose the hyperbolic angle is x: float sinh(float x); double sinh(double x); long double sinh(long double x); double sinh(integral x); Parameter x: The value representing the hyperbolic anle. Return value It returns the hyperbolic sine of an angle. Example 1 Let's...
1 min read
We request you to subscribe our newsletter for upcoming updates.
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