What is scalblnl in C?

scalblnl in C is used to multiply a long double value by FLT_RADIX raised to a user-specified value. scalblnl is defined in the math.h header file and the function declaration is as follows:

long double scalblnl(long double arg, long exp);

FLT_RADIX is an integer constant defined in <float.h>. Its value is 2 for most binary systems.

Parameters

arg: long double value

exp: long value

Return value

  • No errors: arg∗FLT_RADIXexparg*FLT\_RADIX^{exp}

  • Range error due to underflow: Correct result after rounding

  • Range error due to overflow: ±HUGE_VAL, ±HUGE_VALF, or ±HUGE_VALL

Error handling

Errors are recorded according to the macro constant math_errhandling. Some special cases are handled as follows:

  • If arg is ±0±0, then unmodified arg is returned
  • If arg is ±∞\infty, then unmodified arg is returned
  • If exp is 00, then unmodified arg is returned
  • If arg is NaN, then NaN is returned

Example

#include <stdio.h>
#include <math.h>
int main()
{
printf("scalblnl(3.0, 2) = %Lf\n", scalblnl(3.0, 2));
printf("scalblnl(5.5, -3) = %Lf\n", scalblnl(5.5,-3));
printf("scalblnl(7.9, 0) = %Lf\n", scalblnl(7.9, 0));
return 0;
}

First, we import the math.h header file from the C standard library. The program then prints the output of scalblnl on possible example values.

scalbn, scalbnf, scalbnl, scalbln, and scalblnf perform the same function as scalblnl but differ in the data types of exp and return value.

Free Resources

Copyright ©2026 Educative, Inc. All rights reserved