At 11:07 AM 12/28/00 +0000, David Mitchell wrote:
>Daniel Chetlin <[EMAIL PROTECTED]> wrote:
> > What is it about automatic conversion to bigints (done well) that scares
> > you?
>
>Well, consider the following perl5 code:
>
>sub factorial {
>         my $n = shift;
>         my ($f,$i) = (1,0);
>         $f *= ++$i while $i < $n;
>         $f;
>}
>
>Someone might be suprised and annoyed to find that when run under perl6,
>it suddenly runs slowly and uses loads of memory.

On the other hand, they may well be happy that, for non-small versions of 
$n, that it runs correctly. It doesn't take too many runs through before 
you overflow the 53 bits most doubles get you.

>I'd argue that at the language level there should be pragma allowing you
>to choose between optimising for precison and optimising for speed/storage
>(assuming these last two are synonymous).
>If the default is speed/storage, then you get the perl5-ish behaviour of
>int overflowing to float, and float overflowing to Infinity.
>Under 'use precision' or whatever, ints overflow to bigints, floats
>overflow to bigfloats etc.

That works for me--like I said, this is a language issue, so I'm not hugely 
concerned with what it looks like as long as it gets dealt with. (That and 
it becomes Larry's problem... :)

>Then everyone is happy. (Perhaps....)

Well, less unhappy, but I can live with that.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to