help : getting float max

From: Date: Sun, 24 May 2009 13:33:58 +0000
Subject: help : getting float max
Groups: php.general 
Request: Send a blank email to php-general+get-293064@lists.php.net to get a copy of this message
Afternoon all, This is a quick survey, think it would be useful to have the values of MAX_FLOAT for each platform, and indeed see if it does differ. to do this can you please run the following code (bc* required) and reply back with the output (and your platform / php version) code: <?php function getMaxFloat() { $value = '1'; $multiplier = '1'; while(1) { $value = bcadd( $value , $multiplier ); if( (float)$value == INF ) { $value = $oldvalue; $multiplier = '1'; } elseif( ((float)bcadd( $value , '10' )) == INF ) { while(1) { $value = bcadd( $value , '1' ); if( (float)$value == INF ) { return $oldvalue; } $oldvalue = $value; } } $oldvalue = $value; $multiplier = bcmul( $multiplier , '10' ); } } define( 'FLOAT_MAX' , getMaxFloat() ); echo FLOAT_MAX . PHP_EOL; ?> my results: Win Vista 32 bit on Intel Quad Core Duo - PHP 5.2.8 179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497791 Thanks!

« previous php.general (#293064) next »