
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! I'm a long-time user (and admirer) of the Boost libraries, and I've just uploaded a new one to the Boost Vault for consideration: the Extended Integer (XInt) library, a unlimited-precision integer library that I've been working on for the last few months. I'd like to request a preliminary review of it, please. I know I was supposed to "determine interest" first, but I've seen posts going back at least five years, expressing a desire for such a library, so I didn't think that was really necessary in this case. :-) It's not perfect. The code is complete, as is the documentation text. But it doesn't yet support auto-linking or Windows DLLs, I'm not sure how the test suite would fit into the Boost test system, and I'm not sure I've got the Jamfile correct. But it should be sufficient for experimental use and review, and I'm eager to hear what you guys think of it. (I'm writing this in the wee hours of March 26th, I hope it isn't held in the moderation queue for too long.) - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkusSQoACgkQp9x9jeZ9/wSwrACfTvCVl6bEZbiTSzZ16WnB1E6B cusAoO8eBd2Ne3cYcpdVmjUoUwFmjlVU =5Ptl -----END PGP SIGNATURE-----

Well - BigInts have become like London Buses - you wait for ages and then six of them come along ;-) Your Xint looks interesting, Boost styled (if not Boost-style tests), and Boost licence. Docs (though not Doxygen/Quickbook) and no examples. But these are trivial issues. I've not been following the WG21 discussions of Bigger Integers - perhaps you can summarise their response to N1744 (was is "we are too busy dealing with C++0X?"). Paul PS I note it doesn't (yet) specialise std::numeric_limits? numeric_limits is something that is very highly desirable/essential for many applications (for example the Boost.Math package relies on this, and had to add it to be able to use the NTL package and GMP package). NaN is essential IMO (if only to act as a 'missing value' marker (though I would favour a separate NaN for this purpose from std::numeric_limits<>::quiet_naN(); --- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow@hetp.u-net.com

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I can adapt the test suite, if someone could point me toward some description of how. I'm not sold on Doxygen as a good way to handle documentation, mostly because I've never seen any really good docs written in it. I did put an example in, in the documentation -- the Fibonacci example. There are a couple others in there too, like the one showing how the exception-blocking works. If it would help to have them as separate files too, that wouldn't be much of a problem.
Unfortunately I don't know anything about their response, or where I could find it. I didn't even know they'd addressed it until last week, when I saw mention of n1692 and n1744 in some older posts to this list. But I would have written that code even if they'd decided against it, because I had a need for it myself, for one of my own programs.
I've put it on the to-do list. Though how useful it might be at this point is questionable... I doubt that very many packages test the is_bounded member, and most of the interesting non-floating-point-specific fields aren't specified when it's false.
Sorry, I don't quite understand what you're suggesting I do in that last paragraph, if anything. The library has a NaN built in already, and numeric_limits<>::quiet_NaN is specified as being "meaningful for floating point types only." - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkus210ACgkQp9x9jeZ9/wRbigCgtQnj4a7N0rnUxbASwVYBSxmT 0Y8AoL0f8rBtYiQ3Z8IvE6761ma/vgzH =+b+O -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
That's one way to approach self-documenting code. :-)
forgot to say, i like your exception blocking mechanism
Thanks! It took a while to come up with it. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutM2IACgkQp9x9jeZ9/wRysQCgtdkCGjCooZ8koF33aIvGBHHA 83sAoIlP4J2PPP9j0TpKOpeFJ0fMolgm =pX+Z -----END PGP SIGNATURE-----

I'd leave doing work on docs and testing until you get more positive feedback. Doxygen can work well (especially when used with Quickbook, but needs to have useful comments in the C++ code to be more than a list of classes, functions...). (I used to think Doxygen was used as an excuse not to write docs ;-)
I did put an example in, in the documentation -- the Fibonacci example.
Sorry I didn't spot these - I expected to find in an /examples subfolder. Using Quickbook, you can pick out 'snippets' from the source code (.hpp and .cpp) and this makes the docs much nicer for users, and prevents the code and docs getting out of sync - saving you work.
http://gmplib.org/list-archives/gmp-discuss/2006-January/002083.html " http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1692.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1744.pdf Unfortunately, both have been rejected... (along with N2020 and N1641) They have been rejected because we felt that they didn't really address the issue. At least that is the way I read the proposals. Of course, if there is a mature serious proposal I would support it. " is not encouraging, for reasons unclear. http://www.linux2you.dk/JTC1/SC22/WG21/docs/papers/2008/n2598.html gives the status of the above along with N1744 Michiel Slaters on which yours is based as "open" rather than rejected. But should not necessarily deter you :-) A working Boost library in widespread use might change things? (But the ghost of GMP's GPL licence haunts Big Integer proposals. As I've said elsewhere, a really good solution must be switchable to use GMP, if your license requirements permit). Paul PS Would you collaborate with a GSoC student to do the Boost-style docs and tests, and more examples?
PS I note it doesn't (yet) specialise std::numeric_limits? I've put it on the to-do list.
I think NaN *is* meaningful for your integer type. However this is a minor detail that can added later.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
That was the impression that I've gotten about it too. The docs that I've seen written with it are close to useless, not much better than simply reading the source code. I try to make my documentation more useful than that.
As I said, I can put it there too, if it would be useful. I usually go to the documentation first, and figured most other people would too. For larger examples, I'd definitely put them there, and just provide a link in the docs.
It would also keep programmers that prefer to use C++ from being forced to Python or another language, just for the large integer support. :-)
I can see the desirability of that. But that said, it shouldn't be all that difficult to write a wrapper for pretty much any external library, to adapt it to whatever interface xint ends up using. I'm aiming for a Boost-licensed native C++ implementation for now, as that seems to be what has been missing to date.
PS Would you collaborate with a GSoC student to do the Boost-style docs and tests, and more examples?
I'm willing, though I don't really think there's enough work for more than one person.
I agree, and I'll add it to the numeric_limits definition. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutNxwACgkQp9x9jeZ9/wRMOgCaA64AYS0/oByVjSOL3yPMUwp4 Y7wAniY5prMF2niuvnF9Zn1ZW1EqibMM =DbTR -----END PGP SIGNATURE-----

on 26.03.2010 at 8:41 Chad Nelson wrote :
(I'm writing this in the wee hours of March 26th, I hope it isn't held in the moderation queue for too long.)
i had a look at the docs and i find the lib pretty cool the docs seem pretty clear to me (even though i don't like this plain style of docs) i didn't evaluate the implementation and haven't tried to test it i have a copuple of suggestions first, to make 'xint::integer' consistent (if i were you) i'd make all public member functions non-member friend functions because 'int' and other fundamentals have no member functions and second, the docs lack algorithmic complexity estimation for operations as an end user i would like to know the order of time and/or space an operation will cost me BTW i like the presence of implicit sharing my only question is can i make it (the sharing) thread safe by defining 'XINT_THREADSAFE'? (hm... here arises a question about operations thread safety notes in the docs) i don't like the template constructor however you can ignore this point since i can not provide any arguments yet what about compile time fixed precision ints? like 'xint::fixed<128>' with '128' denoting number of bits (or bytes?) -- Pavel

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I can "pretty them up" before the final release. I just wanted to get the information itself written down for review.
Most of the non-operator member functions are there because n1692 required them.
Easy enough to supply. I'll put it on the to-do list for the second review.
That's covered. From the Compile-Time Options page: - ------------------------8<--------------------------- #define XINT_THREADSAFE This disables the copy-on-write optimization that the library uses by default, sets the exception-blocking code to work on a per-thread basis, and protects some shared resources from multiple simultaneous accesses, allowing fully thread-safe operation. You are still responsible for ensuring that only one thread can access any specific integer at a time. When this option is used, you must also link your program with the Boost.Thread library. - ------------------------8<--------------------------- I should probably move that information to the Thread-Safe Operation page instead, and just point the Compile-Time Options page to it. It would fit better there.
i don't like the template constructor however you can ignore this point since i can not provide any arguments yet
I tried several different ways to convert native integer types to xint::integer. That's the best one I found. If you could suggest an alternative, I'd certainly be willing to entertain it.
what about compile time fixed precision ints? like 'xint::fixed<128>' with '128' denoting number of bits (or bytes?)
I don't see any obvious reason why that couldn't be implemented on top of xint::integer. It should only require a fairly simple set of template wrappers. I think it should be deferred until the underlying library makes it through the review process though. Also, I'm noting who made suggestions for the library, for an acknowledgments page. Do you prefer to be known only as "Pavel", or do you have a publicly-known last name? - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutK1QACgkQp9x9jeZ9/wTGegCgrGrrICQTbna4Nbklmn9cEMI7 TJ8An0pWiGJmKPnf8n1KMs+gnAn/dxOl =LqqK -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
That would essentially be identical to what I've got now, but would only be active on integer types? - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutQakACgkQp9x9jeZ9/wSwwQCfYB1c6ufh9k11JqUXVHj1N29i 5TsAoICNrrht92KpABGRtJsQM0yahcYw =OUlg -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
As described on the rationale page of the documentation, the primary reason I'm using copy-on-write is that move semantics aren't widely available yet. Portability is one of my primary goals, and while I've seen references to a move-semantics-emulator in Boost, I've also seen suggestions that it relies on the compiler to somehow recognize it. That doesn't sound fully portable to me. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutiIsACgkQp9x9jeZ9/wQhngCdEsfZVM2akyS+mY8BS9utOHmE TaQAoIItLKnFEaIVEhCc6JZyWKah66hV =1izb -----END PGP SIGNATURE-----

Chad Nelson wrote:
Have you looked at the (proposed) Boost.Move library by Ion (available from the sandbox)? It does a pretty good job of emulating move semantics for compilers that lack rvalue references. Not sure what you're referring to by "suggestions that it relies on the compiler to somehow recognize it"...can you elaborate? - Jeff

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
It does a pretty good job of emulating move semantics for compilers that lack rvalue references.
No, I wasn't aware of its existence. I haven't seen it mentioned on this list in the last couple weeks, is it under review for official acceptance? If not, no offense, but I can't use it. I'll be happy to do so when it's an official part of the Boost library though.
Not sure what you're referring to by "suggestions that it relies on the compiler to somehow recognize it"...can you elaborate?
I finally tracked down the reference. From the "Thread Management" documentation page of Boost.Thread: - ------------------------8<----------------------- Objects of type boost::thread are movable, however, so they can be stored in move-aware containers, and returned from functions. [...] [Note: On compilers that support rvalue references, boost::thread provides a proper move constructor and move-assignment operator, and therefore meets the C++0x MoveConstructible and MoveAssignable concepts. With such compilers, boost::thread can therefore be used with containers that support those concepts. For other compilers, move support is provided with a move emulation layer, so containers must explicitly detect that move emulation layer. See <boost/thread/detail/move.hpp> for details.] - ------------------------8<----------------------- I misremembered it slightly, but the general argument still stands: move semantics aren't widely available yet, so the copy-on-write behavior of XInt is necessary for now. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuuE7UACgkQp9x9jeZ9/wQ80wCdFUWFSNPngv5BpocWnbml+mPZ gVsAoO6hMycPIp/h8zFgmnSG48emMonL =V0vo -----END PGP SIGNATURE-----

Chad Nelson wrote:
AFAIK, it is in the review queue.
If not, no offense, but I can't use it. I'll be happy to do so when it's an official part of the Boost library though.
I understand your hesitation. I am currently using it myself, but only as far as being compatible with the semantics of boost::rv<T>& and const boost::rv<T>& (which amounts to all of about a half dozen lines of code from move.hpp). The rest of the framework I'm either reimplementing, refining, or wrapping, since the interface hasn't been finalized, but everything is/will be still compatible with other code that recognizes boost::rv<T>. I think the advantages that move emulation has over copy-on-write (better performance, simpler implementation, thread safety) outweigh its disadvantages (the framework built around boost::rv<T> is still somewhat experimental), so I would urge you to take a look at it in the near future.
Right, *containers* (not compilers) must detect that move emulation layer. So COW does have an additional advantage: better performance with non-move-aware containers. A suggestion (perhaps not a good one): replace the thread-safe implementation of xint::integer with a move-aware one, and allow either to be chosen via preprocessor defines. The choice of using COW or move emulation might be regarded more as an implementation issue, but (I'm guessing) will probably be brought up again during review. I will try to take a look at the rest of the library shortly. - Jeff

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ah, excellent. As soon as it's approved, I'll be happy to take advantage of it.
Certainly. It should allow XInt to run at copy-on-write speeds, even in thread-safe mode -- a major improvement, and one that I'd jump at.
Yes, exactly. I'm not sure what's involved with making a container move-aware, but I'm fairly certain that the STL's containers aren't at present. I don't know whether the Boost.Move library will suffer from the same limitation.
If Boost.Move doesn't have the limitation mentioned above, then I'll probably get rid of the copy-on-write stuff completely. It wouldn't have any advantage that I can think of, at least for the moment.
I think I can defend the decision if it is. :-)
I will try to take a look at the rest of the library shortly.
Thanks. I appreciate the feedback. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuuq+sACgkQp9x9jeZ9/wQrbwCgySb5iD38QmEldkYWePd4AS78 ROYAoKfbtVIJHZwJ8VjBNHS89gtIPKZe =lqiF -----END PGP SIGNATURE-----

Chad Nelson wrote:
Within the (proposed) Boost.Move directory (but, I believe, submitted for separate review) are a full suite of move-aware STL containers. The code, I believe, is adapted from an existing STL implementation. So such move-aware containers, even without the presence of rvalue references, are readily available. However, I realize now my comment concerning move-aware containers was probably misplaced. I think the performance of xint::integer-valued containers should be only a very minor concern. Otherwise, perhaps we should discuss how to improve the performance a std::vector< std::vector<T> > container by using COW std::vector's. Oh wait, we have something better: (emulated) rvalue references ;) So for the time being, at least for the thread-safe version (which I guess could just be called the "move-aware" version, if you still end up with a COW version), I think you should use a custom implementation of emulated rvalue references (perhaps incompatible with Boost.Move, if you choose; I believe Boost.Thread may have something like this already, so it's not unheard of) so that you at least get the performance of moving *within* your library. The documentation and source for Boost.Move, plus referencing past discussions on this list, should give you enough information to understand the machinery. It doesn't require much code at all. Since this will be an implementation detail, it should be a simple matter, from there, to convert to using boost::rv<T>, if necessary and when appropriate. Some boosters will probably dislike having "another" move-emulation facility added to boost, but I think it's reasonable until a single move-emulation facility is made official. - Jeff

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'll certainly look into it. Thanks for the advice. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuu1MsACgkQp9x9jeZ9/wTCrQCdFQA7+hYkjLGXEFJgxMU8TEIr PZkAoPHwwF21ttQl7PybE8mlKhyd+P4q =6joh -----END PGP SIGNATURE-----

----- Original Message ----- From: "Chad Nelson" <chad.thecomfychair@gmail.com> To: <boost@lists.boost.org> Sent: Saturday, March 27, 2010 6:24 AM Subject: Re: [boost] New Boost.XInt Library, request preliminary review
Please could you be more explicit. Do you know some compilers on which Boost.Move doesn't works? Best, Vicente

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
As I described later in that branch of the thread, that statement was based on a comment in the Boost.Thread documentation (which I misremembered anyway). It didn't refer to the Boost.Move library. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuvzB8ACgkQp9x9jeZ9/wS+NACeLiYYilXCmglwU7lFRkX48uZf 7tEAnAiho3bkSdryHGTYm1XQhzws+XYc =xG0m -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
'Fraid I have to disagree with it then. n1692 compatibility is more important to me than trying to make it look exactly like a built-in type. *Work* like a built-in type, yes... look like one, no.
on the other hand looking at .net ints and double having 'toString()' and other member it's becoming a common practice
I don't see any viable reason to pretend that it's not a class.
you may wonder what other people think about it
Certainly. And if more than a few people tell me that they agree with you, I'll reconsider my position. :-)
Rather difficult to do it any other way. :-)
Then the fixed-size types will have to be implemented later, if there's enough call for them. For this stage, I'm concentrating on arbitrary-sized integers.
As you wish. :-)
Only when it's convenient. ;-)
I agree. The interface is generic enough that it should fit just about any similar library out there. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuuEG0ACgkQp9x9jeZ9/wR86wCfd6kWCHVApjF7FDgNVllnfu2k 4TMAn030+PvvAnqHkVEQ0J/5Z55vZNbu =l5JP -----END PGP SIGNATURE-----

