ID: 26713 Updated by: [EMAIL PROTECTED] Reported By: turgut85 at hotmail dot com -Status: Open +Status: Bogus Bug Type: Math related Operating System: Windows XP PHP Version: Irrelevant New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. . Previous Comments: ------------------------------------------------------------------------ [2003-12-24 17:46:41] turgut85 at hotmail dot com Description: ------------ Is anyone can help me about the code below . Here is I am collecting values according to increment value between number ranges. My first example never hits the end point although the end is in range but second hits the range or third. Why php treats numbers differently or cannot understand the last value is still below end point. Can anyone tell me. Reproduce code: --------------- <?PHP function increment ($start, $end, $increment_val) { $ret_arry = array (); $temp = $start; if ( ($start+$increment_val) <= $end ) { do{ echo " " . $temp . "," ; $temp = $temp + $increment_val; }while ( $temp <= $end ); } else { echo "Can not do This"; } } $start = "1.0"; $end = "1.6"; $increment_val = "0.1"; increment($start, $end, $increment_val); $start = "1.0"; $end = "4.9"; $increment_val = "0.1"; echo "\n"; increment($start, $end, $increment_val); ?> Expected result: ---------------- 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, Actual result: -------------- 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26713&edit=1
