We use the scalbnl() function to compute the product of a given number with FLT_RADIX raised to the given power. It is a variation of the scalbn() function when the mantissa value is of type long double.
FLT_RADIX is a constant which serves as the base of the exponent. Usually, in all computers, this value is 2.
#include<cmath>
#include<math.h>
We have to use
#include<cfloat>library for C++ and#include<float.h>library for C language to accessFLT_RADIX.
long double scalbnl(long double num, int n)
num: Input value is of long double type. This is the coefficient or mantissa value.
n: Exponent value or the number to which FLT_RADIX is raised.
The return value is the product of the given number, num, with FLT_RADIX raised to power n.
#include <iostream>#include<cmath>#include <cfloat>using namespace std;int main(){long double num = 100.9;int n = 4;long double result = 0;cout << num << " * " << FLT_RADIX << "^" << n << " = " << scalbnl(num , n) << endl;}
Free Resources