Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354011 - new feature: rational values
Summary: new feature: rational values
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IMP (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P1 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Robert M. Fuhrer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-05 10:39 EDT by Anya Helene Bagge CLA
Modified: 2014-01-09 15:04 EST (History)
1 user (show)

See Also:


Attachments
Patch adding rational support (114.24 KB, patch)
2011-08-05 10:40 EDT, Anya Helene Bagge CLA
no flags Details | Diff
Patch adding rational support (114.15 KB, patch)
2011-08-08 06:41 EDT, Anya Helene Bagge CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.