Community
Participate
Working Groups
Build Identifier: 20110615-0604 The soon-to-be-attached patch adds rationals to the PDB values library: a new number type IRational with a reference implementation (fast implementation TBD). The relevant classes and interfaces are updated, and new tests have been added to the pdb tests, including axiom tests for all numeric types. Changes: In org.eclipse.imp.pdb.values: * Add IRational and a basic implementation of rationals based on IInteger. * Add rational to relevant visitors, etc. * Bug fix: make sure real divide() precision is at least the default division precision, otherwise result magnitude is messed up * Add signum() to IReal * Add IReal abs() to IReal interface (more specific return type) * Add IRational binary reader / writer * Add IRational text reader / writer * Special-case a few integer ops in the fast implementation for slightly better performance (0, 1 cases occur often with rational numbers). * MISSING: - XML reader / writer (I'm not familiar enough with this stuff) - ATerm reader; rationals are written as rat(A,B); not sure what the best solution is here In org.eclipse.imp.pdb.test: * Add rational test cases to TestBasicValues * Add axioms for various algebraic properties of numbers, and an axiom test evaluator * Add random data generators for use with the axiom tests * Add random tests for number I/O. Disabled test of reference integer PBF I/O and real text I/O, until the impl is fixed. In org.eclipse.imp.pdb.ui: * Add visitor cases Reproducible: Always
Created attachment 200992 [details] Patch adding rational support Suitable for patch -p0 < ... in your workspace.
Created attachment 201071 [details] Patch adding rational support New patch against r22929
We've talked about this feature for a long time and now it's here! So I'm accepting the patch and committing.