BCDIV problems

From: Date: Wed, 10 Jan 2001 10:21:04 +0000
Subject: BCDIV problems
Groups: php.dev 
Request: Send a blank email to php-dev+get-43644@lists.php.net to get a copy of this message
Hello! I have some problems with my PHP script that utilizes the BCDIV function, and I was hoping some of you could be so kind as to help me solve it. I am sorry for writing in English, but I am afraid my German is not too good so this is the best alternative. You may reply in German if you like, but I would prefer it in English. Thank you all in advance. To the problem: I use BCDIV to divide a string to a integer constant and it works great, unless the string is no more than 14 digits... I have tried to do an echo between each operation to see what happens, and then I discovered that BCDIV returned, much to my dismay, a double. Based upon further use of the value BCDIV returns I have made some calculations, but when BCDIV returned a double with "+E**" at the end the calculations fails. I have recreated the piece of my code that I am talking about, and I hope it will be more enlightening than my explenations. ///////////////// function user_func($input_string) { $new_string = ""; $temp_string = ""; while($input_string) { $div_string = 0; $div_string = (string) (bcdiv($input_string, 100) * 100); $temp_string = bcsub($input_string, $div_string); $int_input = bcdiv($input_string, 100); $new_string .= call_user_func("string_manip", $temp_string); } return $new_string; } ////////////////// This should return a 2 digit value removed from the end of $input_string, but when the problem arises it returns a "0". Everything else works perfectly though, even if the problem occurs. I hope that there are somebody out there that know what the problem is caused by, or can help me in any other way. I would like to thank you all in advance!

« previous php.dev (#43644) next »