Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [imp-dev] BigIntegers for pdb.values

Hi Jurgen,

We'd have to go through the usual IP process before introducing a dependency
on 3rd-party GPL- or LGPL-licensed libraries like gnu.math.  I did a quick search
and didn't see any sign of others using gnu.math in Eclipse, so we'd be the first.

On Jan 13, 2009, at 9:48 AM, Jurgen Vinju wrote:

Hi Bob,

I think this is possible, and I think even that gnu.math already does this for Java.
Could we just use that? Or are we restricted by licensing issues here?

Cheers,

Jurgen

On Mon, Jan 12, 2009 at 7:49 PM, Robert M. Fuhrer <rfuhrer@xxxxxxxxxxxxxx> wrote:
Can't we use a graceful degradation/promotion mechanism for integral values?
I.e., detect overflow and produce a value using a larger underlying representation
as needed. I've never tried to do this in Java, but in C/C++ it's certainly possible
without gross performance loss (one just does some bit twiddling in the MSB's
to detect the overflow).

Obviously this won't handle loss of precision in fixed-point decimals, but
presumably the application developer should know how many decimal
places of precision the application requires.


On Jan 11, 2009, at 10:32 AM, Jurgen Vinju wrote:

Hi!

We're using PDB.values a lot, and I've been able to spend time to 'get it right'. However, there
seems to be one big But.

The PDB integers and doubles are now limited to java Integer and Double, which is not right for the kind
of functionality that PDB offers. The users of the PDB API should not have to worry about overflow and
precision. It's the kind of API that offers abstraction from such details. Also, for the Rascal language which
is built on top of PDB we want to provide a similar abstraction.

So, I propose to change the semantics of pdb integers and doubles to BigInteger and BigDecimal. Also,
it may be prudent to change the name 'double' to 'decimal' in this respect.

We will pay in terms of efficiency initially, since I intend to simple implement these BigIntegers and BigDecimals
using the Java standard library. However, future optimized implementations of the IValue interfaces can try to
fit numbers in normal ints (like other open-source Big Integer implementations sometimes do).

--
Cheers,
  - Bob
-------------------------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IMP Project Lead (http://www.eclipse.org/imp)
X10: Productivity for High-Performance Parallel Programming (http://x10.sf.net)


Back to the top