HPlogo HP-UX Reference Volume 4 of 5 > s

scalbn(3M)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

scalbn() — scale exponent of a radix-independent floating-point number

SYNOPSIS

#include <math.h>

double scalbn(double x, int n);

DESCRIPTION

The scalbn() function returns x * rn, where r is the radix of the machine's floating-point arithmetic. When r is 2 (as it is on all PA-RISC systems), scalbn() is equivalent to ldexp().

The scalb() function is recommended by the IEEE-754 standard for floating-point arithmetic. The ISO/ANSI C committee has approved the scalbn() function for inclusion in the C9X draft standard.

To use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options. Make sure your program includes <math.h>. Link in the math library by specifying -lm on the compiler or linker command line.

RETURN VALUE

Upon successful completion, the scalbn() function returns x * rn.

scalbn(-x, n) and -scalbn(x, n) are equivalent.

If x is ±INFINITY, zero, or a NaN, scalbn() returns x.

If the correct value after rounding would be smaller in magnitude than MINDOUBLE, scalbn() returns zero.

If the correct value would overflow, scalbn() returns ±INFINITY (according to the sign of x).

ERRORS

No errors are defined.

© Hewlett-Packard Development Company, L.P.