C++ Math exp()30 Aug 2024 | 1 min read The function computes the exponential e raised to the power given number. Suppose a number is x:exp() = ex SyntaxConsider a number 'x'. Syntax would be: Parameterx: The value whose exponential value is to be calculated. Return valueIt returns the exponential value of type float, double or long double. If value is too large, the function returns HUGE_VAL Example 1Let's see a simple example when the value of x is positive. Output: Value of x is : 0.2 Exponential value of x is : 1.2214 In this example, exp() function calculates the exponential value of x when the value of x is positive. Example 2Let's see a simple example when the value of x is negative Output: Value of x is : -5.3 Exponential value of x is : 0.00499159 In this example, exp() function calculates the exponential value of x when the value of x is negative. Next TopicC++ Math Functions |
C++ Math toward() The toword() function represents the representable value in a specific direction. The after() and toward() both the functions work similar and return the same value. The only difference occurs in their syntax. Syntax float toward(float from, long double to); double toward(double from, long double to); long...
1 min read
C++ Math fmod() The function finds the floating point remainder of numerator/denominator and rounded towards zero. Formula of fmod: fmod= numerator - t*denominator where 't' is the truncated value of numerator/denominator. Syntax Consider a numerator 'n' and denominator 'd'. Syntax would be: double fmod(double n,double d); Parameter n:The value of numerator. d:The value of denominator Return value It...
2 min read
C++ Math isgreaterequal() The isgreaterequal() function determines whether the value of first argument is greater or equal to the value of second argument. If the first argument is greater or equal to the second argument then it returns 1 otherwise 0. Note: If one or both the arguments...
2 min read
C++ Math nearbyint() The function rounds off the given value to a nearby integral value by using the current rounding method. The current rounding method is described by fegetround. Syntax Suppose a number is 'x'. Syntax would be: return_type nearbyint(data_type x); Note: The return_type can be float, double or long...
1 min read
C++ Math llrint() The function rounds off the given value using current rounding mode and returns the value of type long long int. Syntax Suppose a number is 'x'. Syntax would be: long long int llrint(data_type x); Parameter x: The value which is to be rounded. Return value It returns the rounded value of...
1 min read
C++ Math fma() The function computes the expression x*y+z without losing its precision in any intermediate result. Suppose numbers are x,y and z: fma(x,y,z) = x*y+z; Syntax float fma(float x, float y, float z); double fma(double x, double y, double z); long double fma(long double x, long double y, long double z); double fma(type1...
1 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 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
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
C++ Math remainder() The function finds the floating point remainder of numerator/denominator (rounded to the nearest integer value). Formulae of remainder : Remainder = numerator - (r*denominator) where, r = numerator/denominator and it is rounded to the nearest integral value. Syntax Consider a numerator 'n' and denominator 'd'. Syntax would be: return_type...
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