If you wouldn't mind, please stop referring things as being "magical".
There's nothing magical about Raku/Perl6 other than the devs that put in
their time to give you that perception.
They are to be commended for their time and effort.

Also, being condescending as in "he gave up" is uncalled for.

It's an IMPOSSIBILITY using today's technology to tell you whether a number
is irrational....period.

The reason why a Raku/Perl6 Int can perform operations on numbers greater
than the cpu architecture allows
is because that single addition operator you use is actually more than just
a single addition.  You said you were
familiar with assembly language so let me give it to you that way.
Perhaps that will allow you to understand it better.

#######################################
SECTION .data
        mem: DQ 0
                 DQ 0x7FFFFFFFFFFFFFFF

SECTION .text
add:
        mov     rax, qword [mem + 8]
        add     rax, 1
        jno     .ok
        mov     qword [mem + 8], 0
        inc     qword [mem]
.ok:
#######################################

There's obviously more involved than this small snippet, but it shows how
storing values greater than 64-bits (in my case) is possible.
No magic needed, just a bit of comp-sci knowledge.  Obviously I'm leaving
out a display routine but that'd be for you to finish.  ;)
Also, the above is limited to a 128 bit value but with a proper allocator
the sky is the limit (unless you run out of memory).

Here's an experiment ....

Write a program to tell you whether PI is irrational.
Respond once it returns with your answer.
A forewarning however, your response will fall on deaf ears as I'll be long
gone as will all others receiving this message.

On Wed, Feb 19, 2020 at 11:15 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> >> On Wed, Feb 19, 2020 at 9:58 PM ToddAndMargo via perl6-users
> >> <perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:
> >>
> >>     Hi All,
> >>
> >>     This is a complete trivia question.
> >>
> >>     Is there a test to see if a number is irrational,
> >>     such as the square root of two?
> >>
> >>     And how does Int handle a irrational number?  Is
> >>     there a limit to magic Larry powder?
> >>
> >>     Many thanks,
> >>     -T
> >
>
> On 2020-02-19 19:20, Paul Procacci wrote:
> >  >> Is there a test to see if a number is irrational
> > There is no such thing as an irrational number in computing.
> >
> > Surely there are "close approximations", but that's the best any
> > computer language can currently do.
> >
>
> Hi Paul,
>
> $ perl6 -e 'my num $x=sqrt(2); say $x;'
> 1.4142135623730951
>
> No Magic Larry "Num" that has no set length?
> And I thought Larry was unstoppable!  Guess
> he gave up at UInt and Int.
>
> :-)
>
> -T
>


-- 
__________________

:(){ :|:& };:

Reply via email to