summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Jacobi <sj@openoffice.org>2002-09-17 11:11:00 +0000
committerSven Jacobi <sj@openoffice.org>2002-09-17 11:11:00 +0000
commitc26d897926777167a9cf06b0679791b8f0b3fe1c (patch)
tree108fa76b625d50976bfa919badee4379314c4dc7
parentd6e7184f7370b7cff7f4ffb05410eaf5c9bd9b30 (diff)
#103317# fixed problem with small fractional values
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index dab6921efd1a..5831e41ef087 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pdfwriter_impl.cxx,v $
*
- * $Revision: 1.24 $
+ * $Revision: 1.25 $
*
- * last change: $Author: pl $ $Date: 2002-09-17 11:15:43 $
+ * last change: $Author: sj $ $Date: 2002-09-17 12:11:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -132,17 +132,22 @@ static void appendDouble( double fValue, OStringBuffer& rBuffer, int nPrecision
{
fValue *= pow( 10.0, (double)nPrecision );
nFrac = (sal_Int64)fValue;
- while( nFrac && ! (nFrac % 10 ) )
- nFrac /= 10;
}
-
if( bNeg && ( nInt || nFrac ) )
rBuffer.append( '-' );
rBuffer.append( nInt );
if( nFrac )
{
+ int i;
rBuffer.append( '.' );
- rBuffer.append( nFrac );
+ sal_Int64 nBound = (sal_Int16)pow( 10, nPrecision - 1 );
+ for ( i = 0; ( i < nPrecision ) && nFrac; i++ )
+ {
+ sal_Int64 nNumb = nFrac / nBound;
+ nFrac -= nNumb * nBound;
+ rBuffer.append( nNumb );
+ nBound /= 10;
+ }
}
}