Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365188 - Math functions for IReal
Summary: Math functions for IReal
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IMP (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jurgen Vinju CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-30 08:27 EST by Davy Landman CLA
Modified: 2014-01-09 15:03 EST (History)
1 user (show)

See Also:


Attachments
patch implementing the proposed changes (32.46 KB, patch)
2011-11-30 08:28 EST, Davy Landman CLA
no flags Details | Diff
generated pi and e myself and added precision parameters to the IValueFactory e and pi methods (29.36 KB, application/octet-stream)
2011-12-01 16:08 EST, Davy Landman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Davy Landman CLA 2011-11-30 08:27:33 EST
Build Identifier: 20110916-0149

To avoid leaking implementation details of IReal, the place to perform mathematical operations on IReals is inside the concrete implementations. For initial implementation we selected log, ln, exp, pow, nroot, sqrt, sin, cos, and tan as operations to support.

We cannot use standard java Math methods since they use floating point math.
Therefore, we have to implement the calculations for BigDecimal ourself (existing libraries have incompatible licenses). The implementations are based on the book "Java Number Cruncher: The Java Programmer's Guide to Numerical Computing" for which the author has shared the code as public domain (http://authors.phptr.com/mak/downloads.html) (the ln, nroot, sqr, and exp are from this source).

Lastly the PI and E constants are added to the IValueFactory since they are often needed in relation to the mathematical operations selected.

Attached to this enhancement request is the patch implementing the above changes. (All the functions were validated against their java Math version).

Reproducible: Always
Comment 1 Davy Landman CLA 2011-11-30 08:28:18 EST
Created attachment 207719 [details]
patch implementing the proposed changes
Comment 2 Davy Landman CLA 2011-12-01 16:08:58 EST
Created attachment 207811 [details]
generated pi and e myself and added precision parameters to the IValueFactory e and pi methods

As requested I've now manually generated the PI and E constants (IP problems).

Their precision is 1000 decimals.

Also I added a precision parameter to both e and pi because else the 1000 decimal precision will affect all the other calculations once either pi() or e() is used.
Comment 3 Davy Landman CLA 2011-12-08 05:18:23 EST
For IP reasons:

> a.  I authored 100% of the content (excluding content originating from
> Ronald Mak via Java Number Cruncher: The Java Programmer's Guide to Numerical
> Computing)
yes

> b.  I have the right to contribute the content to Eclipse
yes

> c.  I contribute the content under the EPL
yes