![]() |
The scalbn() function in C is part of the standard math library <math.h> and is used to scale a floating-point number by an integral power of the base (2 raised to the exponent). This function is very useful while performing high-precision calculations where scaling by powers of 2 is required. Syntax of scalbn() in Cdouble scalbn(double x, int exp); Parameters of scalbn() in CThe scalbn() function in C takes the following parameters:
Return Value of scalbn() in CThe scalbn() function returns the result of multiplying x by 2 raised to the power of exp i.e. x * 2^exp. Examples of scalbn() Function in CThe below examples demonstrate how we can use the scalbn() function in C language. Input: Example 1The below program demonstrates how to use the scalbn() function in C.
Output The result of scaling 1.50 by 2^4 is: 24.00 Time Complexity: O(1) Example 2The following program demonstrates how to scale different data types in C using the scalbn() function.
Output The result of scaling 1.50 by 2^4 is: 24.00 The result of scaling 2.50 by 2^4 is: 40.00 The result of scaling 3.50 by 2^4 is: 56.00 Time Complexity: O(1)
|
Reffered: https://www.geeksforgeeks.org
C Language |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 15 |