fmod, fmodf

Calcula o restante de ponto flutuante.

double fmod( 
   double x,
   double y 
);
float fmod(
   float x,
   float y 
);  // C++ only
long double fmod(
   long double x,
   long double y
);  // C++ only
float fmodf( 
   float x,
   float y 
);

Parâmetros

  • x, y
    Valores de ponto flutuante.

Valor de retorno

fmod Retorna o resto de ponto flutuante x / y. Se o valor de y é 0,0, fmod Retorna um NaN silencioso. Para obter informações sobre representação de um NaN silencioso, a printf Consulte família, printf.

Comentários

The fmod function calculates the floating-point remainder f of x / y such that x = i * y + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of y.

C++ permite sobrecarga, para que você possa telefonar sobrecargas de fmod. Em um programa C, fmod sempre utiliza duas dobras e retorna um double.

Requisitos

Função

Cabeçalho necessário

fmod, fmodf

<math.h>

Para obter informações adicionais compatibilidade, consulte Compatibilidade na introdução.

Exemplo

// crt_fmod.c
// This program displays a floating-point remainder.

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

int main( void )
{
   double w = -10.0, x = 3.0, z;

   z = fmod( w, x );
   printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
}

The remainder of -10.00 / 3.00 is -1.000000

Equivalente do NET Framework

sistema::Math::IEEERemainder

Consulte também

Referência

Suporte de ponto flutuante

ceil ceilf

fabs, fabsf

andar, floorf