[Clp] Stupid question: how to enlarge the precision of number in the log?

Lou Hafer lou at cs.sfu.ca
Mon Sep 13 11:39:00 EDT 2010


Thomas,

> I am not sure if there is a solution that does NOT involve modifying the 
> source code. But I think it should not be hard to add this to the interface,

    There is no solution I'm aware of that does not involve modifying
source code. Calls of the form std::cout.precision(42) don't work
because the standard Coin message mechanism does not actually use C++
stream i/o.

    It would be possible, but nontrivial, to add this capability. As
you've seen, the mechanism is to define messages with printf-style
formatting codes. The precision is chosen by the developer at the time
the message is crafted, for each number that's printed. In effect, you
need to reach and override each of these formatting codes.

    The place to look for this global override capability is
CoinMessageHandler.cpp, in the various operator<< methods for numeric
values. The necessary changes would involve inspecting each formatting
code and replacing the developer's choice of significant digits with the
user's choice. Plus introducing some interface methods, along the lines
of precision(), to provide the control API.

    The general capability you're asking for is a reasonable enough
request, but I don't know that anyone is likely to take it on in the
near future.

						Lou




More information about the Clp mailing list