int4, int8, real ....division...
От | Gyenese Pál Attila |
---|---|
Тема | int4, int8, real ....division... |
Дата | |
Msg-id | 51404.195.70.45.71.1084985674.squirrel@mediagnost.hu обсуждение исходный текст |
Ответы |
Re: int4, int8, real ....division...
|
Список | pgsql-bugs |
pgsql-7.4.2 I think it's not a bug, just interesting results: SELECT 9223372036854775807/(365*10000000) ; result: -14300526699 wrong SELECT ( 9223372036854775807/365 )/10000000 ; result: 2526951242 good SELECT ( 9223372036854775807::real /(365*10000000) ) ; result: -14300526699,6589 wrong SELECT ( 9223372036854775807 /(365*10000000)::real ) ; result: -14300526699,6589 wrong SELECT ( 9223372036854775807 /(365*10000000)::real ) ; result: -14300526699,6589 wrong SELECT ( 9223372036854775807/(365*10000000::real) ) ; result: 2526951242,97391 good SELECT ( 9223372036854775807/(365::real*10000000) ) ; result: 2526951242,97391 good REASON IS: SELECT 365*10000000 ; result: -644967296 wrong but SELECT 365*10000000::int8 ; result: 3650000000 good If this operation embended in complex expression, then very difficult to find the reason of computation error. This misstake comes only after the border of int4 and int8. ------------------------------------------------- Gyenese Pál Attila számítástechnikai vezető MEDIAGNOST KFT. 1106 Fehér út 10 Tel.: 431.87.74 Fax.: 265.20.73
В списке pgsql-bugs по дате отправления: