HPlogo HP-UX Reference > C

copysign(3M)

HP-UX 11i Version 2: December 2007 Update
» 

Technical documentation

 » Table of Contents

 » Index

NAME

copysign(), copysignf(), copysignl(), copysignw(), copysignq() — copysign functions

SYNOPSIS

#include <math.h>

double copysign(double x, double y);

float copysignf(float x, float y);

Itanium(R)-based System Only

long double copysignl(long double x, long double y);

extended copysignw(extended x, extended y);

quad copysignq(quad x, quad y);

DESCRIPTION

The copysign() function returns x with its sign changed to the sign of y.

copysignf() is a float version of copysign(); it takes float arguments and returns a float result.

Itanium-based System Only

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

copysignw() is an extended version of copysign(); it takes extended arguments and returns an extended result.

copysignq() is equivalent to copysignl() 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 Itanium-based systems) copysignw()or copysignq(), compile 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

The copysign() function returns a value with the magnitude of x and the sign of y.

These functions raise no exceptions.

ERRORS

No errors are defined.

STANDARDS CONFORMANCE

copysign(), copysignf(), copysignl() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")