Bug #76932 [Com]: multiplication operation problem

From: Date: Tue, 25 Sep 2018 14:12:11 +0000
Subject: Bug #76932 [Com]: multiplication operation problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217234@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76932&edit=1

 ID:                 76932
 Comment by:         danack@php.net
 Reported by:        ozgur at end dot com dot tr
 Summary:            multiplication operation problem
 Status:             Feedback
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Centos
 PHP Version:        5.6.38
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2018-09-25 14:02:12] 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 13:42:10] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=76932&edit=1


Thread (4 messages)

« previous php.bugs (#217234) next »