| От | Jeff Davis |
|---|---|
| Тема | numeric and float comparison oddities |
| Дата | |
| Msg-id | 1406874824.15301.47.camel@jeff-desktop обсуждение исходный текст |
| Ответы |
Re: numeric and float comparison oddities
|
| Список | pgsql-hackers |
I saw some strange results: postgres=# select '1.1'::numeric = '1.1'::float8;?column? ----------t (1 row) postgres=# select '1.1'::numeric = '1.1'::float4;?column? ----------f (1 row) When I looked into it, I saw that the numeric is being cast to a float8, making the first statement trivially true. Why does the cast go from numeric to float if that direction loses precision? One reason is because float supports +/- infinity, but that seems more like convenience than a good reason. Is there another reason? Have we considered adding +/- infinity to numeric so that it can represent every float value? That might make the numeric hierarchy a little cleaner and less surprising. Regards,Jeff Davis
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера