| Summary: | log expression returns different results when casting | ||
|---|---|---|---|
| Product: | gcc | Reporter: | brad <brad_atcheson> |
| Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | 166255, 36876, adam, anoullez, benoit.sibaud, bernert, birger.b, brad_atcheson, cognot, csk, debian-gcc, denis.nagorny, deshpand, dsell, dyang, eda-qa, gbburkhardt, gcc-bugs, gcc-erikd, Graham.Murphy, green, gsinai, gtalbot, have, hjl.tools, jmurray, konstantin, lani, mark, neff.kevin, npr1, olcios, paul_blankenbaker, petr.savicky, piaget, pr2345, preciseflight, rozenman, sk2alexa, themis_hv, u.strempel, wirawan0, xiaoyi_wu |
| Priority: | P3 | ||
| Version: | 4.1.0 | ||
| Target Milestone: | --- | ||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | ||
|
Description
brad
2006-10-25 21:58:38 UTC
This comes from precission of the floating point. *** This bug has been marked as a duplicate of 323 *** To be more concrete: (int)(expression) rounds down. So if your quotient of logarithms happens to be computed to 5.999999999999999, then you will get a result of 5 after casting to int. You should round results, not just cast them. W. |