This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v4] Add nextup and nextdown math functions


On 06/12/2016 09:13 AM, Rajalakshmi Srinivasaraghavan wrote:
> On 06/10/2016 09:44 AM, Rical Jasan wrote:
>> On 06/09/2016 09:35 AM, Rajalakshmi Srinivasaraghavan wrote:
>>
>> These sound much better to me!  I think the clincher is the language:
>> "positive/negative number of least magnitude in the type of".  Feels
>> succinct, yet all-encompassing.
>>
>> Hopefully this is small enough to not be annoying, and not small enough
>> to be annoying, but the only question I have is should we give a mention to:
>>
>>
>> On 06/07/2016 10:24 AM, Joseph Myers wrote:
>>> On Tue, 7 Jun 2016, Rical Jasan wrote:
>>>> Lastly, is there anything to say about floating-point exceptions?
>>> Only that these functions raise no exceptions except for sNaNs.
>>
>> Though maybe that is implied somehow in the behaviour described above?
>> I'm unsure of when an sNaN exception is raised versus a qNaN, and the
>> description doesn't distinguish.  Otherwise this is great.
>>
>> Thank you,
>> Rical
>>
>>
> Modified arith.texti in the attached version.
> -- 
> Thanks
> Rajalakshmi S

...

> 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,
this is good.

Rical


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]