Tuesday, June 16, 2020

Standard library math function in c++

C ++ Math function :-

These all are the most used math function in c++. All of these functions are c++ standard library function users just to define it and use it in their program.

Standard library math function in c++
Standard library math function in c++

pow() function in c++ : -

This function used to find the power of any number which is raised to increase the strength of that number. 

Syntax : -

pow(base, exponent) 

Well, c++11 which data type you pass to the pow() function return the result in that same data type.

llrint() in c++

  llrint() function in c++ give the shape to argument into an integral value with the help of current rounding mode.

Syntax : -

llrint(double x);
 It returns the same value for an integer value.

C++ remainder() function:- 

As we know in math theory remainder give the floating-point remainder of numerator/denominator. This function does the same it gives the remainder of numerator/denominator.

Syntax : -

remainder (x, y);

copysign() function in c++ : - 

copysign() function take two argument and give a value with the magnitude of first argument and sign of second argument.

Syntax : -

copysign(x, y);

fma() function in c++ : - 

fma() method in c++ take three argumentfor example x,y andz and give x*y+z without losing precision

Syntax : -

fma(x, y, z);

abs() function in c++ : -

abs function is a well known function in programming language this function used to give the absolute value of the argument.

Syntax : -

abs(x)

fabs() c++ : -

fabs function in c++ also use to give the absolute value but this function return the result value in double, float or long double type.

Syntax : -

fabs(x)

fdim() math function in c++ : -

fdim() function in c++ work with the two arguments and find out about the positive difference between first one and second argument.

Syntax : -

fdim(x, y);

fmin() math function in c++ : -

fmin() in c++  also works with the two arguments and gives the smallest among them.

Syntax : -

fmin(x, y);

Condition: - If any argument is NaN and the other one returned.

fmax() math function in c++ : -

fmax() in function c++  also works with the two arguments and gives the largest among them.

Syntax : -

fmax(x, y);

C++ in hypot():-

hypot() function gives the square root of the sum of square of arguments that are passed to the function.

Syntax : -

hypot(x, y);

nexttoward() math function in c++ : -

c++ standard library function nexttoward() help with the two arguments and give the representable value after x in the direction of y.

Syntax : -

nexttoward(x, y);

it will return the value in double, float, or long double type.

nextafter() function in c++ : -

c++ standard library function nextafter() help with the two arguments and give the representable value after x in the direction of y.

Syntax : -

nextafter(x, y);

its return value in default will be double.

cbrt() function in c++ : -

cbrt() math function in c++ will helps to find out about the cube root of a number. 

Syntax : -

cbrt(x);

sqrt() standard library in c++ : -

sqrt() math function in c++ will helps to find out about the square root of a given number. 

Syntax : -

sqrt(x);

exp() standard library in c++ : -

exp() math function in c++ will help to work with a single argument that can be negative, positive, or zero and gives the exponential raised by the given argument and returns the value in the range of [0, ∞].

Syntax : -

exp(x);

round() standard library in c++ : -

round function gives a integral value that is nearest to the argument this function work with the single argument that is given by the user.

Syntax : -

round(x);

0 comments:

Post a Comment