[chuck-users] Integer divisions (and Rational package)

Robert Poor rdpoor at gmail.com
Tue Dec 15 14:58:45 EST 2009


As promised on this topic, I've posted documentation, source code,  
example code and test suite for a Rational package at:

	http://wiki.cs.princeton.edu/index.php/Rational_Number_Package
	http://wiki.cs.princeton.edu/index.php/Rational.ck
	http://wiki.cs.princeton.edu/index.php/Rational_eg.ck
	http://wiki.cs.princeton.edu/index.php/Rational_test.ck

... respectively.  And respectfully. (Editing in Wiki ain't half  
bad!)  As a teaser, here's an example its results:
=== file: t.ck
Rational.create(pi, 1000) @=> Rational @ r2;
<<< "pi as float is ~ ", pi >>>;
<<< "pi as rational is ~ ", r2.toString(), "or", r2.toFloat() >>>;
r2.mul(2) @=> Rational @ r3;
<<< "2*pi as float is ~ ", 2 * pi >>>;
<<< "2*pi as rational is ~ ", r3.toString(), "or", r3.toFloat() >>>;
=== EOF
% chuck rational.ck t.ck
pi as float is ~  3.141593
pi as rational is ~  355/113 or 3.141593
2*pi as float is ~  6.283185
2*pi as rational is ~  710/113 or 6.283186

- Rob

On 15 Dec 2009, at 10:24, Hans Aberg wrote:

> On 15 Dec 2009, at 18:13, Kassen wrote:
>
>>> A long time, when wikis were new, they started off with a separate  
>>> wiki, as ChucK has now. But eventually, that was integrated into  
>>> one system.
>>
>> I don't really see any problem with the system we are using now. I  
>> don't think we would want the whole world to be able to edit the  
>> front page. Another issue is that the ChucK page is mirrored  
>> between Princeton and Stanford, while the WiKi isn't.
>
> A wiki does not mean that everybody can edit it. Don't know exactly  
> how it is done one the Haskell site.
>
> As you note, the only problem is to find the stuff. Right now, there  
> is a small link after the electro-communities site, to a separate  
> system.
>
>  Hans
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list