[Libreoffice] [PATCH] Fix for OO Basic Million-to-one bug #i76852#

Noel Power nopower at novell.com
Thu Nov 4 03:11:08 PDT 2010


On Wed, 2010-11-03 at 21:47 -0700, John LeMoyne Castle wrote:
> Adds '=' to edge test in sbxscan.cxx ImpCvtNum so exponent prints and 1
> million is 1e+6 instead of just 1 for singles.  
> Same one char change does similar fix for OO Basic doubles and 1e+14. 
> 
> When I saw #i76852# -- http://qa.openoffice.org/issues/show_bug.cgi?id=76852
> -- describe how and when OOBasic prints as single with value 1 000 000  as 1
> (with no million) I thought right off: edge case ==> missing equals.  
> 
> Using OpenGrok, I drilled in through the basic interface for the CStr()
> function.  CStr() is implicitly called by print in the OOBasic interpreter
> when it needs to print a number.  Straight away found these two lines in
> sbxscan.cxx ImpCvtNum method: 
> 
>     double dMaxNumWithoutExp = (nPrec == 6) ? 1E6 : 1E14;
>     myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum >
> dMaxNumWithoutExp ) ) ? 4:0,
> 
nice going, I see little enough risk in this other than introducing a
different error of the same type ;-) ( but it looks good to me ) The key
thing is that the internal number representation is always valid anyway
and this is a presentation bug. I think we are ok to push this to
master.

Noel



More information about the LibreOffice mailing list