This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: Default libm mode is XOPEN?


On Jul  7 13:45, Joel Sherrill wrote:
> 
> On 7/7/2014 1:19 PM, Corinna Vinschen wrote:
> > On Jul  7 11:07, Joel Sherrill wrote:
> >> On 7/7/2014 8:26 AM, Corinna Vinschen wrote:
> >>> On Jul  3 16:29, Kyrill Tkachov wrote:
> >>>> Hi all,
> >>>>
> >>>> Looking at newlib/libm/common/fdlibm.h I see the lines:
> >>>>
> >>>> /* REDHAT LOCAL: Default to XOPEN_MODE.  */
> >>>> #define _XOPEN_MODE
> >>>> [...]
> >>>> Is this /* REDHAT LOCAL: Default to XOPEN_MODE.  */ really intentional for
> >>>> all users of newlib?
> >>>> I thought IEEE was supposed to be the default one. Or are targets expected
> >>>> to override this?
> >>> It might be pretty tricky to track down why this was done.  _XOPEN_MODE
> >>> was defined in fdlibm.h since the introduction of the public CVS
> >>> repository back in 2000.  The definition doesn't show up in the
> >>> ChangeLog at all, so this change dates back to at least 1995.
> >>>
> >>> OTOH, changing this now would potentially break a lot of targets.
> >>> We might have to introduce some workaround if there's an actual need.
> >> Although this is not is the oldest version of the file,
> >> the official fdlibm source does not include this definition.
> >>
> >> http://www.netlib.org/fdlibm/fdlibm.h
> > Yeah, I was looking for the newlib archives and ChangeLog only.
> >> [...]
> >> I agree with you that 20+ years of being in place, it is
> >> scary to change.  But I only see two references to
> >> _XOPEN_MODE. Once to define it and another in s_lib_ver.c
> >> to set _LIB_VERSION.  I guess the question is whether this is
> >> truth or lying about the fdlibm/newlib implementation.
> > It's more than that.  _LIB_VERSION is tested a lot throughout the code :(
> I will admit to only having spot checked but does this impact
> anything other than how various error situations are reported?

I'm not a math lib expoert, but from what I can see in files
like libm/math/w_acos.c I'd say, it's not just error checking.

> Is this something that someone can change at run-time?

Yes, see libc/include/math.h.  _LIB_VERSION is just a define, actually
being a variable `__fdlib_version' which isn't static.  So an
application is allowed to set this to another value since it's exported
from libm.a (just not on Cygwin due to the way DLL exports are generated
but that doesn't matter here).

> If not, a serious concern is whether this is turning on code which
> has been unused for years.

Right.  Given that an application can redefine this value, I'd suggest
to keep _XOPEN_ as default value, and if somebody with more math
knowledge would like to take a stab at checking the _IEEE_ code (or
checking results against reality), please feel free.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgp2lWs06Efn4.pgp
Description: PGP signature


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