develooper Front page | perl.perl6.language | Postings from October 2008

Re: Smooth numeric upgrades?

From:
Darren Duncan
Date:
October 4, 2008 19:23
Subject:
Re: Smooth numeric upgrades?
Message ID:
48E8252E.6090107@darrenduncan.net
Patrick R. Michaud wrote:
> Correct.  I suspect that eventually the Rakudo developers will have
> to develop a custom set of PMCs for Perl 6 behaviors rather than
> relying on the Parrot ones.

I think it would be better for things like unlimited-precision integers and 
rationals to be Parrot generic PMCs rather than Perl 6 specific ones, since 
there are other languages that also have unlimited-precision numbers (for 
example Python afaik) and it would be better to have a common 
implementation.  Several popular languages have unlimiteds now, and more 
are coming over time.

Note that just as integers are naturally radix independent, the unlimited 
rationals should be too, and the latter can compactly represent all 
rationals as a triple of integers corresponding roughly to a (normalized) 
[mantissa, radix, exponent] triple; with that approach you also get 
unlimited floats for free, so no reason to make floats an exception where 
they aren't unlimited where integers and other rationals are; after all, 
what is a float or scientific notation than just another notation for a 
rational value literal.

-- Darren Duncan



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About