From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88042 invoked by alias); 7 Aug 2019 13:29:11 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 87561 invoked by uid 89); 7 Aug 2019 13:29:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-3.0 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE autolearn=ham version=3.3.1 spammy=the=c2, H*r:sk:newlib@, H*i:sk:1565184, H*f:sk:1565184?= X-HELO: mx.coeval.ca Received: from mx.coeval.ca (HELO mx.coeval.ca) (184.75.211.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Aug 2019 13:29:07 +0000 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.coeval.ca (Postfix) with ESMTPSA id C9A38436054 for ; Wed, 7 Aug 2019 13:29:04 +0000 (UTC) Received: by mail-ot1-f52.google.com with SMTP id b7so54030247otl.11 for ; Wed, 07 Aug 2019 06:29:04 -0700 (PDT) MIME-Version: 1.0 References: <1565118798-16391-1-git-send-email-joel@rtems.org> <1565118798-16391-3-git-send-email-joel@rtems.org> <20190807083634.GA11632@calimero.vinschen.de> <1565184419338.12435@caci.com> In-Reply-To: <1565184419338.12435@caci.com> Reply-To: joel@rtems.org From: Joel Sherrill Date: Wed, 07 Aug 2019 13:29:00 -0000 Message-ID: Subject: Re: [PATCH v3 2/3] Add default implementation of fenv.h and all methods To: "Howland, Craig D. - US" Cc: "newlib@sourceware.org" Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019/txt/msg00424.txt.bz2 On Wed, Aug 7, 2019 at 8:27 AM Howland, Craig D. - US via newlib < newlib@sourceware.org> wrote: > > > From: newlib-owner@sourceware.org on > behalf of Corinna Vinschen > > Sent: Wednesday, August 7, 2019 4:36 AM > > To: Joel Sherrill > > Cc: newlib@sourceware.org > > Subject: Re: [PATCH v3 2/3] Add default implementation of fenv.h and all > methods > > > > Hi Joel, > > > > On Aug 6 14:13, Joel Sherrill wrote: > > > [...] > > > +//#define FE_DIVBYZERO 0x00000001 > > > +//#define FE_INEXACT 0x00000002 > > > +//#define FE_INVALID 0x00000004 > > > +//#define FE_OVERFLOW 0x00000008 > > > +//#define FE_UNDERFLOW 0x00000010 > > > + > > > +//#define FE_ALL_EXCEPT \ > > > + > //(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW) > > > +#define FE_ALL_EXCEPT 0 /* NONE SUPPORTED IN PLACEHOLDER > TEMPLATE */ > > > + > > > +/* > > > + * The following macros are to be defined if the respective rounding > > > + * direction is supported by the implementation via the fegetround() > and > > > + * fesetround() functions, each with a unique positive value. > > > + * > > > + * FE_DOWNWARD > > > + * FE_TONEAREST > > > + * FE_TOWARDZERO > > > + * FE_UPWARD > > > + * > > > + * Other implementation-specific rounding modes may be defined, and > must start > > > + * with FE_ followed by a capital letter. > > > + */ > > > +//#define FE_DOWNWARD 1 > > > +//#define FE_TONEAREST 2 > > > +//#define FE_TOWARDZERO 3 > > > +//#define FE_UPWARD 4 > > > + > > > +/* > > > + * The following typedefs are required. See the C and POSIX standards > for > > > + * details: > > > + * > > > + * fenv_t > > > + * fexcept_t > > > + */ > > > +typedef size_t fenv_t; > > > +typedef size_t fexcept_t; > > > > While these types are defined, the above macros are not. Wouldn't > > it make sense to define all or nothing by default? > > > The standards require the types to be defined, but the individual macros > are to be defined only if supported by the implementation. The > default implementation being provided supports nothing, only > returning error, so it is proper for them to not be defined. But having > them there commented out to serve as a template seems to be a good thing. > Quick reply. :) This is the POSIX language: "The ** header shall define the following constants if and only if the implementation supports the floating-point exception by means of the floating-point functions *feclearexcept*() , *fegetexceptflag*() , *feraiseexcept*() , *fesetexceptflag*() , and *fetestexcept*() . Each expands to an integer constant expression with values such that bitwise-inclusive ORs of all combinations of the constants result in distinct values." I don't mind changing size_t to int. That seems reasonable --joel > > > > > Thanks, > > Corinna > Craig