[PATCH v4] Add nextup and nextdown math functions

raji raji@linux.vnet.ibm.com
Mon Jun 13 15:35:00 GMT 2016



On 06/13/2016 04:23 AM, Rical Jasan wrote:
> On 06/12/2016 09:13 AM, Rajalakshmi Srinivasaraghavan wrote:
>> On 06/10/2016 09:44 AM, Rical Jasan wrote:
>> ... 
>> diff --git a/manual/arith.texi b/manual/arith.texi
>> index 72682f0..598f5a1 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 @code{NaN}, @code{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 @code{NaN}, @code{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
>> +
> The sNaN/exception bit is good, but you also changed the description of
> the smallest numbers that return +/-0.  Is saying, "the smallest
> positive/negative subnormal number in the type of", more correct than
> simply, "the smallest positive/negative number in the type of"?  If so,

I feel its correct to use term 'subnormal number'.

> this is good.
>
> Rical
>
>



More information about the Libc-alpha mailing list