Folks,

I am only beginning to unwrap the christmas present but I immediately fell in 
love with the perl6 arithmetic system.  Not is it rich but it is also fast.

% perl6
> 340282366920938463463374607431768211297.is-prime
True
> 340282366920938460843936948965011886881.is-prime
False

And type conversions between numbers are smooth and seamless.  I couldn’t help 
loving Rat … except for one thing.

% perl6
> pi
3.14159265358979
> pi.Rat
3.141593
> pi.Rat.nude
(355 113)

That’s so 5th century!

https://en.wikipedia.org/wiki/Zu_Chongzhi

And of course,

> pi.Rat == pi
False

https://perl6advent.wordpress.com/2009/12/14/day-14-going-to-the-rats/

However, we can be more precise by simply giving 0 to $epsilon.

> pi.Rat(0).nude
(245850922 78256779)
> pi.Rat(0) == pi
True
> e.Rat(0) == e
True
> log(2).Rat(0) == log(2)
True

This I feel more natural.

http://doc.perl6.org/routine/Rat#role_Real says the default $epsilon is 1e-6.


Why so large?

Why not zero?

Dan the Perl6 Newbie


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to