round(3) Library Functions Manual round(3) NOME round, roundf, roundl - arredonda para o numero inteiro mais proximo, distante de zero BIBLIOTECA Biblioteca matematica (libm, -lm) SINOPSE #include double round(double x); float roundf(float x); long double roundl(long double x); Requisitos de macro de teste de recursos para o glibc (consulte feature_test_macros(7)): round(), roundf(), roundl(): _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L DESCRICAO Estas funcoes arredondam x para o numero inteiro mais proximo, mas parcialmente casos distantes de zero (independente da direcao de arredondamento atual, veja fenv(3)), ao inves de arredondar para o numero inteiro par como rint(3). Por exemplo, round(0.5) e 1.0 e round(-0.5) e -1.0. VALOR DE RETORNO Estas funcoes retornar um valor inteiro arredondado. Se x e integral, +0, -0, NaN ou infinito, o proprio x e retornado. ERROS Ocorre nenhum erro. POSIX.1-2001 documenta um erro de intervalo para estouros, mas consulte NOTAS. ATRIBUTOS Para uma explicacao dos termos usados nesta secao, consulte attributes(7). +--------------------------------------------+---------------+---------+ |Interface | Atributo | Valor | +--------------------------------------------+---------------+---------+ |round(), roundf(), roundl() | Thread safety | MT-Safe | +--------------------------------------------+---------------+---------+ PADROES C11, POSIX.1-2008. HISTORICO glibc 2.1. C99, POSIX.1-2001. NOTAS POSIX.1-2001 contains text about overflow (which might set errno to ERANGE, or raise an FE_OVERFLOW exception). In practice, the result cannot overflow on any current machine, so this error-handling stuff is just nonsense. (More precisely, overflow can happen only when the maximum value of the exponent is smaller than the number of mantissa bits. For the IEEE-754 standard 32-bit and 64-bit floating-point numbers the maximum value of the exponent is 127 (respectively, 1023), and the number of mantissa bits including the implicit bit is 24 (respectively, 53).) Se voce deseja armazenar o valor arredondado em um tipo inteiro, provavelmente deseja usar uma das funcoes descritas em lround(3). VEJA TAMBEM ceil(3), floor(3), lround(3), nearbyint(3), rint(3), trunc(3) TRADUCAO A traducao para portugues brasileiro desta pagina man foi criada por Mila , Andre Luiz Fassone e Rafael Fontenelle . Esta traducao e uma documentacao livre; leia a Licenca Publica Geral GNU Versao 3 ou posterior para as condicoes de direitos autorais. Nenhuma responsabilidade e aceita. Se voce encontrar algum erro na traducao desta pagina de manual, envie um e-mail para a lista de discussao de tradutores . Linux man-pages 6.06 31 outubro 2023 round(3)