root cubic

2020-07-09 Thread Aureliano Guedes
Hi all, A quick question. This is expected? raku -e 'say 9 ** (1/3)' 2.080083823051904 Why do I'm asking this? I know about the computational floating problem and I also know that the Raku deal with rational whenever it is possible and store numbers as expressions (actually I don't know if the

Re: root cubic

2020-07-09 Thread Laurent Rosenfeld via perl6-users
Do you expect something else? The result appears to be correct. Please note that, when dealing with square or cubic roots, Raku will not use rationals, but ordinary floats. Le jeu. 9 juil. 2020 à 17:27, Aureliano Guedes a écrit : > Hi all, > > A quick question. > > This is expected? > > raku -e

Re: root cubic

2020-07-09 Thread Richard Hainsworth
Did you mean the square root of 9 to give 3. Maybe you were wanting cube root of 27? Using REPL, I got > say 27**(1/3) 3 > On 09/07/2020 16:26, Aureliano Guedes wrote: Hi all, A quick question. This is expected? raku -e 'say 9 ** (1/3)' 2.080083823051904 Why do I'm asking this? I

Re: root cubic

2020-07-09 Thread Tobias Boege
On Thu, 09 Jul 2020, Aureliano Guedes wrote: > Hi all, > > A quick question. > > This is expected? > > raku -e 'say 9 ** (1/3)' > 2.080083823051904 > > > Why do I'm asking this? > I know about the computational floating problem and I also know that the > Raku deal with rational whenever it is

Re: root cubic

2020-07-09 Thread Ralph Mellor
You have several useful answers. I want to summarize what they saButy, and add a couple resources. * You probably meant 9 ** <1/2>. Which will display 3. But it's a Num. It's not the right type if you care about accuracy. * A solution to get rationals right is built into Raku. See https:/

Re: root cubic

2020-07-09 Thread William Michels via perl6-users
> #in the Raku/Perl6 REPL > say 4 ** (1/2) 2 > say 8 ** (1/3) 2 > 4 ** (1/2) == 8 ** (1/3) True > say 8 ** (1/4) 1.681792830507429 > > say 9 ** (1/2) 3 > say 9 ** (1/3) 2.080083823051904 > say 9 ** (1/4) 1.7320508075688772 > $*VM moar (2020.06) > Is the question whether Raku can somehow understand

Re: root cubic

2020-07-09 Thread Tobias Boege
On Thu, 09 Jul 2020, Tobias Boege wrote: > Now, there are effective ways to represent algebraic numbers like 9 ** (1/3) > in such a way that you can do arithmetic with them, but I'm not aware of any > implementation of that available to Raku. For someone with enough tuits, > I think this [1] can se