Pol Dellaiera
664c1d18df
Fix: add missing PHPAPI
( #15142 )
...
Issue introduced in commit 5905857fd2
from PR https://github.com/php/php-src/pull/14833
2024-07-28 20:38:52 +02:00
Tim Düsterhus
5905857fd2
RFC: Add the RoundingMode enum ( #14833 )
...
see https://wiki.php.net/rfc/correctly_name_the_rounding_mode_and_make_it_an_enum
Co-authored-by: Saki Takamachi <saki@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-18 20:44:30 +02:00
Jorg Sowa
23afe57f01
Added deprecation Division by zero when using power with zero as base and negative exponent
...
RFC: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number
Closes GH-13128
2024-05-22 15:05:47 +02:00
Saki Takamachi
2e50371a7a
round: Abolished the CPU rounding mode change and modified it to a different logic. ( #13435 )
...
* Removed changing CPU round mode and added processing to detect and correct errors.
2024-03-09 08:51:37 +09:00
Saki Takamachi
447e6428d5
Revert "Fixed to avoid incorrect optimization with llvm15.0.0"
...
This reverts commit 16d0394ef4
.
2024-03-09 08:50:38 +09:00
Saki Takamachi
16d0394ef4
Fixed to avoid incorrect optimization with llvm15.0.0
2024-03-09 08:46:33 +09:00
Saki Takamachi
703ead5a26
Extend the maximum precision round can handle by one digit
...
Closes #12222
2024-02-23 01:12:25 +09:00
Ilija Tovilo
631bc81607
Implement stackless internal function calls
...
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
Closes GH-12461
2024-02-06 17:42:28 +01:00
Saki Takamachi
78970ef6b2
Fix GH-12143: Optimize round
...
Fixed an error in the result due to "pre-rounding" of the round function.
"Pre-rounding" has been abolished and the method of comparing numbers has
been changed.
Closes GH-12268.
2024-02-03 22:23:02 +09:00
Jorg Adam Sowa
94ddc74c9a
RFC: Add 4 new rounding modes to round() function ( #12056 )
...
https://wiki.php.net/rfc/new_rounding_modes_to_round_function
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2023-12-21 13:28:05 +01:00
Marc Bennewitz
b3f259d623
number_format: cast large floats within range of int to int
...
This prevents loosing precision for numbers above 2^52.
Closes GH-12333
2023-12-09 19:07:37 +00:00
Ilija Tovilo
fcae58809f
Fix GCC warning in math.c
2023-10-02 10:55:57 +02:00
Tim Düsterhus
9e66bc9b97
abs: Make value == ZEND_LONG_MIN
an unexpected branch
...
As suggested in GH-12286. This results in slightly better assembly in clang,
because the expected case will be handled by a forward jump that is not taken.
2023-09-24 17:37:09 +02:00
Tim Düsterhus
865535267b
round: Make fractional == 0.5
an unexpected branch
...
This does indeed result in slightly better assembly for clang.
2023-09-24 17:15:09 +02:00
Tim Düsterhus
82aad0b483
Unify type juggling in math.c ( #12286 )
...
- Consistently use a `switch()` with `EMPTY_SWITCH_DEFAULT_CASE();`
- Consistently use `zval_get_double()` for multi-type / non-double zvals
instead of casting manually.
2023-09-24 14:55:26 +02:00
Tim Düsterhus
3d857d5b81
round(): Validate the rounding mode ( #12252 )
2023-09-22 17:32:09 +02:00
Tim Düsterhus
9652889b43
Reimplement php_round_helper()
using modf()
( #12220 )
...
This change makes the implementation much easier to understand, by explicitly
handling the various cases.
It fixes rounding for `0.49999999999999994`, because no loss of precision
happens by adding / subtracing `0.5` before turning the result into an integral
float. Instead the fractional parts are explicitly compared.
see GH-12143 (this fixes one of the reported cases)
Closes GH-12159 which was an alternative attempt to fix the rounding issue for
`0.49999999999999994`
2023-09-19 18:05:05 +02:00
Niels Dossche
4855226f4c
Merge branch 'PHP-8.2'
...
* PHP-8.2:
Prevent int overflow on $decimals in number_format
2023-07-21 13:58:57 +02:00
Marc Bennewitz
429f20e981
Prevent int overflow on $decimals in number_format
...
Closes GH-11714.
Closes GH-11649.
2023-07-21 13:50:18 +02:00
Marc Bennewitz
591f3f619e
Prevent decimal int precision loss in number_format()
...
Closes GH-11584
2023-07-13 15:30:30 +01:00
Jorg Adam Sowa
0313640b48
Reorder list construction in the function php_intpow10 ( #11683 )
...
* Reorder array construction in the function
* Optimize function php_intlog10abs
2023-07-13 13:46:45 +01:00
Marc Bennewitz
e85fb0902c
number_format() Support rounding negative places
...
Closes GH-11487
2023-07-09 14:05:32 +01:00
Christoph M. Becker
c8955c078a
Revert GH-10220
...
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816 >.
This reverts commit ecc880f491
.
This reverts commit 588a07f737
.
This reverts commit f377e15751
.
This reverts commit b4ba16fe18
.
This reverts commit 694ec1deea
.
This reverts commit 6b34de8eba
.
This reverts commit aa1cd02a43
.
This reverts commit 308fd311ea
.
This reverts commit 16203b53e1
.
This reverts commit 738fb5ca54
.
This reverts commit 9fdbefacd3
.
This reverts commit cd4a7c1d90
.
This reverts commit 928685eba2
.
This reverts commit 01e5ffc85c
.
2023-01-16 12:27:33 +01:00
Max Kellermann
308fd311ea
ext/{standard,json,random,...}: add missing includes
2023-01-10 14:19:03 +00:00
KsaR
01b3fc03c3
Update http->https in license ( #6945 )
...
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
...
And use it instead of comments
2021-04-07 00:46:29 +01:00
Máté Kocsis
c37a1cd650
Promote a few remaining errors in ext/standard
...
Closes GH-6110
2020-09-15 14:26:16 +02:00
Dmitry Stogov
aae50328e2
decbin/decoct/dechex optimization.
2020-09-08 10:34:29 +03:00
Dmitry Stogov
4a2ae84188
Add "const". Move constant strings to read-only memory.
2020-09-07 21:35:48 +03:00
George Peter Banyard
9cb522166c
Allow number_format to be only passed 3 arguments
...
Closes GH-5977
2020-08-13 18:07:17 +02:00
Máté Kocsis
af80d8a14e
Add more argument types to stubs
...
Closes GH-5943
2020-08-07 12:35:30 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
...
Closes GH-5758
2020-07-06 21:13:34 +02:00
twosee
88355dd338
Constify char * arguments of APIs
...
Closes GH-5676.
2020-06-08 10:38:45 +02:00
Máté Kocsis
6111d64cda
Improve a last couple of argument error messages
...
Closes GH-5404
2020-04-20 13:09:00 +02:00
Máté Kocsis
bb6f374048
Improve argument error messages in ext/standard
...
Closes GH-5198
2020-03-18 19:56:10 +01:00
Máté Kocsis
7b4a4d2ace
Use RETURN_THROWS() after try_convert_to_string()
2020-01-03 17:04:06 +01:00
Máté Kocsis
01a50778d1
Use RETURN_THROWS() after zend_throw_exception() in most of the extensions
2020-01-02 10:56:18 +01:00
Máté Kocsis
31cf9a7ea9
Use RETURN_THROWS() when an exception is thrown
...
Closes GH-5036
2019-12-30 17:38:10 +01:00
Máté Kocsis
e34a1f9289
Convert zend_parse_parameters_none() to fast ZPP in standard lib
...
Closes GH-5037
2019-12-30 15:28:37 +01:00
Máté Kocsis
04deb532f0
Promote warning to exception in log() function
2019-12-05 08:30:47 +01:00
George Peter Banyard
2d0b0d6448
Remove unnecessary C99 checks for maths functions
2019-12-04 12:14:22 +01:00
Nikita Popov
6719d3e718
Add Z_PARAM_STRING/ARRAY_OR_NULL convenience macros
2019-10-29 13:29:52 +01:00
Nikita Popov
c43179fb6b
Promote base_convert "invalid base" errors to ValueError
2019-10-29 13:12:37 +01:00
Nikita Popov
8f20b9969f
Expect number argument in round()
2019-10-29 12:50:29 +01:00
Tyson Andre
9d48bf5152
Fix miscellaneous typos in docs and error messages
...
Closes GH-4863.
2019-10-28 11:44:08 +01:00
Nikita Popov
e35bdb4912
Add fdiv() function
...
The fdiv() function is part of the fmod() / intdiv() family. It
implements a floating-point division with IEEE-754 semantics.
That is, division by zero is considered well-defined and does not
trigger any kind of diagnostic. Instead one of INF, -INF or NAN
will be returned, depending on the case.
This is in preparation for throwing DivisionByZeroError from the
standard division operator.
2019-10-11 16:36:11 +02:00
Gabriel Caruso
95181553c8
Add missing zend_parse_parameters_none() checks
...
Closes GH-4796.
2019-10-08 23:10:18 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
...
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
78068171dd
Merge branch 'PHP-7.4'
2019-07-08 12:53:50 +02:00
Scott Dutton
d90cdbd9df
Deprecate passing invalid character to base_convert etc
...
RFC: https://wiki.php.net/rfc/base_convert_improvements
2019-07-08 12:49:21 +02:00