Re: Literals, take 2

[email protected] ("Joseph F. Ryan") Wed, 13 Nov 2002 16:34:12 -0500
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
Jonathan Scott Duff wrote:

>On Wed, Nov 13, 2002 at 06:38:08PM +0000, Andrew Wilson wrote:
>  
>
>>On Wed, Nov 13, 2002 at 07:26:06PM +0100, Angel Faus wrote:
>>    
>>
>>>For example, the integer 30 can be written in hexadecimal base in two 
>>>equivalent ways:
>>>
>>>  my $x = 16:1D
>>>  my $x = 16:1.14
>>>
>>>These two representations are incompatible, so writing something like 
>>>C<16:D.13> will generate a compile-time error.
>>>      
>>>
>>So, can we specify floats in other bases?  
>>    
>>
>
>Why would you want to?
>
>-Scott
>

>  
>
Well, why would you want a float in any radix?
To represent a fractional part of a whole digit in
that radix, of course.  If different radii are going
to be supported, I think its best to at least
support them fully.  For instance, what would
happen if you did this without floating point
support for different radii?

my $x = 16: 6;
my $y = 16: C;
my $z = $x/$y;
# $z should equal 6/C, aka 16: 0.8