php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33168 Incorrect abs() result.
Submitted: 2005-05-28 01:15 UTC Modified: 2005-05-28 07:15 UTC
From: dima at snaiper dot no-ip dot com Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.0.4 OS: windows xp
Private report: No CVE-ID: None
 [2005-05-28 01:15 UTC] dima at snaiper dot no-ip dot com
Description:
------------
I get rounded value in abs() function.

Reproduce code:
---------------
echo abs(-10.414234005636601);
echo "<br>";
echo abs(-340.1242340053423432423000000000000234324636601);
echo "<br>";
echo abs(-1320.72423000340056366201);
	

Expected result:
----------------
10.414234005636601
340.1242340053423432423000000000000234324636601
1320.72423000340056366201

Actual result:
--------------
10.4142340056
340.124234005
1320.72423

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-28 07:15 UTC] rasmus@php.net
If you want higher precision from the math functions in PHP, then you need to configure that in your ini file via the precision directive.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 09:01:28 2024 UTC