AMDG Chad Nelson wrote:
I saw a couple of issues: * The operators should be defined in namespace xint, so they will be found by ADL. * If you provide random functions, it should be as a specialization of boost::uniform_int. Ideally, however, boost::uniform_int would just work. random.cpp:80 std::transform(mString.begin(), mString.end(), mString.begin(), zero); this could be std::fill(mString.begin(), mString.end(), '\0'); In Christ, Steven Watanabe

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Done. I wasn't sure where they should go.
I'm not familiar with that part of Boost.Random. I'm not sure how xint::random_by_size could be properly mapped to it, though the other three options could.
Done, and thanks. I just grabbed the first thing that I knew. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutO3EACgkQp9x9jeZ9/wTyrwCcDYw420BAMmpCW5SUUlLZsekR NAgAoLSAcUgGef0fmdZaeQmmBdXroEJz =Rpvz -----END PGP SIGNATURE-----

AMDG The documentation says: "Random Number Functions The library includes a secure random number generator, primarily to support the random_prime function, but a user-friendly interface is also available to developers using the library." *Mersenne Twister is not a cryptographic PRNG* In Christ, Steven Watanabe

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hm, you're right. I didn't realize that it could be predicted after so few values. I'll re-work that part to use /dev/urandom or RtlGenRandom directly when they're available. On systems where they're *not* available, is there a better choice of generator, given an (unpredictable) user-supplied seed value? - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutP+UACgkQp9x9jeZ9/wSn8ACgictlL+BVXaSDUMQwKP6iMoPx xOsAnRuhUNu8RkAzm91SS1pr39yhewEd =1g3x -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I could use that instead of /dev/urandom and RtlGenRandom, but then the library wouldn't compile on systems where boost::random_device isn't available. My goal was to make something that would work regardless of whether such a device was available, and leave it up to the person using the library whether they want to continue when it isn't. So again, given that it's going to be less secure, is there a better choice than the Mersenne Twister for systems where no random device is available? - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutRw0ACgkQp9x9jeZ9/wQyIQCeP8BfUKt6YdOvLevvgmOt/3hN EY0An39R6usHl189H0mjUwsyo5yvqaVf =nzKd -----END PGP SIGNATURE-----

