This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: floating-point formats


"Dr. Andy Phillips" <atp@northernworkhouse.co.uk> writes:
> > One problem I've encountered is that a few files outside of sysdeps
> > include <ieee754.h>: math/test-misc.c, stdio-common/printf_size.c,
> > stdlib/erand48_r.c, strtod.c.
> Plus a few more scattered here and there. (I'm currently looking at
> the 2.2.3 codebase, so apologies if these are already altered).

2.2.5 here, and yes, the ieee stuff in wcsmbs is still there.

> The problems as I see them mainly stem from general library routines
> 'assuming' IEEE format. This can range from explicit bit twiddling
> such as goes on in the SET_MANTISSA macro of stdlib/strtod.c,
> through to 'knowing' that single precision implies there is one
> mantissa element to the bit pattern, which can be accessed via
> (x).ieee.mantissa.

The VAX formats are sign-magnitude, right?  The PDP-10 formats are
two's complement.  This means that assigning to x.ieee.negative won't
work, since the entire value is affected by a sign change.  Functions
or macros like

  float float_set_negative (float x);  /* set negative bit */
  float float_set_positive (float x);  /* clear negative bit */
  float float_negate (float x);        /* toggle negative bit */

would be needed.

> for the vax there is no concept of inf, or NaN as such. But NaN can
> be emulated by using the reserved operand bit pattern.

Does anything in glibc rely on the existence of inf or NaNs?  The
PDP-10 has neither, and I don't think there are any reserved bit
patterns.

> In terms of some of the bit twiddling that goes on in the math
> library, thats another matter. It may be possible to abstract some
> of these operations, or it may be more effective to leave them alone
> and re-write vax/pdp specific versions of the affected routines.

I'm thinking "do as much as possible in sysdeps/{vax,pdp10}".

-- 
Lars Brinkhoff          http://lars.nocrew.org/     Linux, GCC, PDP-10,
Brinkhoff Consulting    http://www.brinkhoff.se/    HTTP programming


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