From:             [EMAIL PROTECTED]
Operating system: Darwin 6.1 (Mac OS X.2.1)
PHP version:      4CVS-2002-11-10
PHP Bug Type:     Math related
Bug description:  Computation Error

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 bug report at http://bugs.php.net/?id=20346&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20346&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20346&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20346&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20346&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20346&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20346&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20346&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20346&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20346&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20346&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20346&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20346&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20346&r=isapi

Reply via email to