Page 1 of 1
Problems with numbers with Scientific notation
Posted: Mon Dec 03, 2007 9:14 am
by iceangel89
i noticed that when there is Scientific noted numbers, math operators like +/-/MOd etc dont work. how do i fix this?
Posted: Mon Dec 03, 2007 9:44 am
by feyd
example?
Posted: Mon Dec 03, 2007 5:34 pm
by iceangel89
ok i done a example here, with the relavent php code displayed ... i put it here too
http://fusion-planet.updownloading.com/ ... roblem.php
Code: Select all
<?php
$answer = 0;
$ansMod = 0;
if (isset($_POST['num1']) and isset($_POST['num2'])) {
$num1 = $_POST['num1'];
$num2 = $_POST['num2'];
$answer = pow($num1, $num2);
$ansMod = $answer % 123;
}
?>
Posted: Tue Dec 04, 2007 5:17 am
by Rovas
From what I know PHP doesn' t have a function\ class that supports big numbers like Java. Do add, multiply, divide you have to use arrays and the rules of that operation.
Make a function that reads the string that user put , put it in an array (use strpos in a for) then do the mathematical operations using their rules.
P.S. It' s not easy. If you want to work with big numbers I wouldn' t do it in PHP. Use Java or a faster language.