rational numbers

Schüle Daniel uval at rz.uni-karlsruhe.de
Tue Jan 17 19:01:28 CET 2006

Hello NG,

recently I was using Scheme and Ruby and was really nicely surprised
to find there support for the computing with rational numbers

for example this how it works in Ruby

mond:/pool/PROG/ruby # irb
irb(main):002:0* require "mathn"
=> true
irb(main):003:0> r = Rational(1,3)
=> 1/3
irb(main):004:0> p = Rational(1,5)
=> 1/5
irb(main):005:0> r+p
=> 8/15
irb(main):007:0> (r+p)**2
=> 64/225

does anybody know modules which make rational numbers available?
and are there considerations to add them to the core, like
complex numbers (maybe in Python 3)

Regards, Daniel

More information about the Python-list mailing list