C++ Math fmod()30 Aug 2024 | 2 min read The function finds the floating point remainder of numerator/denominator and rounded towards zero. Formula of fmod:where 't' is the truncated value of numerator/denominator. SyntaxConsider a numerator 'n' and denominator 'd'. Syntax would be: Parametern:The value of numerator. d:The value of denominator Return valueIt returns the floating point remainder of n/d. Note: If the value of denominator is zero, then fmod() function will return NAN(Not a Number).Example 1Let's see a simple example of having same types of arguments. Output: The values of numerator and denominator are :4.2 , 7.8 fmod of these values is :4.2 Example 2Let's see the simple example of having different types of arguments. Output: The values of numerator and denominator are :7.8 , 9 fmod of these values is :7.8 Example 3Let's see the simple example when the value of denominator is zero. Output: The values of numerator and denominator are :16.7 , 0 fmod of these values is :-nan Next TopicC++ Math Functions |
math cbrt() function
C++ Math cbrt() This function is used to find the cube root of a given number. Consider a argument 'arg' : Cube root of a number : ∛arg Syntax Syntax would be : double cbrt(double arg); float cbrt(float arg); long double cbrt(long double arg); double cbrt(integral arg); Parameter arg : It is the value of float or...
1 min read
math copysign() function
C++ Math copysign() The function returns the value with the magnitude of x and sign of y. Syntax Consider two numbers 'x' and 'y'. Syntax would be: float copysign(float x, float y); double copysign(double x, double y); long double copysign(long double x, long double y); promoted copysign(type1 x, type2 y); Note: If any...
2 min read
math lrint() function
C++ Math lrint() The function rounds off the given value using current rounding mode and returns the value of type long int. Syntax Suppose a number is 'x'. Syntax would be: long int lrint(data_type x); Parameter x: The value that can be float, double or long double. Return value It returns the...
2 min read
math erf() function
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
math expm1() function
C++ Math expm1() The function computes the exponential 'e' raised to the power a given number minus 1. Suppose a number is 'x' expm1(x) = e<sup>x</sup> - 1; Syntax float expm1(float x); double expm1(double x); long double expm1(long double x); double expm1(integral x); Note: The return_type can be float, double or long double. Parameter x: It...
1 min read
math trunc() function
C++ Math trunc() The function rounds off the given value towards zero and returns the nearest integral value whose magnitude is not greater than the given value. For example: trunc(3.8) = 3; Syntax Suppose a number is 'x'. Syntax would be : return_type trunc(data_type x); Note: return_type can be float,double or long double. Parameter x:...
1 min read
math islessgreater() function
C++ Math islessgreater() The islessgreater() fuinction determines whether the value of first argument is less than or greater than the value of second argument. If the value of first argument is less than or greater than the second argument then it returns 1 otherwise 0. Note: If one...
2 min read
math signbit() function
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
math sin() function
C++ Math sin() The function is used to find the sine of an angle given in radian. Syntax Consider a radian 'x'. Syntax would be: float sin(float x); float sin(double x); float sin(long double x); double sin(integral x); Note: If the value passed is an integer type, then it is cast to double. Parameter x:...
1 min read
math asinh() function
C++ Math asinh() The function computes the arc hyperbolic sine of an angle given in radian. Where, an arc of hyperbolic sine is the inverse of hyperbolic sine. sinh-1x = asinh(x); Syntax Suppose an angle given in radian is 'x': float asinh(float x); double asinh(double x); long double asinh(long double x); double asinh(integral x); Parameter x: The...
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