Date: Mon, 13 May 2002 20:31:18 +0200 From: Stefan Farfeleder <e0026813@stud3.tuwien.ac.at> To: Bill Fenner <fenner@research.att.com> Cc: obrien@FreeBSD.ORG, standards@FreeBSD.ORG Subject: Re: signbit ISO C99 macro Message-ID: <20020513183118.GB228@stefan.fafoe> In-Reply-To: <200205131813.LAA19960@windsor.research.att.com> References: <200205131813.LAA19960@windsor.research.att.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, May 13, 2002 at 11:13:58AM -0700, Bill Fenner wrote: > > It's easy if it's easy to treat doubles as uint64_t's. Like, I think > signbit() might be something like > > #define signbit(d) (*((uint64_t *)&(d)) & UINT64_C(0x8000000000000000)) > > or maybe > > #define signbit(d) (*((uint64_t *)&(d)) >> 63) > > However, that assumes that d is an IEEE double (and there is a > possibly-incorrect assumption about byte order). I don't know how to > implement a macro that will take any real-floating type. signbit isn't limited to lvalues, is it? You'll have to handle eg signbit(3.0) too. Stefan Farfeleder To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020513183118.GB228>