Bug #16366 Updated: bit shifting error
| From: | daniel@php.net | Date: | Sun, 31 Mar 2002 17:21:09 +0000 |
| Subject: | Bug #16366 Updated: bit shifting error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-3684@lists.php.net to get a copy of this message | ||
ID: 16366
Updated by: daniel@php.net
Reported By: adam@adeptsoftware.com
Status: Closed
Bug Type: Math related
Operating System: WinXP
PHP Version: 4.1.2
New Comment:
and besides, you should consider using more accurate operators for
sensitive data:
http://www.php.net/manual/en/ref.bc.php
PHP is not actually meant to do real-time calculations or to write
3D-engines in. Also, there is no precalculated sine table and no int
13h in PHP :)
11/34 or bcdiv(11, 34) should do the trick.
Previous Comments:
------------------------------------------------------------------------
[2002-03-31 11:54:25] sander@php.net
AFAIK, PHP stores any number from MySQL as a string, until you access
it as a number. If you try to do some math on that number, that will
probably not work as expected. Bitshifting won't work either.
------------------------------------------------------------------------
[2002-03-31 11:48:25] adam@adeptsoftware.com
echo (11>>34) produces "2"
Also PHP docs state that the max integer is "usually" 32 bits. So what
is an unsigned bigint from mysql stored as, and can I use the bit shift
operator on it?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16366&edit=1