Is floating_point_comparison.hpp general purpose tool?

Hi, I'm wondering why the floating-point algorithms [1] implementation in floating_point_comparison.hpp lives in Boost UTF. Shouldn't it go to location that would suggest it's not only usable for unit tests but it is a general purpose tool. [1] http://www.boost.org/doc/libs/1_41_0/libs/test/doc/html/utf/testing-tools/fl... Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org

I'm wondering why the floating-point algorithms [1] implementation in floating_point_comparison.hpp lives in Boost UTF.
I've also wondered this and have used UTF's floating point comparison algorithms outside test code. Creating a new header like <boost/math/fpcompare.hpp> to parallel the existing <boost/math/fpclassify.hpp> under the floating point utils [1] could be useful. - Rhys [1] http://www.boost.org/doc/libs/1_41_0/libs/math/doc/sf_and_dist/html/math_too...

I have, for my own purposes, refactored Gennidy's Boost.Test code - attached - with a demo. Is this of any interest or does it meet your needs? (The location you suggest sounds sensible - except that people may have trouble finding it, an existing difficulty with the math toolkit structure. Doxygenation might help this, but is a massive job - see the doxygen comments in fp_compare.hpp.) Paul
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Rhys Ulerich Sent: Thursday, December 31, 2009 4:45 PM To: boost@lists.boost.org Subject: Re: [boost] Is floating_point_comparison.hpp general purpose tool?
I'm wondering why the floating-point algorithms [1] implementation in floating_point_comparison.hpp lives in Boost UTF.
I've also wondered this and have used UTF's floating point comparison algorithms outside test code. Creating a new header like <boost/math/fpcompare.hpp> to parallel the existing <boost/math/fpclassify.hpp> under the floating point utils [1] could be useful.
- Rhys
[1]
http://www.boost.org/doc/libs/1_41_0/libs/math/doc/sf_and_dist/html/math_too... /utils.html
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Paul A. Bristow wrote:
I have, for my own purposes, refactored Gennidy's Boost.Test code - attached - with a demo.
I'd rather have single copy of these inside boost tree. Also If we move these under math utils hood, I'd rather keep the same name and functionality. Gennadiy

with a demo.
I'd rather have single copy of these inside boost tree. Also If we move these under math utils hood, I'd rather keep the same name and functionality.
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Monday, January 04, 2010 12:42 AM To: boost@lists.boost.org Subject: Re: [boost] Is floating_point_comparison.hpp general purpose tool?
Paul A. Bristow wrote:
I have, for my own purposes, refactored Gennidy's Boost.Test code - attached
I'm sure you would ;-) But do others feel a need for enhancements that I hope I have provided? Paul --- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow@hetp.u-net.com

Paul A. Bristow wrote:
with a demo. I'd rather have single copy of these inside boost tree. Also If we move these under math utils hood, I'd rather keep the same name and functionality.
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Monday, January 04, 2010 12:42 AM To: boost@lists.boost.org Subject: Re: [boost] Is floating_point_comparison.hpp general purpose tool?
Paul A. Bristow wrote:
I have, for my own purposes, refactored Gennidy's Boost.Test code - attached
I'm sure you would ;-)
But do others feel a need for enhancements that I hope I have provided?
Paul, Your header works for me very well. Thanks! Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org

Paul,
I have, for my own purposes, refactored Gennidy's Boost.Test code - attached with a demo.
I also like the header. A couple of nits if this one gets added to the official codebase: I'd personally call "close_to" "close" and "smallest" "small". The latter in both case is shorter and reads better in conditional statements. In particular, "close_to" begs the question "close_to_what?". Also, I'd drop the "tiny" and "neareq" typedefs since you've already got double as the default template parameter for brevity. Lastly, I still dig calling it 'fpcompare.hpp' to mirror 'fpclassify.hpp'. Thank you for extracting these, Rhys

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Mateusz Loskot Sent: Tuesday, January 05, 2010 12:45 AM To: boost@lists.boost.org Subject: Re: [boost] Is floating_point_comparison.hpp general purpose tool?
with a demo. I'd rather have single copy of these inside boost tree. Also If we move these under math utils hood, I'd rather keep the same name and functionality.
Paul A. Bristow wrote:
I have, for my own purposes, refactored Gennidy's Boost.Test code - attached
I'm sure you would ;-)
But do others feel a need for enhancements that I hope I have provided?
Your header works for me very well.
I'm sure my draft needs much further work but while the Boost.Test FP comparison is functional for testing, IMO it does not work nicely enough (nor documented well enough) for general use in Boost.Math and remains a TODO. Paul --- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow@hetp.u-net.com

Paul A. Bristow wrote:
I'm sure my draft needs much further work but while the Boost.Test FP comparison is functional for testing, IMO it does not work nicely enough (nor documented well enough) for general use in Boost.Math and remains a TODO.
Understood. Thanks. Best regards, -- Mateusz Loskot http://mateusz.loskot.net

Mateusz Loskot <mateusz <at> loskot.net> writes:
Hi,
I'm wondering why the floating-point algorithms [1] implementation in floating_point_comparison.hpp lives in Boost UTF.
There are number of things which can be used in production code which resides under boost/test hood. How does it prevents you from using it? Is it only general confusion?
Shouldn't it go to location that would suggest it's not only usable for unit tests but it is a general purpose tool.
I do not object too much, other than support assignment. Up till now I was primarily concentrating on staff under boost/test. Or you suggest move the support to the math library authors? Another point is that Boost.Test strives to limit dependencies on other components. Placing these headers elsewhere might break this policy. Incidentally I've got a proposal for the session for boostcon to cover production use of Boost.Test. If it's approved we can discuss this subject as well. Genandiy

Gennadiy Rozental pisze:
Mateusz Loskot <mateusz <at> loskot.net> writes:
I'm wondering why the floating-point algorithms [1] implementation in floating_point_comparison.hpp lives in Boost UTF.
There are number of things which can be used in production code which resides under boost/test hood. How does it prevents you from using it? Is it only general confusion?
It does not prevents me at all or anyone else I suppose too. I just found that for some users it is confusing and some users do not recognize those tools as general purpose ones. Also, there is a kind of psychological effect of yet another third party dependency that may make some users to avoid those tools :-) I say what I've experienced when I tried to suggest to use the FP algorithms in Boost.Geometry (GGL). I saw Boost.Test FP algorithms seem to be used in Boost.Graph and perhaps others, but it looks like exceptional cases. Simply, my understanding is that those algorithms state a well-known robust implementation of floating-point comparison and as such it is recommended to be used across Boost libraries so their clients as well. Thus, a bit of promotion seems beneficial :-)
Shouldn't it go to location that would suggest i
t's not only
usable for unit tests but it is a general purpose tool.
I do not object too much, other than support assignment. Up till now I was primarily concentrating on staff under boost/test. Or you suggest move the support to the math library authors?
I think it some sort of math utilities would be a good place.
Another point is that Boost.Test strives to limit dependencies on other components. Placing these headers elsewhere might break this policy.
Understood.
Incidentally I've got a proposal for the session for boostcon to cover production use of Boost.Test. If it's approved we can discuss this subject as well.
I'll stay tuned. Best regards, -- Mateusz Loskot http://mateusz.loskot.net
participants (4)
-
Gennadiy Rozental
-
Mateusz Loskot
-
Paul A. Bristow
-
Rhys Ulerich