Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S

scalb(3M)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

scalb(), scalbf(), scalbl(), scalbw(), scalbq() — scale exponent of a radix-independent floating-point number

SYNOPSIS

#include <math.h>

double scalb(double x, double y);

HP Integrity Server Only

float scalbf(float x, float n);

long double scalbl(long double y, long double n);

extended scalbw(extended x, extended n);

quad scalbq(quad x, quad n);

DESCRIPTION

The scalb() function returns x * ry, where r is the radix of the machine's floating-point arithmetic. The radix r is 2 on all PA-RISC and Integrity servers.

Integrity Server Only

scalbf() is a float version of scalb(); it takes float arguments and returns a float result.

scalbl() is a long double version of scalb(); it takes long double arguments and returns a long double result.

scalbw() is an extended version of scalb(); it takes extended arguments and returns an extended result.

scalbq() is equivalent to scalbl() on HP-UX systems.

USAGE

To use these functions, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options.

To use (for Integrity servers) scalbw() or scalbq(), compile also with the -fpwidetypes option.

Make sure your program includes <math.h>. Link in the math library by specifying -lm on the compiler or linker command line.

RETURN VALUE

scalb(-x, y) and -scalb(x, y) are equivalent.

If y is ±0, scalb() returns x.

If x is +0 and y is +INFINITY, scalb() returns a NaN and raises the invalid exception.

If x is +0 and y is an integer less than +INFINITY, scalb() returns +0.

If x is +INFINITY and y is an integer greater than -INFINITY, scalb() returns +INFINITY.

If x is finite and positive-signed and y is -INFINITY, scalb() returns +0.

If x is positive and y is +INFINITY, scalb() returns +INFINITY.

If x is +INFINITY and y is -INFINITY, scalb() returns a NaN.

If x or y is NaN, scalb() returns a NaN.

scalb() returns a properly signed infinity (equal to ±HUGE_VAL) (equal to +-HUGE_VAL) in lieu of a value whose magnitude is too large, and raises the overflow and inexact exceptions.

scalb() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal or zero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

ERRORS

If the correct value would overflow or underflow, scalb() sets errno to [ERANGE].

Integrity Server Only

HP-UX libm functions on Integrity servers do not set errno by default. For errno setting, compile with the +Olibmerrno option.

STANDARDS CONFORMANCE

scalb() : ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.