Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354011

Summary: new feature: rational values
Product: z_Archived Reporter: Anya Helene Bagge <eclipzilla>
Component: IMPAssignee: Robert M. Fuhrer <rfuhrer>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P1 CC: jurgen.vinju
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch adding rational support
none
Patch adding rational support none

Description Anya Helene Bagge CLA 2011-08-05 10:39:41 EDT
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
Comment 1 Anya Helene Bagge CLA 2011-08-05 10:40:56 EDT
Created attachment 200992 [details]
Patch adding rational support

Suitable for patch -p0 < ... in your workspace.
Comment 2 Anya Helene Bagge CLA 2011-08-08 06:41:18 EDT
Created attachment 201071 [details]
Patch adding rational support

New patch against r22929
Comment 3 Jurgen Vinju CLA 2011-08-09 09:09:28 EDT
We've talked about this feature for a long time and now it's here! So I'm accepting the patch and committing.