Commit Graph

187 Commits

Author SHA1 Message Date
Ilia Alshanetsky
6f694fab9a Simplify code 2007-05-23 15:01:00 +00:00
Sebastian Bergmann
4223aa4d5e MFH: Bump year. 2007-01-01 09:36:18 +00:00
Ilia Alshanetsky
52d53543ac Allocation safety checks 2006-12-25 22:36:57 +00:00
Ilia Alshanetsky
fd8f758ecd Fixed bug #39873 (number_format() breaks with locale & decimal points). 2006-12-22 04:03:15 +00:00
Hannes Magnusson
2d3056e94f MFH:
- Fixed bug #33895 (missing math constants).
 - Remove M_PI from math.c (its defined in php_math.h)
2006-08-27 19:14:43 +00:00
Marcus Boerger
dc571fa9e2 - MFH Fixed Bug #29538 number_format and problem with 0 2006-07-16 10:50:58 +00:00
Antony Dovgal
bccf4bd9e7 MFH: initialize variables and reduce the number of warnings 2006-02-06 11:28:41 +00:00
foobar
5bd93221a8 bump year and license version 2006-01-01 12:51:34 +00:00
foobar
23e671a51e - Bumber up year 2005-08-03 14:08:58 +00:00
foobar
a5c41b2c8e - Fixed bug #33917 (number_format() output with > 1 char separators) 2005-07-29 12:58:25 +00:00
Andrey Hristov
0e459321bf move math_standard_deviation and math_variance to the stats PECL extension 2005-05-13 10:11:19 +00:00
Andrey Hristov
f12b14078e rename math_std_dev to math_standard_deviation (the API wasn't published
yet)
2005-05-10 12:50:53 +00:00
foobar
b3f5a2dca4 ws + cs + proto fixes 2005-05-07 16:08:03 +00:00
Andrey Hristov
8cd3409b30 update protos 2005-05-07 12:41:56 +00:00
foobar
31a8c58911 fix proto 2005-05-05 23:42:03 +00:00
Andrey Hristov
7a0b3edbe0 fixed div by zero
#div by zero is bad...div by zero is bad...bad
2005-05-02 12:32:21 +00:00
Andrey Hristov
2c0959689b add possibility to calculate the standard deviation and the variance
on a sample - the formulae are slightly different.
2005-05-02 12:29:38 +00:00
Andrey Hristov
7a4eb25870 add also math_variance() which uses the same calculation as math_std_dev() 2005-05-02 12:12:04 +00:00
Andrey Hristov
6141c5690d fix division by zero. throw an warning if the array is empty. 2005-05-02 11:01:14 +00:00
Andrey Hristov
fb0c19da1c add math_std_dev() 2005-05-02 09:17:49 +00:00
Ilia Alshanetsky
6d7cac7731 Fixed bug #28228 (NULL decimal separator is not being handled correctly). 2004-12-14 00:37:19 +00:00
Wez Furlong
31a17d9044 Enable hypot for all 2004-09-20 22:08:06 +00:00
Andi Gutmans
56f8195fe5 - Nuke empty_string. It is a reminanent from the time where RETURN_FALSE()
used to return "" and not bool(false). It's not worth keeping it because
  STR_FREE() and zval_dtor() always have to check for it and it slows down
  the general case. In addition, it seems that empty_string has been abused
  quite a lot, and was used not only for setting zval's but generally in
  PHP code instead of "", which wasn't the intention. Last but not least,
  nuking empty_string should improve stability as I doubt every place
  correctly checked if they are not mistakenly erealloc()'ing it or
  calling efree() on it.
  NOTE: Some code is probably broken. Each extension maintainer should
  check and see that my changes are OK. Also, I haven't had time to touch
  PECL yet. Will try and do it tomorrow.
