[PHP-DEV] Patch for ext/standard/[basic_functions.c|php_math.h|math.c] From: Jesus M. Castagnetto (jmcastagnetto <email protected>)
Date: 07/31/01

I am sending this patch to the php-dev list for your
consideration. Attached are the listing produced with
"cvs diff -u", and listed below is a test file to
check the changes.

Basically I just added some more math funcs from the C
library (hyperbolics and exponentials).

The files changed are:

ext/standard/basic_functions.c
ext/standard/php_math.h
ext/standard/math.c

And the added test file is:
[ext/standard/tests/math/002.phpt]
--TEST--
Test of trigonometric and exponential functions
--POST--
--GET--
--FILE--
<?php
  function pfloat($func, $params) {
          $fmt = "%.6f\n";
          $fcall = (is_array($params)) ?
"call_user_func_array" : "call_user_func";
          printf($fmt, $fcall($func, $params));
  }
  pfloat("sin", -1);
  pfloat("cos", -1.5);
  pfloat("tan", -1);
  pfloat("asin", 0.4);
  pfloat("acos", -0.5);
  pfloat("atan", 1.0);
  pfloat("atan2", array(1.5,3.0));
  pfloat("sinh", -1);
  pfloat("cosh", -1.5);
  pfloat("tanh", -1);
  pfloat("asinh", -1.5);
  pfloat("acosh", 1.1);
  pfloat("atanh", 0.1);
  pfloat("exp", 1.5);
  pfloat("exp2", 1.5);
  pfloat("exp10", 1.5);
  pfloat("expm1", 1.5);
  pfloat("log", 1.1);
  pfloat("log2", 2.3);
  pfloat("log10", 1.2);
  pfloat("log1p", 10.0);
?>
--EXPECT--
-0.841471
0.070737
-1.557408
0.411517
2.094395
0.785398
0.463648
-1.175201
2.352410
-0.761594
-1.194763
0.443568
0.100335
4.481689
2.828427
31.622777
3.481689
0.095310
1.201634
0.079181
2.397895

=====
--- Jesus M. Castagnetto <jmcastagnetto <email protected>>

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>