copysignl Function

Returns the value of x but with the sign of y.

Include

<math.h>

Prototype

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

Arguments

x
a double precision floating-point value
y
value whose sign will apply to the result

Return Value

Returns the value of x but with the sign of y.

Example

#include <math.h>
#include <stdio.h>

int main(void)
{
  long double x,y,z;

  x = 10.0;
  y = -3.0;
  z = copysignl(x, y);
  printf("The value %Lf but with %Lf's sign is %Lf\n\n", x, y, z);
}

Example Output

The value 10.000000 but with -3.000000's sign is -10.000000