Re: perl: 64-bit integers and long doubles
On Tue, May 04, 2010 at 05:29:03PM +0200, Florian Weimer wrote:
> * Niko Tyni:
> > The benefits are obviously improved numeric range and precision. The
> > downside is presumably increased memory usage. I have no measurement
> > data on this; suggestions on suitable tests would be welcome.
> I have run into several incompatibilities between i386 and amd64 due
> to different Perl integer sizes, so I'm definitely in favor of 64-bit
> I'm not sure if long doubles are a win. The rest of the world runs on
> 64 bit floating point numbers, so this would introduce additional
I'd argue against a default setting where floating point numbers
are less precise than integers.
The problem here is that, running Perl code, it is hard to avoid
implicit numerical conversions, as Perl is designed to keep
those transparent. This is reasonably save when different types
are subsets of each other. However, as 64-bit floats cannot
hold 64-bit ints without loss of precision, hidden "upgrades"
will have dangerous effects, like rendering different things
equal. This in turn is bound to hurt the same code that
needed more precision in the first place.
Therefore, I'd like to see the migration to 64-bit integers and
long doubles happen simultaneously, painful as it might be, or
not at all. Keep in mind, I am talking default settings here,
which should lead to a perl interpreter with sane arithmetic.
Individual admins may always choose differently and live with