On 26 March 2010 19:45, Chad Nelson <chad.thecomfychair@gmail.com> wrote:
Why not simply accept a Boost.Random (P)RNG, so the users can decide how random they want it to be? If you provide something that you expect will be used for security, it's a *feature* for it to fail when there's no CRNG available.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I started answering this by defending my current design, on the argument that it's easier to use than one that requires the user to know about random number generators himself. But after thinking about it, I *could* provide a plug-in interface to whatever RNG the user wants to use, and simply default to a less secure (but always available) RNG. That should satisfy all camps -- those who need cryptographically-secure RNGs can plug them in, and those who don't care can use the default RNG and never worry about it. I'll put that on the to-do list for the next iteration. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuthv0ACgkQp9x9jeZ9/wT1XwCeNf2uly1FC6xrMIIMP1BSZIBA +u0AnRi661xGaOTQ2UiGIDBelMme6X1V =1XOp -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Steven Watanabe said:
You didn't mention that boost::random_device is only available for Linux and BSD. As I didn't realize this until I had redesigned XInt's system to use it and was updating the documentation, it was an unpleasant surprise. Like it or not, most people still run Windows, and will for the foreseeable future. And since all versions of Windows since XP *do* provide a cryptographically-secure random number generator, there's no valid reason that XInt shouldn't support it. (There may be a reason why Boost.Random shouldn't, since the device isn't available on older versions of Windows, and the specification for boost::random_device explicitly says that it should only be defined on systems that provide such a device. Although Linux didn't provide it until kernel version 1.3.30 either, only seven years before XP was released.) However, I've redesigned XInt's random number system. It will now work with any of the Boost.Random-supplied generators (including random_device where available). I also added a strong_random_generator class, similar to random_device but which also works for Windows. It still defaults to a Mersenne Twister seeded with the time if no generator is provided, but that's a deliberate feature, not a bug. :-) These will be in the second iteration, which I'll post within the week if all goes well. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuuoAcACgkQp9x9jeZ9/wQiOQCdHBVaLbGRRCQu+OwP5hRSuB/e b/sAnjKkm67fkdUr1lLjJjisbmERg4jQ =yh2i -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ah, excellent. Then my version will probably be short-lived. Thank you. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuu01MACgkQp9x9jeZ9/wQMswCeIRnyGxESgJnOUmkZ946oqAAE faMAn1qnA1waTgIEghC3JNP4osAxbvzt =+Dcz -----END PGP SIGNATURE-----

