Re: Numeric literals, take 1
[email protected] (Michael Lazzaro) Tue, 26 Nov 2002 08:55:04 -0800
| Newsgroups | perl.perl6.documentation |
|---|---|
| Message-ID | <[email protected]> |
On Tuesday, November 26, 2002, at 05:02 AM, James Mastros wrote:
> Guys, can we please not argue over just how arithmetic and such works
> for NaN and Inf, and defer to IEEE specs (IEEE-754, AKA IEEE floating
Yes and no. perl6-internals has been discussing this, so I think we
can pause and not worry about it quite yet. Floats will almost
certainly be IEEE, but in addition to floating point ("num", aka C
"double"), most of the same issues exist for sized integers, both
signed and unsigned. Worse, the behaviors are platform-dependent.
For example, what happens when you add two 8-bit numbers, and the
result is no longer an 8-bit number, e.g. 'overflow'? (We may indeed
have access to a type called 'int8', since Parrot will likely have it.)
my int8 $i = 254;
my int8 $j = 254;
$i += $j; # ???
Does it overflow (via an exception?), silently truncate, or ?. (Parrot
may offer us both options.) We can choose to call the result "platform
dependent", or define it explicitly. But let's wait and see what the
Parrot people think, since they're closer to the action.
MikeL