Bug #51547 [Opn]: Type casting from int to int after log changes value

From: Date: Tue, 13 Apr 2010 09:04:48 +0000
Subject: Bug #51547 [Opn]: Type casting from int to int after log changes value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-149530@lists.php.net to get a copy of this message
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

« previous php.bugs (#149530) next »