Okay, but even if the rounded result does not have a finite binary representation, shouldn't the displayed (human readable) representation be at least truncated to the number of decimal places that were requested in the round function? Not that I am confusing round with truncate, but surely it is a more acceptable result?
thanks, Serena. On 9/3/07, Arjen Markus <[EMAIL PROTECTED]> wrote: > > Serena Lien wrote: > > >I have read some of the postings/faq about the difficulties with the > round > >function, when certain numbers do not have a finite representation in > >binary, which SQLite uses. eg 9.95 is actually 9.9499...etc so that > round( > >9.95, 1) rounds down. > > > >But, I have found several numbers which don't get rounded at all, and in > >fact return more decimal places! > > > >round(98926650.5, 1) -> 98926650.5000001 > >round(85227887.01, 1) -> 85227887.0000001 > > > >Even if these numbers cannot be represented properly in binary, why is it > >they aren't rounded? > > > >thanks for any assistance, > >Serena > > > > > They are in fact rounded, but the internal binary representation can not > be turned > into the appropriate decimal (and human readable) representation due to > the > finite precision. > > A number like 1.511 can be rounded to 1.5 and that is _exactly_ > representable > as binary number. But if, as in your examples, the number requires more > precision > than is available (remember: only a finite number of digits/bits in > total, no matter > what the position of the decimal point/comma), the old problem of > binary-to- > decimal conversion kicks in again. > > Regards, > > Arjen > > > > ----------------------------------------------------------------------------- > To unsubscribe, send email to [EMAIL PROTECTED] > > ----------------------------------------------------------------------------- > >