Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 May 2002 11:13:58 -0700
From:      Bill Fenner <fenner@research.att.com>
To:        obrien@FreeBSD.ORG
Cc:        standards@FreeBSD.ORG
Subject:   Re: signbit ISO C99 macro
Message-ID:  <200205131813.LAA19960@windsor.research.att.com>

next in thread | raw e-mail | index | archive | help

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.

  Bill

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?200205131813.LAA19960>