php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16593 x^y gives unusual results
Submitted: 2002-04-14 02:17 UTC Modified: 2002-04-14 05:31 UTC
From: paul at keteracel dot com Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 4.1.2 OS: Win XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
17 - 17 = ?
Subscribe to this entry?

 
 [2002-04-14 02:17 UTC] paul at keteracel dot com
x^y should always yield a positive number, however when doing -2^2 and (-2)^2, I get a result of -4!

Surely this aint right?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-14 05:31 UTC] sander@php.net
^ is the XOR operator, not the exponential operator. Use pow() for that.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC