Re: [BUGS] BUG #3387: mod on non-integer returns bad result

2007-07-16 Thread Bruce Momjian
This has been saved for the 8.4 release: http://momjian.postgresql.org/cgi-bin/pgpatches_hold --- Tom Lane wrote: > Gregory Stark <[EMAIL PROTECTED]> writes: > > In the case reported div_var was getting 70/70 = 0.99

Re: [BUGS] BUG #3387: mod on non-integer returns bad result

2007-06-15 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > In the case reported div_var was getting 70/70 = 0.9. Which is > really just wrong. Agreed, but I think your proposed patch is just a band-aid. The real problem with div_var is that it generates inaccurate output digits at all --- it's assuming that

Re: [BUGS] BUG #3387: mod on non-integer returns bad result

2007-06-15 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > Gregory Stark <[EMAIL PROTECTED]> writes: >> The source of the problem is the floating point arithmetic which is used to >> do >> the individual steps in the long division. > > I don't think so. The ultimate source of the problem is that div_var > can onl

Re: [BUGS] BUG #3387: mod on non-integer returns bad result

2007-06-15 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > The source of the problem is the floating point arithmetic which is used to do > the individual steps in the long division. I don't think so. The ultimate source of the problem is that div_var can only report a finite number of digits.

Re: [BUGS] BUG #3387: mod on non-integer returns bad result

2007-06-15 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > "Filip Krska" <[EMAIL PROTECTED]> writes: >> select mod (70.0,70) from dual; >> returns >> 70.0 >> instead of >> 0.0 > > PG 8.0 gets this right. I think this demonstrates that Bruce's 8.1 patch > http://archives.postgresql.org/pgsql-committers/2005-06/msg0

Re: [BUGS] BUG #3387: mod on non-integer returns bad result

2007-06-15 Thread Tom Lane
"Filip Krska" <[EMAIL PROTECTED]> writes: > select mod (70.0,70) from dual; > returns > 70.0 > instead of > 0.0 PG 8.0 gets this right. I think this demonstrates that Bruce's 8.1 patch http://archives.postgresql.org/pgsql-committers/2005-06/msg00045.php didn't actually fix anything, merely move t

[BUGS] BUG #3387: mod on non-integer returns bad result

2007-06-15 Thread Filip Krska
The following bug has been logged online: Bug reference: 3387 Logged by: Filip Krska Email address: [EMAIL PROTECTED] PostgreSQL version: 8.1.5 Operating system: CentOS Linux 3.8 on x86_64 Description:mod on non-integer returns bad result Details: Hello, select mod