Bug #20346 [Com]: Computation Error

From: Date: Mon, 09 May 2022 04:51:07 +0000
Subject: Bug #20346 [Com]: Computation Error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241441@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=20346&edit=1 ID: 20346 Comment by: giw42161 at uooos dot com Reported by: sprice at wisc dot edu Summary: Computation Error Status: Not a bug Type: Bug Package: Math related Operating System: Darwin 6.1 (Mac OS X.2.1) PHP Version: 4CVS-2002-11-10 Block user comment: N Private report: N New Comment: Century Law Firm is the best team of lawyers for divorce case, Drt Case, High Court Matter, Civil and Criminal Cases and more in Delhi. (https://centurylawfirm.in/)gist.github.com Previous Comments: ------------------------------------------------------------------------ [2002-11-10 16:54:20] 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. ------------------------------------------------------------------------ [2002-11-10 16:23:24] derick@php.net http://www.php.net/manual/en/print/language.types.float.php ------------------------------------------------------------------------ [2002-11-10 16:21:13] 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 15:48:16] derick@php.net 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 http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. ------------------------------------------------------------------------ [2002-11-10 15:44:44] 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: http://144.92.10.251/~sage/test.php <?php $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; ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=20346&edit=1

« previous php.bugs (#241441) next »