php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76932 multiplication operation problem
Submitted: 2018-09-25 13:42 UTC Modified: 2018-09-26 09:33 UTC
From: ozgur at end dot com dot tr Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.6.38 OS: Centos
Private report: No CVE-ID: None
 [2018-09-25 13:42 UTC] ozgur at end dot com dot tr
Description:
------------
$usd_DS = 5.1254;
$topluyoruz = $usd_DS * $stokbilgi['fiyat'] * $oku['uretimadet'];
not working code

vs

$topluyoruz = 5.1254 * $stokbilgi['fiyat'] * $oku['uretimadet'];
working code

Test script:
---------------
$usd_DS = 5.1254;
$topluyoruz = $usd_DS * $stokbilgi['fiyat'] * $oku['uretimadet'];
not working code

vs

$topluyoruz = 5.1254 * $stokbilgi['fiyat'] * $oku['uretimadet'];
working code

Expected result:
----------------
$usd_DS = 5.1254;
$topluyoruz = $usd_DS * $stokbilgi['fiyat'] * $oku['uretimadet'];
not working code

vs

$topluyoruz = 5.1254 * $stokbilgi['fiyat'] * $oku['uretimadet'];
working code

Actual result:
--------------
$usd_DS = 5.1254;
$topluyoruz = $usd_DS * $stokbilgi['fiyat'] * $oku['uretimadet'];
not working code

vs

$topluyoruz = 5.1254 * $stokbilgi['fiyat'] * $oku['uretimadet'];
working code

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-25 14:02 UTC] peehaa@php.net
-Status: Open +Status: Feedback
 [2018-09-25 14:02 UTC] peehaa@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.
 [2018-09-25 14:12 UTC] danack@php.net
As Peehaa - it's hard to know what you're reporting. I suspect you're getting tripped up by debugging something after echoing out a value, that has been rounded, and then expecting the rounded value to have the same output as the exact value.


ini_set('precision', "11");

$a = 35;
$b = -34.99;

echo $a + $b;
echo "\n";

ini_set('precision', "17");

echo $a + $b;
echo "\n";


Using the output of 0.01 obviously doesn't give the same result as using the output of 0.0099999999999980105
 [2018-09-26 09:33 UTC] peehaa@php.net
-Status: Feedback +Status: No Feedback
 [2018-09-26 09:33 UTC] peehaa@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 09:01:29 2024 UTC