Chad Nelson wrote:
Chad, your offering does indeed look like a very promising edition to Boost. Thank-you for the effort, though I do have some questions for its future incarnations: Question 1: Will you be adding an extensions module so that people can use GMP (or other bigint packages) for operation implementations? Question 2: Will you be adding any performance comparisons, say between this library and others? Question 3: Are there any plans to update the interface to make use of expression templates? - certain combinations of operations offer far superior performance when merged (at compile time) as opposed to being computed sequentially. Question 4: Will there be a conversion interface for scientific notion based integers representations? eg: -123e+300 (or even conversion from PODs such as doubles, long doubles or floats to xint::integer) Question 5: Seeing as you touched on the topic of cryptography, will there be a very simple RSA example? (most bigint libraries do this as a cursory indicator of their operational validity) Arash Partow

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I've been living and breathing this library for the past few weeks, I'd love to talk about it. :-)
Question 1: Will you be adding an extensions module so that people can use GMP (or other bigint packages) for operation implementations?
As I said in a message earlier this evening: - -----------------------8<--------------------------
I can see the desirability of that. But that said, it shouldn't be all that difficult to write a wrapper for pretty much any external library, to adapt it to whatever interface xint ends up using. I'm aiming for a Boost-licensed native C++ implementation for now, as that seems to be what has been missing to date. - -----------------------8<--------------------------
Question 2: Will you be adding any performance comparisons, say between this library and others?
I hadn't planned to, primarily because I'm not aiming for the highest performance. GMP and others have that aspect sewn up already; if someone wants high performance, they'll go to those. I'm aiming for the more casual user of large integers. Somebody who needs a large-integer package to do specific calculations in his closed-source software, for example, and needs a Boost-licensed implementation a lot more than the highest performance. Or the person who needs an open-source large-integer package that's 100% portable, so he can compile it on some weird system cobbled together from old supercomputer parts. Or the guy who just needs a large-integer package to solve a particular mathematical programming puzzle and doesn't want the headaches of installing GMP, compiling it, and figuring it out. Don't think that those people don't exist -- the whole reason I started writing it was because I was in the first camp myself. :-) I suspect that people like that make up the vast majority of those who need a large integer library.
Can you give me an example? There are a few things already in there that might fall into that category, like mulmod and expmod (vital for stuff like RSA encryption). Is that the kind of thing you had in mind?
The first can be done easily, if there's any call for it. The rest... there's no reason they couldn't be done, but I don't really see much need for it with an integer-only library. If you're using any kind of floating-point number to represent something that's too big for the system's standard integers, then it's probably too late to convert it to XInt -- you've already lost the precision that a large-integer library would provide. That said, once there's a standard large-integer library, it would be easy to build an arbitrary-precision floating-point type on top of it with those conversions. But again, I'm only concentrating on the first step right now, the large-integer library.
I can show the core parts of it -- how to generate the keys, and how to do the encryption and decryption, using XInt. But I'll have to leave it to someone else to put it all together, because I wrote exactly that for another company very recently, and I might get into lawyer trouble if the code I came up with is too similar to what I wrote for them. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkutg04ACgkQp9x9jeZ9/wTMqQCglQ53+GWKwI9jGuEhHcaA4/MK xgYAoOAAHt0F+nzY+4dm97CNBkWukQEW =l/UK -----END PGP SIGNATURE-----
participants (9)
-
Arash Partow
-
Chad Nelson
-
DE
-
Jeffrey Hellrung
-
Jeffrey Lee Hellrung, Jr.
-
Paul A. Bristow
-
Scott McMurray
-
Steven Watanabe
-
vicente.botet