note 75496 added to function.strval

From: Date: Sat, 02 Jun 2007 05:08:56 +0000
Subject: note 75496 added to function.strval
Groups: php.notes 
Request: Send a blank email to php-notes+get-127113@lists.php.net to get a copy of this message
The only way to convert a large float to a string is to use printf('%0.0f',$float); instead of strval($float); (php 5.1.4). // strval() will lose digits around pow(2,45); echo pow(2,50); // 1.1258999068426E+015 echo (string)pow(2,50); // 1.1258999068426E+015 echo strval(pow(2,50)); // 1.1258999068426E+015 // full conversion printf('%0.0f',pow(2,50)); // 112589906846624 echo sprintf('%0.0f',pow(2,50)); // 112589906846624 ---- Server IP: 69.39.81.135 Probable Submitter: 24.2.76.117 ---- Manual Page -- http://www.php.net/manual/en/function.strval.php Edit -- https://master.php.net/note/edit/75496 Del: integrated -- https://master.php.net/note/delete/75496/integrated Del: useless -- https://master.php.net/note/delete/75496/useless Del: bad code -- https://master.php.net/note/delete/75496/bad+code Del: spam -- https://master.php.net/note/delete/75496/spam Del: non-english -- https://master.php.net/note/delete/75496/non-english Del: in docs -- https://master.php.net/note/delete/75496/in+docs Del: other reasons-- https://master.php.net/note/delete/75496 Reject -- https://master.php.net/note/reject/75496 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127113) next »