2004-07-19 07:19:50 +00:00
Ilia Alshanetsky
b9fc9a6ad1 hypot() is not experimental. 2004-06-10 19:38:24 +00:00
Ilia Alshanetsky
396bf39311 Fixed bug #28508 (Do not make hypot() available if not supported by libc). 2004-05-24 17:02:12 +00:00
Ilia Alshanetsky
91e9545f4f Fixed bug #28228 (number_format() does not allow empty decimal separator). 2004-04-30 13:26:01 +00:00
Ard Biesheuvel
cc924cad9d Nuke unused vars 2004-03-10 15:59:50 +00:00
Ard Biesheuvel
e6281ab38b Don't use fp arithmetic for int results
# FP arithmetic is not accurate enough on 64-bit archs
# This patch relies on ZEND_SIGNED_MULTIPLY_LONG(),
# so that should be fixed as well.
2004-03-10 15:57:49 +00:00
Andi Gutmans
dbeb4158d2 - A belated happy holidays and PHP 5 2004-01-08 08:18:22 +00:00
Ilia Alshanetsky
2a58fb80e7 Fixed Bug #25694 (round() and number_format() give inconsistent results). 2003-11-18 02:50:41 +00:00
Sascha Schumann
436a07176c fix format strings 2003-08-28 16:49:57 +00:00
Marcus Boerger
66b910e87c Bugfix #24142, part 2 2003-08-09 01:12:41 +00:00
Ilia Alshanetsky
370ea1c82f Avoid a round() bug that occurs due to over optimization of C code by gcc.
This bug was confirmed across multiple systems with gcc 2.95.3 & 3.X+
2003-08-08 23:40:44 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Stig Bakken
0e6fca4f22 * email address change 2003-03-18 12:06:09 +00:00
Edin Kadribasic
d4e143b8be Fixed bug #21648 2003-01-16 13:19:50 +00:00
Wez Furlong
cf9f784ecd Fix the number format fix when the number of decimal places is 0.
# Thanks to Edin for his telepathy!
2003-01-10 13:32:24 +00:00
Wez Furlong
d8fbd1acef Fix Bug #21523 - number_format could cause a memory allocation for a
negative memory size in situations where the sprintf implementation of the
host system generated less decimal places than were requested.

Resolved this issue by making number_format examine the string returned
by spprintf and have it pad to the correct number of decimal places.

Added a test-case based on the bug report; the length of decimal places
required to trigger this bug is sprintf implementation dependent; as the
implementation is now using spprintf (provided by PHP), that number is
78 digits (NDIG - 2).

# I played with the idea of enhancing sprintf to do the equivalent, but
# it was too much effort considering that the precision of floats/doubles
# is not good enough to warrant it.

# This fix could do with some QA from someone else to make sure there are
# no memory bounds problems and then MFH it to PHP_4_3
2003-01-09 15:44:49 +00:00
Sebastian Bergmann
b506f5c8f8 Bump year. 2002-12-31 16:08:15 +00:00
Marcus Boerger
49a99a98f4 -php_error -> php_error_docref
-removed some cases where emalloc result was tested
2002-12-05 20:59:49 +00:00
Marcus Boerger
3ba7df4c6a fix warnings
#highest bit cannot be set so this must work
2002-11-12 11:46:21 +00:00
Jason Greene
f8aae8702c Switch to using error_docref
# Satisfy all those named Mar[ck]us
2002-11-11 16:34:39 +00:00
Jason Greene
5e2c75c576 Report function name when log() triggers a base warning 2002-11-11 05:35:04 +00:00
Jason Greene
84bd2901c4 Add the ability to take the logarithm of any base by adding a base parameter
to log()
Added regression tests for the new form
2002-11-11 05:21:35 +00:00
Marcus Boerger
15b2e277a4 fix compiler warning 2002-10-24 19:15:40 +00:00
foobar
0bac55b4e7 - If functions are not available on OS, they're not available in PHP. 2002-10-24 18:31:11 +00:00
Sascha Schumann
6bf422d62e Make PHP compile out-of-the-box with uClibc 2002-10-24 12:21:07 +00:00
Sterling Hughes
57440cc984 hopefully silence compile warnings on Solaris related to HUGEVAL being
undefined.. HUGEVAL is defined (well the manual would indicate so) in
stdlib.h, not math.h.

