[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ wrapper
From: |
Peter Moulder |
Subject: |
Re: C++ wrapper |
Date: |
Wed, 6 Dec 2000 19:29:11 +1100 |
On Mon, Dec 04, 2000 at 07:05:13PM +0100, Gerardo Ballabio wrote:
> Did anyone try it??? Are you satisfied with it? Let me know!!!
So far haven't run it.
That said, some comments:
- Might be nice to split into multiple files:
- makes it slightly easier to find things in the header file.
- reduces compile time for the common case where only one or two of
the number classes are being used. (Inclusion of large header
files affects compilation time whether or not it is used by the
rest of the source file. The gmp++ file is likely to be included
directly or indirectly into every source file in a project, so the
extra second or so per source file can add up.)
- Could do with some more methods involving basic types. E.g.
comparison with int/float 0[.0] is very common, as is reciprocal
operation (1 / x).
I notice that gmp lacks a mpq_cmp_si operation, and its mpq_cmp_ui
implementation could add some micro-optimizations since we know after
the first couple of tests that num1_size is positive. Will send
Torbjorn a simple patch when I get around to it.
- Could do with some methods like negate, reciprocate (esp for mpq),
reciprocal (in effect a unary operator like unary -), abs, sgn. Given
that the mp member is private, these operations (esp the non-const
operations like negate,reciprocate) are best done inside the class,
so that we don't have to mess with is_can. Perhaps could go through
the existing gmp documentation and look for other functionality that
is best done within the class rather than via get_mpX_t.
For the people who haven't yet looked at Gerardo's wrapper, I should
point out that it's very good, i.e. don't be put off by my nitpicking
above, it's quite impressive.
I haven't yet read the documentation. I know texinfo, so perhaps I'll
add some basic texinfo formatting to it and send it back to you.
pjm.