From: Michal H. <ms...@gm...> - 2008-01-24 11:37:42
|
On Jan 24, 2008 3:41 AM, Gwurk <gw...@fi...> wrote: > Hello, > > I ran into the problem where some CReals were being written in > scientific notation (e.g., "-4e-05" for -0.00004) into PDF streams, > which caused the stream to be invalid, giving errors like "Number of > operands mismatch" in ccontentstream.cc. > > It looks like the problem is in cobject.cc, in > simpleValueToString<pReal>(). You do > sprintf(buf,"%g",val); > and %g uses scientific notation if the number is small (or big) > enough. Is there some way to fix this? Without need to check the value I am thinking of %f instead of %g. This has small disadvantage - loose of precision and constant width also for numbers which don't need that much of space (e.g 0.2 would be 0.20000 if precision is 5). Attached patch checks the value and decides which format to use. Thanks! > -- Michal Hocko |