note 110475 added to numberformatter.formatcurrency

From: Date: Thu, 25 Oct 2012 17:40:37 +0000
Subject: note 110475 added to numberformatter.formatcurrency
Groups: php.notes 
Request: Send a blank email to php-notes+get-191546@lists.php.net to get a copy of this message
While this function accepts floats for currency (in order to display cents), you should (for applications where this is critical) never store or handle money using floats, as rounding errors may occur. Work with integers (or a BigInt class if integers aren't large enough) internally instead, where the integer represents the total number of cents. An alternative (especially if you need more precision than cents) is using the BC (Binary Calculator) Math module, that handles arbitrary precision numbers with 100% accuracy. ---- Server IP: 83.137.20.135 Probable Submitter: 95.97.45.186 ---- Manual Page -- http://www.php.net/manual/en/numberformatter.formatcurrency.php Edit -- https://master.php.net/note/edit/110475 Del: integrated -- https://master.php.net/note/delete/110475/integrated Del: useless -- https://master.php.net/note/delete/110475/useless Del: bad code -- https://master.php.net/note/delete/110475/bad+code Del: spam -- https://master.php.net/note/delete/110475/spam Del: non-english -- https://master.php.net/note/delete/110475/non-english Del: in docs -- https://master.php.net/note/delete/110475/in+docs Del: other reasons-- https://master.php.net/note/delete/110475 Reject -- https://master.php.net/note/reject/110475 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#191546) next »