This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add nextup and nextdown math functions
- From: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- To: Rajalakshmi Srinivasaraghavan <raji at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org
- Cc: Joseph Myers <joseph at codesourcery dot com>
- Date: Wed, 1 Jun 2016 09:35:56 -0500
- Subject: Re: [PATCH] Add nextup and nextdown math functions
- Authentication-results: sourceware.org; auth=none
- References: <1463727477-1909-1-git-send-email-raji at linux dot vnet dot ibm dot com> <alpine dot DEB dot 2 dot 20 dot 1605201155430 dot 22473 at digraph dot polyomino dot org dot uk> <201606011211 dot u51C9sVN019582 at mx0a-001b2d01 dot pphosted dot com>
A few comments from my first walk through of the new patch.
On 06/01/2016 07:10 AM, Rajalakshmi Srinivasaraghavan wrote:
>
>
> On 05/20/2016 05:45 PM, Joseph Myers wrote:
>> On Fri, 20 May 2016, Rajalakshmi Srinivasaraghavan wrote:
>>
>>> This patch adds nextup and nextdown functions from TS 18661-1.
>>
> Here is an updated patch with comments incorporated.
>
>
+* TS 18661 adds nextup and nextdown functions alongside nextafter to
+ provide support for float128 equivalent to it. So nextup and nextdown
+ functions are added as preparatory patches before Float128 support. This
+ is currently enabled as a GNU extension.
+
I would reword this. IEC 60559 replaced the nextAfter operation with
nextUp and nextDown, TS 18661 standardizes them for C, and does not
define them for TS 18661 derived types (i.e _FloatN).
+nextdown(@code{-HUGE_VAL}) is @code{-HUGE_VAL}. It is based on draft
+TS 18661 and currently enabled as a GNU extension.
I believe it is a published extension to C11 now. Likewise for
nextup.
+#if MANT_DIG == 106
+ TEST_f_f (nextdown, -1.0L, -1.0L-0x1p-105L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+ TEST_f_f (nextdown, 1.0L+0x1p-105L, 1.0L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+ TEST_f_f (nextdown, 1.0L, 1.0L-0x1p-106L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
It would be proactive to add tests for each format. A similar set of tests should
be made for binary{32,64,128} and the {intel,m68k}96 formats. Likewise for nextup.
+double __nextdown(double x)
+{
+ return -__nextup(-x);
+}
Function declaration should be GNU style. The return type should be on its own
line. Likewise, spaces should be placed between identifiers and open parenthesis.
There a number of other similar spacing issues throughout too.