On Wed, Dec 27, 2000 at 04:08:00PM -0500, Uri Guttman wrote:
> i can see things changing very easily. but to me, how perl handles
> overflow is a language semantic as much as implementation. in 5 it is
> well defined (ilya not withstanding) and you are talking bigint stuff
> which scares me. i don't think that should be the default in any case. i
> would want my perl numbers to be float or ints and bring in bigint as
> you said by pragma or attribute.

Which of these two behaviors do you find more useful:

  [~] $ perl -le'$c=1;$c*=$_ for (2..170);print $c'
  7.25741561530799e+306
  [~] $ perl -le'$c=1;$c*=$_ for (2..171);print $c'
  inf

(The following are wrapped lines -- they come out all in one line
originally)

  [~] $ ruby -e'c=1;(1..170).each{|i| c *= i};p c'
  725741561530799896739672821112926311471699168129645137654357779890056-
  184340170615785235074924261745951149099123783852077666602256544275302-
  532890077320751090240043028005829560396661259965825710439855829425756-
  896631343961226257109494680671120556888045719334021266145280000000000-
  0000000000000000000000000000000

  [~] $ ruby -e'c=1;(1..1500).each{|i| c *= i};p c'
  <snipped 4115 digits for brevity>

Oh, and in case you're wondering, both of the Ruby commands are *fast*.
As compared to our core module, Math::BigInt, which is slower than
molasses even after you bother to `use' it, deal with the interface, and
do things by hand.

What is it about automatic conversion to bigints (done well) that scares
you?

-dlc

Reply via email to