| От | Knut Forkalsrud |
|---|---|
| Тема | Re: 'real' strange problem in 7.1.3 |
| Дата | |
| Msg-id | lzlmhfsdm9.fsf@darkstar.cj.com обсуждение исходный текст |
| Ответ на | 'real' strange problem in 7.1.3 (reina@nsi.edu (Tony Reina)) |
| Список | pgsql-hackers |
reina@nsi.edu (Tony Reina) writes: > db02=# select distinct arm from ellipse where exag_ratio = 1.0; You never want to use the = test on floating point numbers. Two apparently equal numbers may differ in the least significant digit. The behavior will be close to random. When you convert the floating point to a string and round off to a specific number of digits, you can use string compare to get more predictable results. Another possibility is to do something like where abs(exag_ratio - 1.0) > 0.000001 (I'm not sure about the SQL function for absolute value, but you get the idea). -Knut -- The early worm gets the bird.
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера