
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Bruno Lalande Sent: 30 March 2009 15:56 To: boost@lists.boost.org Subject: [boost] A Boost.NumericAdaptor library to support big numbers
Hello,
Barend quickly talked about this in the discussion about robustness, big numbers and GMP. We have discussed about the idea and I'd like to present it here to see if there's an interest.
The idea started from the need to rely on big numbers in geometry computations that are sensitive to floating point errors. The most important points were: - big numbers are needed for those computations - it's difficult to develop a Boost Big Numbers library as efficient as the existing ones - having a Boost geometry library that *necessarily* depends on an existing big numbers library would impose to the user the way in which big numbers must be handled, and would imply a dependency that apparently disturbs some people
Thus we had the idea of using an adaptor, that is a wrapper that would have the same semantics as a number, with an underlying implementation chosen at compile-time, by selecting a policy. There would be a IEEE policy that doesn't use any big number at all, and other policies that would be implemented upon the most widely used big numbers libraries.
In the end it appears that this adaptor could become a library on its own since it can be useful in other libraries than just geometry. It could thus take the form of a Boost.NumericAdaptor library, aimed to any library developer who needs to optionally enable the use of big numbers for the most robustness-sensible operations of his library. He would just have to take a policy as a template parameter, and propagate this policy to a Numeric Adaptor used internally. The first user of this library would obviously be the GGL we're developing. Libraries like the fixed-size matrix being currently discussed as a GSoC project could offer take advantage of this kind of library, since ideally it has to support big numbers.
The sample in attachment shows the numeric_adaptor, a IEEE policy, a GMP policy and a sample showing the use of the library. The implementation has to evolve of course, but the main points are here.
Would there be an interest in adding such a library into Boost?
Bruno Lalande Barend Gehrels
Yes - Sounds interesting - but the sample compiles - with a blizzard of warnings :-(( I've used this gmp.h #include "i:\boost-sandbox\SOC\2007\bigint\gmp-win32\gmp.h" but fails to link for me. (MSVC 2008 Sp1) What am I also missing? Paul --- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow@hetp.u-net.com num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_clear referenced in function "public: static void __cdecl gmp_policy::destruct(struct __mpf_struct (&)[1])" (?destruct@gmp_policy@@SAXAAY00U__mpf_struct@@@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_set referenced in function "public: static void __cdecl gmp_policy::copy(struct __mpf_struct const (&)[1],struct __mpf_struct (&)[1])" (?copy@gmp_policy@@SAXAAY00$$CBU__mpf_struct@@AAY00U2@@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_cmp referenced in function "public: static int __cdecl gmp_policy::compare(struct __mpf_struct const (&)[1],struct __mpf_struct const (&)[1])" (?compare@gmp_policy@@SAHAAY00$$CBU__mpf_struct@@0@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_init referenced in function "public: static void __cdecl gmp_policy::init(struct __mpf_struct (&)[1])" (?init@gmp_policy@@SAXAAY00U__mpf_struct@@@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_add referenced in function "public: static void __cdecl gmp_policy::add(struct __mpf_struct (&)[1],struct __mpf_struct const (&)[1],struct __mpf_struct const (&)[1])" (?add@gmp_policy@@SAXAAY00U__mpf_struct@@AAY00$$CBU2@1@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_mul referenced in function "public: static void __cdecl gmp_policy::multiply(struct __mpf_struct (&)[1],struct __mpf_struct const (&)[1],struct __mpf_struct const (&)[1])" (?multiply@gmp_policy@@SAXAAY00U__mpf_struct@@AAY00$$CBU2@1@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_sub referenced in function "public: static void __cdecl gmp_policy::subtract(struct __mpf_struct (&)[1],struct __mpf_struct const (&)[1],struct __mpf_struct const (&)[1])" (?subtract@gmp_policy@@SAXAAY00U__mpf_struct@@AAY00$$CBU2@1@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_div referenced in function "public: static void __cdecl gmp_policy::divide(struct __mpf_struct (&)[1],struct __mpf_struct const (&)[1],struct __mpf_struct const (&)[1])" (?divide@gmp_policy@@SAXAAY00U__mpf_struct@@AAY00$$CBU2@1@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_sqrt referenced in function "public: static void __cdecl gmp_policy::sqrt(struct __mpf_struct (&)[1],struct __mpf_struct const (&)[1])" (?sqrt@gmp_policy@@SAXAAY00U__mpf_struct@@AAY00$$CBU2@@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_set_d referenced in function "public: static void __cdecl gmp_policy::set<double>(struct __mpf_struct (&)[1],double const &)" (??$set@N@gmp_policy@@SAXAAY00U__mpf_struct@@ABN@Z) num_adaptor.obj : error LNK2019: unresolved external symbol __imp____gmpf_get_d referenced in function "public: static double __cdecl gmp_policy::big_numeric_cast<double>(struct __mpf_struct const (&)[1])" (??$big_numeric_cast@N@gmp_policy@@SANAAY00$$CBU__mpf_struct@@@Z) J:\Cpp\num_adapter\num_adapter\Debug\num_adapter.exe : fatal error LNK1120: 11 unresolved externals E-mail message checked by Spyware Doctor (6.0.0.386) Database version: 5.12070 http://www.pctools.com/uk/spyware-doctor-antivirus/