Bug #: 19807
2002-10-15 14:51:01 +00:00
Sascha Schumann
df0ea33d2b peek at freebsd's libc and fix _php_math_basetozval
PR: #19733
2002-10-04 02:21:33 +00:00
Derick Rethans
828c2a9c46 - argh... this is getting annoying 2002-09-06 07:47:49 +00:00
Anantha Kesari H Y
338332c799 NetWare related changes/modifications 2002-09-06 07:44:30 +00:00
Marcus Boerger
149ad05b4f php_error_docref
#New conversion available at: http://docref.txt.marcus-boerger.de
2002-08-24 01:19:28 +00:00
Edin Kadribasic
67689bd557 ZTS fix. 2002-06-18 00:14:52 +00:00
Edin Kadribasic
fb6bcda13b Check for +/- infinity in base_convert (bug #14807). 2002-06-18 00:04:33 +00:00
Derick Rethans
f4447a9cc1 - Fix for bug #14966 2002-04-01 09:19:57 +00:00
Sebastian Bergmann
6729e0e9bf Fix thread-safe build. 2002-03-11 05:43:23 +00:00
jim winstead
8544cc1532 handle numeric strings. this means we're less picky about the argument
types, but the math functions aren't generally that picky.
2002-03-10 23:46:43 +00:00
Hartmut Holzgraefe
547b25fd13 php has no 'double', only 'float' 2002-03-02 17:08:09 +00:00
Sebastian Bergmann
90613d2282 Maintain headers. 2002-02-28 08:29:35 +00:00
Yasuo Ohgaki
15daf99288 Added fmod() function
# Is there any reason that math.c does not use errno?
2002-02-21 11:44:41 +00:00
Jon Parise
9aba9071b6 These are now defined in zend_config.w32.h. 2002-01-28 16:06:27 +00:00
Jon Parise
e40e7a669a zend_isinf() is already defined in Zend/zend_config.w32.h for Win32. 2002-01-27 18:19:18 +00:00
Jon Parise
f174bbc711 Use the zend_* versions of finite(), isinf(), and isnan(), as defined
in php_config.h.  Redefine the zend_* versions in the case of Win32.

This fixes the build on systems that don't provide a native version of,
say, isinf() (e.g. Solaris).
2002-01-27 07:41:20 +00:00
jim winstead
831473d76e Rename finite/isinf/isnan to more standard is_*() names. 2002-01-09 23:59:05 +00:00
jim winstead
62395159a9 Fix the Win32 compile. 2002-01-05 08:29:53 +00:00
Egon Schmid
87ad1fdb3b Fixed some protos. 2002-01-05 07:54:49 +00:00
jim winstead
b9d68b8e9d Apparently multi_convert_to_double_ex() didn't quite do what I
thought. Still need to handle numeric strings.
2002-01-05 03:56:38 +00:00
jim winstead
461e105069 Fixed pow(), and added finite(), isinf(), and isnan(). Also fixed
pow() tests.
@- Fixed pow(), and added finite(), isinf(), and isnan(). (Jim)
# Jeroen was on crack, and apparently flunked arithmetic. Names of new
# functions subject to change if people get persnickety about them.
# (They're currently the same as the underlying C library function
# names. Hope nobody forgets to update the tests if they change the
# names.)
# Oh, and pow() uses the new parameter-passing API now.
2002-01-05 03:45:11 +00:00
Derick Rethans
e8f3e3ffa0 - Let ceil also return a float in every case 2001-12-22 11:53:29 +00:00
Derick Rethans
ca1bcd9ac3 - Fix for bug #14646, floor() always returns a float now. 2001-12-21 16:38:49 +00:00
Derick Rethans
3709eb6ab2 - Fix for bug #14544, bogus warning in pow()
#- I think I do not need to tell who screwed this up....
2001-12-16 10:59:20 +00:00
Sebastian Bergmann
38933514e1 Update headers. 2001-12-11 15:32:16 +00:00
Frank M. Kromann
8e40864770 Make _php_math_number_format available from shared extensions 2001-12-03 05:12:48 +00:00
Jeroen van Wolffelaar
0916fd50c0 5th and probably/hopefully last run of conv_z_macros 2001-09-26 09:21:58 +00:00
Hartmut Holzgraefe
03f7406711 proto fixes "double" -> "float" 2001-09-21 21:59:27 +00:00
Sascha Schumann
f45555e62f Rework some string-to-number and vice-versa functions to work smarter
(e.g. without using functions that use slow locales, without allocating
 extra memory and with fewer integer/float operations)
2001-09-20 08:22:44 +00:00
Sascha Schumann
e261d310a0 quickly fix newly introdued off-by-one 2001-09-19 11:03:58 +00:00
Sascha Schumann
e4ace6cde6 Rewrite _php_match_basetozval to need only one multiplication
per iteration and avoid the U?LONG_MAX hassle.
2001-09-19 10:57:50 +00:00
Sterling Hughes
563c0670e5 another attempt at fixing compile warnings... 2001-09-18 20:05:05 +00:00
Sterling Hughes
8092460830 hopefully fix win32 compile warnings
# I really wish i had a box to compile php with win32 on
2001-09-18 05:48:49 +00:00
Derick Rethans
78747bd2df - Don't wrap lines... this is annoying while coding. 2001-09-09 13:29:31 +00:00
Stanislav Malyshev
0a143cf655 Add _php_math_zvaltobase and _php_math_basetozval
This allows to use bindec, etc. functions to convert numbers longer
than fits in long, using floats instead.
Note: the functions like decbin still don't use the zval-ed functions,
so they work only on longs yet.
2001-09-03 16:26:31 +00:00
Jeroen van Wolffelaar
2b6bafb269 Remove cbrt also, and mark logm1 and exp1p as expermintal 2001-08-15 19:08:59 +00:00
Jeroen van Wolffelaar
d62fbbd5a8 MF407 2001-08-15 19:01:32 +00:00
Zeev Suraski
c0404f4631 Whitespace 2001-08-11 17:03:37 +00:00
Jeroen van Wolffelaar
ec140f4f67 Bugfix in abs(), abs(LONG_MIN) was bogus 2001-08-05 20:27:03 +00:00
Stanislav Malyshev
c7d7834a43 Check that _php_math_basetolong result fits long (by request from Troels Arvin) 2001-08-05 14:40:14 +00:00
Zeev Suraski
1159c84ab7 - TSRMLS_FETCH work
- whitespace fixes
2001-08-05 01:43:02 +00:00
Jeroen van Wolffelaar
68df8ea465 Another bugfix in pow. Special cases, with 10 times the same thing are
_so_ error_prone... :(
2001-08-04 20:58:47 +00:00
Rasmus Lerdorf
7d5999fb4d Kill a warning 2001-08-04 20:52:35 +00:00
Jeroen van Wolffelaar
b245789bdb Bugfix. All tests pass now on my system 2001-08-04 18:29:37 +00:00
Jeroen van Wolffelaar
8803bbaa80 - A little bit cleaning of pow(), and 12 bytes less memory (wow) 2001-08-04 13:11:17 +00:00
Jeroen van Wolffelaar
dc4adaa231 #- HTML-safe error for pow() 2001-08-03 23:27:23 +00:00
Jeroen van Wolffelaar
7733d95770 - New pow() function. It now gives warnings on wrong input, and
returns integer result when possible
@- New pow() implementation, which returns an integer when possible,
@  and warnings on wrong input (jeroen)
2001-08-03 22:19:11 +00:00
Frank M. Kromann
2794a0e69a These new math functions are not supported on Win32 2001-08-01 16:55:24 +00:00
Andrei Zmievski
fa6b5cdde7 - Added a few new math functions from Jesus Castagnetto.
- Converted to Z_* macros.
@- Added a few new math functions. (Jesus)
2001-08-01 13:48:14 +00:00
Rasmus Lerdorf
81e2cf03ac Fix folding and clean up some extensions 2001-06-06 13:06:12 +00:00
Rasmus Lerdorf
25c3a3a39d vim-6 does folding - clean up a bunch of missing folding tags plus
some misguided RINIT and RSHUTDOWN calls in a few fringe extensions
2001-06-05 13:12:10 +00:00
Andi Gutmans
eb6ba01d1c - Fix copyright notices with 2001 2001-02-26 06:11:02 +00:00
Thies C. Arntzen
825457ae64 update my email. 2000-10-29 09:14:55 +00:00