This is a discussion on Mathematical functions in PHP within the PHP Programming forums, part of the Web Development category; Hi Buddies, Shall we discuss about mathematical functions. i want to know more about that for implementing in My site ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hi, actually These math functions will only handle values within the range of the integer and float types on your computer. The math functions are part of the PHP core. There is no installation needed to use these functions.
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| abs It returns absolute value Description number abs ( mixed $number ) Examples <?php $abs = abs(-4.2); // $abs = 4.2; (double/float) $abs2 = abs(5); // $abs2 = 5; (integer) $abs3 = abs(-5); // $abs3 = 5; (integer) ?>
__________________ Thanks Regards Sureshbabu Harikrishnan ![]() +91 9884320017 |
| |||
| ceil() returns the next highest integer value by rounding up value if necessary. The return value of ceil() is still of type float as the value range of float is usually bigger than that of integer. Example: PHP Code:
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| floor() returns the next lowest integer value by rounding down value if necessary. The return value of floor() is still of type float because the value range of float is usually bigger than that of integer. example: PHP Code:
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| round() returns the rounded value of val to specified precision (number of digits after the decimal point). precision can also be negative or zero (default). Example: PHP Code:
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| Hi, max() returns the numerically highest of the parameter values.If the first and only parameter is an array, max() returns the highest value in that array. If the first parameter is an integer, string or float, you need at least two parameters and max() returns the biggest of these values. You can compare an unlimited number of values.
__________________ Regards, Senraj.A Last edited by senraj : 04-16-2008 at 02:49 AM. |
| |||
| cos() The acos() function returns the arccosine of a number as a numeric value value between 0 and PI radians. Syntax acos(x) Example In this example we will get the arccosine of different numbers: <?php echo(acos(0.64) . "<br />"); echo(acos(0) . "<br />"); echo(acos(-1) . "<br />"); echo(acos(1) . "<br />"); echo(acos(2)) ?>
__________________ Thanks Regards Sureshbabu Harikrishnan ![]() +91 9884320017 |
| |||
| rad2deg() The rad2deg() function converts a radian number to its degree. Syntax rad2deg(radian_number) Example <?php $rad = M_PI; $deg = rad2deg($rad); echo "$rad radians is equal to $deg degrees"; ?>
__________________ Thanks Regards Sureshbabu Harikrishnan ![]() +91 9884320017 |
| |||
| exp() calculates the exponent of e (the Neperian or Natural logarithm base) example: PHP Code: Code: 1.6275E+005 298.87
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| pow() returns base raised to the power of exp. If possible, this function will return an integer. If the power cannot be computed, a warning will be issued, and pow() will return FALSE. Since PHP 4.2.0 pow() doesn't issue any warning. And PHP cannot handle negative bases Example: PHP Code:
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| sqrt() returns the square root of arg. example: PHP Code:
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| Hi is_finite() The is_finite() function returns true if the specified value is a finite number, otherwise it returns nothing. PHP Code: Falcon ![]() |
| |||
| Hi acos() The acos() function returns the arccosine of a number as a numeric value value between 0 and PI radians PHP Code: Falcon ![]() |
| |||
| Hi cos() The cos() returns the cosine of a number. PHP Code: Code: -0.9899924966004454 -0.9899924966004454 1 -1 1 Falcon ![]() Last edited by Falcon : 04-17-2008 at 02:58 AM. |
| |||
| hi cosh() The cosh() function returns the hyperbolic cosine of a number (equivalent to (exp(x) + exp(-x)) / 2). PHP Code: Code: 10.0676619958 10.0676619958 1 11.5919532755 267.746761484 Falcon ![]() |
| |||
| <?php echo is_nan(200) . "<br />"; echo is_nan(acos(1.01)); ?> The is_nan() function returns true if the specified value is "not a number", otherwise it returns nothing. answer for above code 1.nothing 2.true ,its means it not a number |
| |||
| <?php echo decbin("3") . "<br />"; echo decbin("1") . "<br />"; echo decbin("1587") . "<br />"; echo decbin("7"); ?> this function to convert the decimal number into binary number Answer for above code 11 1 11000110011 111 |