On 09/15/2014 03:38 PM, julien2412 wrote:
Hello,
Following
http://cgit.freedesktop.org/libreoffice/core/commit/?id=a3ad01dc1e07da21182077bd899094fd73f57714,
should it worth it to replace rtl_math_log1p/rtl_math_expm1 and related by
boost::math::log1p/expm1 ?
Or should we let the code as it is right now?
Since we already use Boost, I thought it could be interesting to use it even
more, waiting by a even more C++11 compatibility (since this standard
includes these 2 functions).
Julien
--
View this message in context:
http://nabble.documentfoundation.org/Should-we-use-boost-math-log1p-expm1-instead-of-rtl-math-log1p-expm1-tp4122334.html
Sent from the Dev mailing list archive at Nabble.com.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
Julien, I am curious if you have done any testing. On a whim, I ran the
following on my 64-bit Fedora machine using g++.
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/special_functions/expm1.hpp>
#include <iostream>
#include <math.h>
int main()
{
double min_x = -0.2;
double max_x = 0.2;
long max_its = 10000000;
double delta_x = (max_x - min_x) / (max_its - 1);
double x;
double d;
long i;
for (i=0; i<max_its; ++i) {
x = min_x + i * delta_x;
d = fabs(log1p(x) - boost::math::log1p(x));
if (d > 0.0) {
std::cout << "1. diff(" << x << ") = " << d << std::endl;
}
}
for (i=0; i<max_its; ++i) {
x = min_x + i * delta_x;
d = fabs(expm1(x) - boost::math::expm1(x));
if (d > 0.0) {
std::cout << "2. diff(" << x << ") = " << d << std::endl;
}
}
std::cout << "Finished!" << std::endl;
return 0;
}
No differences were found in this little test. Then again, on Fedora,
Boost may be configured to use the built-in implementation, I don't
really know. I did not check our source code, but, it might reduce the
LO code complexity a little bit, that might be a gain.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info: http://www.pitonyak.org/oo.php
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.