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] Add nextup and nextdown math functions


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.


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