mozilla/rust — pull request #5733 by dbaupp (2013-04-05 08:15:42+00:00)
Title: Add basic support for rational and complex numbers

This adds two generic data types, `Ratio` and `Cmplx` (and some aliases for useful instances, e.g. `Ratio` and `Cmplx`), and basic arithmetic support, as well as `.to_str` (for both) and `.from_str` (for rational).

The complex number implementation doesn't solve #1284 other than getting something into the libraries, specifically it doesn't even try to address C interop. If the complex part of this gets merged, maybe it's worth closing that issue and reopening more specific issue(s) about the failings.

The implementations can be fleshed out when the numeric traits stabilise (and trait inheritance works).