C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C++ Math scalbln()The function computes the product of a given number and FLT_RADX raised to the power of exponent. Suppose a number is 'x' and exponent is 'n':scalbn(x,n) = x * ( FLT_RADX)n Syntaxfloat scalbln(float x, long int n); double scalbln(double x, long int n); long double scalbln(long double x, long int n); double scalbln(integral x, long int n); Parameterx: The value of the significand. n: The value of the exponent. Return valueIt returns the product of x and FLT_RADX raised to the power n. Example 1Let's see the simple example when the value of x is an integer type. #include <iostream> #include<math.h> #include<float.h> using namespace std; int main() { int x=3; long n=3L; std::cout << "Value of x is: " <<x<< std::endl; cout<<"3 * 2^3 = "<<scalbn(x,n); return 0; } Output: Value of x is: 3 3 * 2^3 = 24 Example 2Let's see the simple example when the value of x is a float type #include <iostream> #include<math.h> #include<float.h> using namespace std; int main() { float x=7.2; long n=2L; std::cout << "Value of x is : " <<x<< std::endl; cout<<"7.2 * 2^2 = "<<scalbln(x,n); return 0; } Output: Value of x is : 7.2 7.2 * 2^2 = 28.8
Next TopicC++ Math Functions
|