Bug #51547 [Opn]: Type casting from int to int after log changes value
[email protected] ("acollins at liv dot ac dot uk") Tue, 13 Apr 2010 11:04:48 +0200 (CEST)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at http://bugs.php.net/bug.php?id=51547&edit=1 ID: 51547 User updated by: acollins at liv dot ac dot uk Reported by: acollins at liv dot ac dot uk Summary: Type casting from int to int after log changes value Status: Open Type: Bug Package: *Math Functions PHP Version: 5.2.13 New Comment: Note: I assume this is because log() returns a floating point value. I.e. it's a precision issue? Previous Comments: ------------------------------------------------------------------------ [2010-04-13 11:03:32] acollins at liv dot ac dot uk Description: ------------ When performing a log(), and immediately type casting afterwards, the value changes. Test script: --------------- <?php $val = 1000; echo log($val, 10) .' == '. (int) log($val, 10); ?> Expected result: ---------------- 3 == 3 Actual result: -------------- 3 == 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51547&edit=1