This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [libcxx+newlib] nexttoward{f,l,} shims for _LDBL_EQ_DBL systems
- From: Craig Howland <howland at LGSInnovations dot com>
- To: <newlib at sourceware dot org>
- Date: Tue, 23 Sep 2014 21:17:55 -0400
- Subject: Re: [libcxx+newlib] nexttoward{f,l,} shims for _LDBL_EQ_DBL systems
- Authentication-results: sourceware.org; auth=none
- References: <5421D931 dot 905 at codesourcery dot com>
On 09/23/2014 04:33 PM, Jonathan Roelofs wrote:
Please see the attached patch.
Needs a ChangeLog entry. Missing the patch for libm/common/Makefile.am.
Operationally, all looks OK, but aesthetically, the use of casting is
inconsistent. For example:
+long double
+nexttowardl (long double x, long double y)
+{
+ return nextafter((double)x, (double)y);
+}
The x and y arguments are cast to double to pass to nextafter(), but the return
value is not cast to long double. It works OK, but could be confusing. Are the
casts intended to highlight the spots where the double/long double equality is
required? If so, it would probably be better to either cast in all places where
it is theoretically needed, or to just leave them out. The other existing
functions of this style left all of them out (i.e. no casts from ld to d or d to
ld)--see, for example, libm/common/nextafterl.c. I suggest that the precedent
is the better way.
Craig