Scroll to navigation

RINT(3) Manual del Programador de Linux RINT(3)

NOMBRE

nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl - redondean al entero más cercano

SINOPSIS

#include <math.h>
double nearbyint(double x);
float nearbyintf(float x);
long double nearbyintl(long double x);
double rint(double x);
float rintf(float x);
long double rintl(long double x);

Enlazar con -lm.

Requisitos de Macros de Prueba de Características para glibc (véase feature_test_macros(7)):

nearbyint(), nearbyintf(), nearbyintl():

_POSIX_C_SOURCE >= 200112L || _ISOC99_SOURCE

rint():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| _XOPEN_SOURCE >= 500
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

rintf(), rintl():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

DESCRIPCIÓN

The nearbyint(), nearbyintf(), and nearbyintl() functions round their argument to an integer value in floating-point format, using the current rounding direction (see fesetround(3)) and without raising the inexact exception. When the current rounding direction is to nearest, these functions round halfway cases to the even integer in accordance with IEEE-754.

The rint(), rintf(), and rintl() functions do the same, but will raise the inexact exception (FE_INEXACT, checkable via fetestexcept(3)) when the result differs in value from the argument.

VALOR DEVUELTO

These functions return the rounded integer value.

Si x es un entero, +0, -0, NaN o infinito, se devuelve x tal cual.

ERRORES

No errors occur. POSIX.1-2001 documents a range error for overflows, but see NOTES.

ATRIBUTOS

Para obtener una explicación de los términos usados en esta sección, véase attributes(7).

Interfaz Atributo Valor
nearbyint(), nearbyintf(), nearbyintl(), rint(), rintf(), rintl() Seguridad del hilo Multi-hilo seguro

CONFORME A

C99, POSIX.1-2001, POSIX.1-2008.

NOTAS

SUSv2 y POSIX.1-2001 contienen texto sobre el desbordamiento por arriba (que puede asignar a errno el valor ERANGE, o lanzar una excepción FE_OVERFLOW). En la práctica, el resultado no puede desbordarse en ninguna máquina actual, por lo que este manejo de errores no tiene mucho sentido. (Más concretamente, el desbordamiento sólo puede producirse cuando el valor máximo del exponente es más pequeño que el número de bits de la mantisa. Para los números en coma flotante de 32 y 64 bits del estándar IEEE-754 el valor máximo del exponente es 128 (resp. 1024), y el número de bits de la mantisa es 24 (resp. 53).)

If you want to store the rounded value in an integer type, you probably want to use one of the functions described in lrint(3) instead.

VÉASE TAMBIÉN

ceil(3), floor(3), lrint(3), round(3), trunc(3)

COLOFÓN

Esta página es parte de la versión 5.10 del proyecto Linux man-pages. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en https://www.kernel.org/doc/man-pages/.

TRADUCCIÓN

La traducción al español de esta página del manual fue creada por Miguel Pérez Ibars <mpi79470@alu.um.es>

Esta traducción es documentación libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD.

Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a debian-l10n-spanish@lists.debian.org.

15 Septiembre 2017