Rate This Document
Findability
Accuracy
Completeness
Readability

scalbln

Compute the result of x * 2^y.

Interface Definition

C interface:

float scalblnf(float x, long int y);

double scalbln(double x, long int y);

long double scalblnl(long double x, long int y);

Parameters

Parameter

Type

Description

Input/Output

x

  • For scalblnf, x is of single-precision floating-point type.
  • For scalbln, x is of double-precision floating-point type.
  • For scalblnl, x is of long double-precision floating-point type.

Floating-point value of the input data.

Input

y

  • For scalblnf, y is of long integer type.
  • For scalbln, y is of long integer type.
  • For scalblnl, y is of long integer type.

Long integer value of the input data

Input

Return Value

  • The result of x * 2^y is returned. If an overflow occurs, +∞ or -∞ is returned (the sign is the same as that of x).

Dependency

C: "km_l9.h"

Example

C interface:
    // typical usage
    double x1 = 0.0, x2 = -0.0, x3 = 2.0;
    long int y1 = 2, y2 = 3, y3 = 4, y4 = 5, y5 = 1100;
    // special handing
    double a = INFINITY, b = -INFINITY, c = NAN;
    printf("scalbln(0.0, 2) = %.15f\n", scalbln(x1, y1));
    printf("scalbln(-0.0, 3) = %.15f\n", scalbln(x2, y2));
    printf("scalbln(2.0, 4) = %.15f\n", scalbln(x3, y3));
    printf("scalbln(2.0, 5) = %.15f\n", scalbln(x3, y4));
    printf("scalbln(2.0, 1100) = %.15f\n", scalbln(x3, y5));
    printf("scalbln(INFINITY, 2) = %.15f\n", scalbln(a, y1));
    printf("scalbln(-INFINITY, 2) = %.15f\n", scalbln(b, y1));
    printf("scalbln(NAN, 2) = %.15f\n", scalbln(c, y1));
    /* 
     * scalbln(0.0, 2) = 0.000000000000000
     * scalbln(-0.0, 3) = -0.000000000000000
     * scalbln(2.0, 4) = 32.000000000000000
     * scalbln(2.0, 5) = 64.000000000000000
     * scalbln(2.0, 1100) = inf
     * scalbln(INFINITY, 2) = inf
     * scalbln(-INFINITY, 2) = -inf
     * scalbln(NAN, 2) = nan
     */