[Coin-discuss] CoinUtils CoinMpsIO.cpp CoinConvertDouble char outputValue[20]

Cheng,Jen-Min jcheng at mwdh2o.com
Tue Jul 3 10:10:15 EDT 2007



> The outputValue is decalred as char [20] in both CoinMpsIO.cpp and
> CoinMpsIO.hpp.  
> 
> void
> CoinConvertDouble(int section, int formatType, double value, char
> outputValue[20])
> 
> void
> CoinConvertDouble(int section, int formatType, double value, char
> outputValue[20]);
> 
> 
> In the code, outputValue is initialized to be 24 spaces, which exceeds
> char [20].
> 
>     if (fabs(value)<1.0e40) {
>       memset(outputValue,' ',24);
> 
>       for (j=0;j<23;j++) {
> 	if (outputValue[j]!=' ')
> 	  outputValue[i++]=outputValue[j];
>       }
> 
> ClpSimpexOther passes char number[20] to CoinConvertDouble.  
> 
> int 
> ClpSimplexOther::writeBasis(const char *filename,
> 			    bool writeValues,
> 			    int formatType) const
>   char number[20];
>       CoinConvertDouble(0,formatType,columnActivity_[iColumn],number);
> 
> 
> convertDouble passes char outputValue[24] to CoinConvertDouble.   
> 
> static void
> convertDouble(int section,int formatType, double value, char
> outputValue[24],
> 	      const char * name, char outputRow[100])
> {
>   convertRowName(formatType,name,outputRow);
>   CoinConvertDouble(section,formatType&3,value,outputValue);
> }
> 
> 
> 
> Will such a practice mess up the data?  Thanks.
> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/coin-discuss/attachments/20070703/0fadd86e/attachment.html>


More information about the Coin-discuss mailing list