From 41a359e22f3a85a570bd5fd94496d02959fe8394 Mon Sep 17 00:00:00 2001 From: Rajalakshmi Srinivasaraghavan Date: Thu, 16 Jun 2016 21:21:26 +0530 Subject: Add nextup and nextdown math functions TS 18661 adds nextup and nextdown functions alongside nextafter to provide support for float128 equivalent to it. This patch adds nextupl, nextup, nextupf, nextdownl, nextdown and nextdownf to libm before float128 support. The nextup functions return the next representable value in the direction of positive infinity and the nextdown functions return the next representable value in the direction of negative infinity. These are currently enabled as GNU extensions. --- manual/arith.texi | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'manual/arith.texi') diff --git a/manual/arith.texi b/manual/arith.texi index 72682f0c99..f54b1ec7df 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -1702,6 +1702,46 @@ These functions are identical to the corresponding versions of double}. @end deftypefun +@comment math.h +@comment GNU +@deftypefun double nextup (double @var{x}) +@comment math.h +@comment GNU +@deftypefunx float nextupf (float @var{x}) +@comment math.h +@comment GNU +@deftypefunx {long double} nextupl (long double @var{x}) +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +The @code{nextup} function returns the next representable neighbor of @var{x} +in the direction of positive infinity. If @var{x} is the smallest negative +subnormal number in the type of @var{x} the function returns @code{-0}. If +@math{@var{x} = @code{0}} the function returns the smallest positive subnormal +number in the type of @var{x}. If @var{x} is NaN, NaN is returned. +If @var{x} is @math{+@infinity{}}, @math{+@infinity{}} is returned. +@code{nextup} is based on TS 18661 and currently enabled as a GNU extension. +@code{nextup} never raises an exception except for signaling NaNs. +@end deftypefun + +@comment math.h +@comment GNU +@deftypefun double nextdown (double @var{x}) +@comment math.h +@comment GNU +@deftypefunx float nextdownf (float @var{x}) +@comment math.h +@comment GNU +@deftypefunx {long double} nextdownl (long double @var{x}) +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +The @code{nextdown} function returns the next representable neighbor of @var{x} +in the direction of negative infinity. If @var{x} is the smallest positive +subnormal number in the type of @var{x} the function returns @code{+0}. If +@math{@var{x} = @code{0}} the function returns the smallest negative subnormal +number in the type of @var{x}. If @var{x} is NaN, NaN is returned. +If @var{x} is @math{-@infinity{}}, @math{-@infinity{}} is returned. +@code{nextdown} is based on TS 18661 and currently enabled as a GNU extension. +@code{nextdown} never raises an exception except for signaling NaNs. +@end deftypefun + @cindex NaN @comment math.h @comment ISO -- cgit v1.2.1