Also, going by math calling the "real numbers" misses that math treats
integers as a subset of real numbers; there is no hard distinction between
them in math. Computers need hard distinctions here because integral,
rational, and floating point numbers must be stored in different ways,
unless they take the PHP / Javascript solution (storing them all as strings
or floating point, respectively). Perl 6's Real is a role that the actual
types "does" if they are compatible with it.

If you want to do the Perl 5-ish thing where it hid the differences (and
sometimes promoted an integral value to floating without asking, never to
return), use the Real role as a type to hide the difference between them.
If you want to be specific, use the correct type.

On Sun, Sep 16, 2018 at 11:51 PM Brandon Allbery <allber...@gmail.com>
wrote:

> You're assuming "Real" means "a float of some kind". It's not; it defines
> all the operations in common over non-Complex numbers (Int, Rat, Num,
> etc.). What you are looking for, Perl 6 calls Num.
>
> On Sun, Sep 16, 2018 at 8:53 PM ToddAndMargo <toddandma...@zoho.com>
> wrote:
>
>> Hi All,
>>
>> I am confused, again:
>>
>>
>> $ p6 'my $x=3; dd $x'
>> Int $x = 3
>> Makes sense
>>
>>
>> $ p6 'my $x; dd $x'
>> Any $x = Any
>> Makes Sense
>>
>> $ p6 'my Real $x; dd $x'
>> Real $x = Real
>> makes sense
>>
>> $ p6 'my Real $x = 3; dd $x'
>> Int $x = 3
>> What ???? Integer ?????  Did I or did I not just tell it
>> is was a "Real" ?????
>>
>> :'(
>>
>> -T
>>
>
>
> --
> brandon s allbery kf8nh
> allber...@gmail.com
>


-- 
brandon s allbery kf8nh
allber...@gmail.com

Reply via email to