Search code examples
phpmysqlmathdecimalradians

PHP: need more decimal places for sinus calculation


to calculate some longitude and latitude values I need more decimal places like mysql is possible to do.

For instance with mysql I get this result:

cos( RADIANS( 47.685618 ) ) = 0.67319814951254

With PHP 5.2 I only get:

cos( deg2rad( 47.685618 ) ) = 0.673198149513 

Two decimal places shorter but I need them.

I know I also can do the calulation with mysql, but in my case it need to be done with PHP.

I hope you can help me? Thx.


Solution

  • The precision directive can be changed (see BYTES.com).

    2nd result for Google: php precision float.