Name

drem, dremf, dreml
- floating-point remainder functions

Library

libm.lib

Synopsis

  #include <math.h>
  double drem (double x);
  float dremf (float x);
  long double dreml (long double x);

Return values

The drem() function returns the remainder, unless y is zero.

Detailed description

The drem dremf and the dreml functions compute the remainder of dividing x by y. The return value is x - n * y, where n is the quotient of x / y, rounded to the nearest integer. If the quotient is 1/2, it is rounded to the even number. The function dreml an alias to the function drem.

Examples

#include <math.h>
void main()
{
   double x1 = 6.4, x2 = 2, y;
   y = drem( x1, x2 );
   printf( "drem(%f , %f) = %f\n", x1, x2, y );
   y = dremf( x1, x2 );
   printf( "dremf(%f , %f) = %f\n", x1, x2, y );
   y = dreml( x1, x2 );
   printf( "dreml(%f , %f) = %f\n", x1, x2, y );
}

         

Output

drem ( 6.4, 2 ) = 0.4
dremf( 6.4, 2 ) = 0.4
dreml( 6.4, 2 ) = 0.4

         


Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top