php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41915 Problem from multiplication
Submitted: 2007-07-06 10:53 UTC Modified: 2007-07-06 11:06 UTC
From: pawel1-81 at O2 dot PL Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.3 OS: WINDOWS XP HOME
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pawel1-81 at O2 dot PL
New email:
PHP Version: OS:

 

 [2007-07-06 10:53 UTC] pawel1-81 at O2 dot PL
Description:
------------
Why for some values $ r ($r * 10000000) result on example 1015 be paid back 1.015 E + 10 and for 2886 -> 28860000000
In previous version php all acts

Reproduce code:
---------------
<meta HTTP-EQUIV="Refresh" CONTENT="10;>

<?php
$function['min'] = 400;
$function['max'] = 4000;

$r = mt_rand($function['min'], $function['max']);

echo '<br>$r = '.$r
	
		.'<br>$r * 10000000 = '. ($r * 10000000)
	
		.'<br>$function["max"]* 10000000 = '. ($function['max']* 10000000) 
	
		.'<br>4000 * 10000000 = '. (4000 * 10000000);
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-06 11:06 UTC] tony2001@php.net
Expected behaviour, there is nothing wrong here.
To output a float, use printf()/number_format() and other functions.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 16:01:34 2025 UTC