copysign: gives val the same sign as signval, and return the result : copysign « math.h « C / ANSI-C






copysign: gives val the same sign as signval, and return the result


    

//Declaration: float copysignf(float val, float signval); 
               double copysign(double val, double signval); 
               long double copysignl(long double val, long double signval);  

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

  int main(void)
  {

    printf("%f", copysignf(1.0, -2.0));
   
  }

         
/*
-1.000000*/ 

           
       








Related examples in the same category