|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20346 Computation Error
Submitted: 2002-11-10 15:44 UTC Modified: 2002-11-10 16:54 UTC
From: sprice at wisc dot edu Assigned:
Status: Not a bug Package: Math related
PHP Version: 4CVS-2002-11-10 OS: Darwin 6.1 (Mac OS X.2.1)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sprice at wisc dot edu
New email:
PHP Version: OS:


 [2002-11-10 15:44 UTC] sprice at wisc dot edu
On this one, I really don't have a clue what is wrong with PHP. Run the script shown below. Results should be "c" == "d" == "e", but "e" is some other value. I noticed that if you comment out the "$temp_x = ..." line (which shouldn't matter anyway) you get the correct answer for "e". I need this to convert a vector to unit length (which should be simple enough) and I thought that I was going crazy.

If you want to see how PHP is configured, look here:

$temp_x = .0663;
$temp_y = .01486;

print "a=" . $temp_x . ", b=" . $temp_y . ", c=" .
	(.0148 / sqrt( .0663 * .0663 + .01486 * .01486 ) ) . ", d=" .
	($temp_y / sqrt( ( $temp_x * $temp_x ) + ( $temp_y * $temp_y ) ));

$temp_x = $temp_x / sqrt(($temp_x * $temp_x ) + ( $temp_y * $temp_y ) );

$temp_y = $temp_y / sqrt(($temp_x * $temp_x ) + ( $temp_y * $temp_y ) );

echo ", e=" . $temp_y;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-10 15:48 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.
 [2002-11-10 16:21 UTC] sprice at wisc dot edu
Ummmm.... could you please explain why this isn't an error in PHP? It is only simple math and PHP is giving me an incorrect result.
 [2002-11-10 16:54 UTC] sprice at wisc dot edu
Nope, it isn't a precision problem, it is a regular old PEKAC error or ID 10 T error. Sorry for bothering you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Oct 03 02:01:24 2023 UTC