remquo(), remquof(), remquol() — Computes the remainder.

Standards

Standards / Extensions C or C++ Dependencies

C99
Single UNIX Specification, Version 3
C++ TR1 C99

both z/OS® V1R5

Format

#define _ISOC99_SOURCE
#include <math.h>

double remquo(double x, double y, int *quo);
float remquof(float x, float y, int *quo);
long double remquol(long double x, long double y, int *quo);
C++ TR1 C99
#define _TR1_C99
#include <math.h>

float remquo(float x, float y, int *quo); 
long double remquo(long double x, long double y, int *quo);

General description

The remquo functions compute the same remainder as the remainder functions. In the object pointed to by quo they store a value whose sign is the sign of x/y and whose magnitude is congruent modulo 2 to the power n to the magnitude of the integral quotient of x/y, where n is an implementation defined integer greater than or equal to 3.
Note: The following table shows the viable formats for these functions. See IEEE binary floating-point for more information about IEEE Binary Floating-Point.
Function Hex IEEE
remquo X X
remquof X X
remquol X X
Restriction: The remquof() function does not support the _FP_MODE_VARIABLE feature test macro.

Returned value

The remquo functions return x REM y.

Example

/*
 * This program illustrates the use of remquol() function
 *
 */
#define _ISOC99_SOURCE
#include <math.h>
#include <stdio.h>


void main() {

  long double number1=3.0L, number2=3.5L;
  int quo=0;

  printf("Illustrates the remquol() function");

  #ifdef __BFP__
    printf(" (IEEE version)\n\n");
  #else
    printf(" (HFP version)\n\n");
  #endif

  printf("remquol(%.2Lf,%.2Lf,&quo)=%.2Lf",number1,number2,remquol(number1,number2,&(quo)));
  printf("   quo=%i\n",quo);
  number1=1.0L; number2=2.0L;
  printf("remquol(%.2Lf,%.2Lf,&quo)=%.2Lf",number1,number2,remquol(number1,number2,&(quo)));
  printf("    quo=%i\n",quo);
  number1=1.0L; number2=0.0L;
  printf("remquol(%.2Lf,%.2Lf,&quo)=%.2Lf",number1,number2,remquol(number1,number2,&(quo)));
  printf(" quo=%i\n",quo);
}


Output

Illustrates the remquol() function (IEEE version)

remquol(3.00,3.50,&quo)=-0.50   quo=1
remquol(1.00,2.00,&quo)=1.00    quo=0
remquol(1.00,0.00,&quo)=NaNQ(1) quo=0

Related information