Is it possible to use certain mathematic tools in php.
For example, pi is there a function that emulates pi in php, or would i have to make my own and use 3.14 (or more digits such as 3.141592653589) to imitate pi?
Also for things such as Euler's number e (which goes something to this effect 2.718281828459045)
Thanks in advanced for any help you can give.
Math equations in PHP?
Moderator: General Moderators
- J_Iceman05
- Forum Commoner
- Posts: 72
- Joined: Wed Aug 03, 2005 10:52 am
- Location: Las Vegas, NV
To get the value of pi, you can call pi() or use the constant M_PI. The value of e can be found with the M_E constant.
Pi function: http://www.php.net/pi
Math functions: http://www.php.net/manual/en/ref.math.php
Pi function: http://www.php.net/pi
Math functions: http://www.php.net/manual/en/ref.math.php
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
math related constants: (php 5.0.4)
Code: Select all
'M_E' => 2.71828182846,
'M_LOG2E' => 1.44269504089,
'M_LOG10E' => 0.434294481903,
'M_LN2' => 0.69314718056,
'M_LN10' => 2.30258509299,
'M_PI' => 3.14159265359,
'M_PI_2' => 1.57079632679,
'M_PI_4' => 0.785398163397,
'M_1_PI' => 0.318309886184,
'M_2_PI' => 0.636619772368,
'M_2_SQRTPI' => 1.1283791671,
'M_SQRT2' => 1.41421356237,
'M_SQRT1_2' => 0.707106781187,
'INF' => INF,
'NAN' => 0,- J_Iceman05
- Forum Commoner
- Posts: 72
- Joined: Wed Aug 03, 2005 10:52 am
- Location: Las Vegas, NV
Thank you
Thank you all very much for your input.
It's exactly what I was looking for.
This helps a lot.
It's exactly what I was looking for.
This helps a lot.