>>>>> "Kornel" == Kornel Benko <[EMAIL PROTECTED]> writes:

Kornel> On Freitag, 28. Februar 2003 17:34, Jean-Marc Lasgouttes
Kornel> wrote: ...
>> The problem is the following code in lyxlength.C:
>> 
>> string const LyXLength::asLatexString() const { ostringstream
>> buffer; switch (unit_) { case PTW: buffer <<
>> abs(static_cast<int>(val_/100)) << '.' <<
>> abs(static_cast<int>(val_)%100) << "\\textwidth"; break;
>> 
>> This is obviously broken. Who had this bright idea? ;) What was the
>> reason why double(abs(val_))/100 is not good enough? I remember
>> some discussion on the subject, but not the substance of these
>> discussions.

Kornel> I think, it was the internalisation. (E.g. print "50.5" as
Kornel> "50,5")

Yes, but can this happen with C++ streams without an explicit locale
setting? 

Kornel> How about

Kornel> { char val_buf[10]; ostringstream buffer;

Kornel>         sprintf(val_buf, "%d.%02d",
Kornel> abs(static_cast<int>(val_/100)),
Kornel> abs(static_cast<int>(val_)%100)); switch (unit_) { case PTW:
Kornel> buffer << val_buf << "\\textwidth"; break; ...

We had this one too at some time. It does not work for val_==100.

JMarc

Reply via email to