On Sat, 22 Sep 2001, Benjamin Stuhl wrote:
> --- Simon Cozens <[EMAIL PROTECTED]> wrote:
> > On Sun, Sep 23, 2001 at 02:17:40AM +0300, Jarkko
> > Hietaniemi wrote:
> > > unaligned access
> >
> > Bother. It is as I feared.
> >
> > Dan, we need to do something about this. The choices are:
> > put floats into the
> > constant section, or ensure instructions are assigned on
> > an appropriate
> > boundary. I can see pros and cons of both.
>
> What I ended up doing in my work on the perl5 B::Bytecode
> stuff was actually storing floats as their string
> representation and restoring them back into native floats
> at load time. Yes, it's slow and hackish, but strings are
> the only *portable* format for floating-point numbers, and
> they have the added benefit of degrading gracefully when
> bytecode from a machine with more bits of precision is
> loaded on a machine with fewer.
Luckily we can make a few more assumptions than that, but we'd probably
best encode the floating point type in the bytecode header. Not everyone
does 4 and 8 byte IEEE floats. (VMS is the first I can think of, as its 4
and 8 byte floats aren't IEEE by default (though they can be), and neither
is its 16-byte float...)
Dan