Bug #66326 [Opn->Nab]: math oparation

From: Date: Thu, 19 Dec 2013 21:13:40 +0000
Subject: Bug #66326 [Opn->Nab]: math oparation
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183405@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66326&edit=1 ID: 66326 Updated by: requinix@php.net Reported by: ivo dot urbanek at yahoo dot co dot uk Summary: math oparation -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Win 7 x64 / openSUSE 12.3 PHP Version: 5.4.23 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php ^ is a bitwise XOR, not a power/exponentiation operator. Use pow(). http://www.php.net/pow Previous Comments: ------------------------------------------------------------------------ [2013-12-19 21:11:42] ivo dot urbanek at yahoo dot co dot uk Description: ------------ Great problem with calculation power two - how easy, have a look B^2 = B*B but not in PHP. Please run a example. If B = 12E4, than B*B is not B^2 !!! Test script: --------------- $A=1; $B=6.911824E4; $C=3.95554E8; // $D = $B^2-4*$A*$C; $sqr=sqrt($D); echo "discriminant = $D <br>"; $D = $B*$B; echo "B*B = $D <br>"; $D = $B^2; echo "B^2 = $D <br>"; # <-- Here is deferent number !!! // $D = 4*$A*$C; echo "4*A*C = $D <br>"; Expected result: ---------------- B*B = 4777331100.6976 B^2 = 69116 # <-- Incorrect ! B*B = 4777331100.6976 # good answer Actual result: -------------- B^2 = 69116 # <-- Incorrect ! ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66326&edit=1

« previous php.bugs (#183405) next »