From:             [EMAIL PROTECTED]
Operating system: Redhat 6.2
PHP version:      4.0.4pl1
PHP Bug Type:     Math related
Bug description:  float,int multiplication problem when using sprintf

Sometimes when trying to multiply a float and a int then print the result out with 
sprintf there is a error in the computation.

The following code produces the incorrect output:

<?

    $val1 = 144.98;
    $result = ($val1 * 100);

    echo $result . "\n";                       ## Correct output '14498'
    echo sprintf ("%10d\n", $result);    ## Incorrect output '14497'

?>

Not sure if there is something obvious that I am missing? Any help would be 
appreciated.

My config line:
./configure --with-mysql=/usr --with-apxs=/usr/sbin/apxs --with-gd=/usr/local 
--enable-trans-sid --enable-track-vars --enable-bcmath --with-ttf


-- 
Edit Bug report at: http://bugs.php.net/?id=9248&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to