History log of /PHP-8.4/ext/bcmath/bcmath.c (Results 1 – 25 of 183)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# c5b258fe 24-Sep-2024 Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>

Fix GH-15968: Avoid converting objects to strings in operator calculations. (#16021)


# 585cf9c1 23-Sep-2024 Gina Peter Banyard

ext/bcmath: `null` should not be supported for operator overloading & fix some comparison issues (#15875)


# f6db576c 22-Sep-2024 Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>

[RFC] ext/bcmath: Added `bcdivmod` (#15740)

RFC: https://wiki.php.net/rfc/add_bcdivmod_to_bcmath

Added bcdivmod() function and added divmod() method to BcMath\Number class.


# 05cb27a8 21-Sep-2024 Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>

ext/bcmath: Check for scale overflow (#15741)


# ac0931d3 06-Sep-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Reuse bcmath_check_scale()


# 2e88916b 06-Sep-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Move bcmath_check_scale()


# f1b4e127 06-Sep-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Simplify bcmath_check_scale()

The scale is default-initialized to 0, so we can simplify the code a
bit.


# fad899e5 04-Sep-2024 Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>

[RFC] Support object types in BCMath (#13741)

Added BcMath\Number class. It is an immutable object, has methods that are
equivalent to existing BCMath calculation functions, and can also

[RFC] Support object types in BCMath (#13741)

Added BcMath\Number class. It is an immutable object, has methods that are
equivalent to existing BCMath calculation functions, and can also be calculated
using operators.

The existing BCMath function returned a string for each calculation, but this
class returns an object.

RFC: https://wiki.php.net/rfc/support_object_type_in_bcmath,
https://wiki.php.net/rfc/fix_up_bcmath_number_class

---------

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>

show more ...


# 5905857f 18-Jul-2024 Tim Düsterhus

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-author

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>

show more ...


# be4b10e9 11-Jul-2024 Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>

Added scale to bc_compare argument (#14802)

In the original specification, the scale of bc_num was directly changed
and compared.

This becomes a problem when objects are support

Added scale to bc_compare argument (#14802)

In the original specification, the scale of bc_num was directly changed
and compared.

This becomes a problem when objects are supported, so we will modify it
to compare without changing bc_num.

show more ...


# 11accb5c 25-Jun-2024 Arnaud Le Blanc

Preferably include from build dir (#13516)

* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Preferably include from build dir (#13516)

* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

-I$(top_builddir)/main
-I$(top_srcdir)
-I$(top_builddir)/TSRM
-I$(top_builddir)/Zend
-I$(top_srcdir)/main
-I$(top_srcdir)/Zend
-I$(top_srcdir)/TSRM
-I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

-I$(top_builddir)/main
-I$(top_builddir)
-I$(top_srcdir)/main
-I$(top_srcdir)
-I$(top_builddir)/TSRM
-I$(top_builddir)/Zend
-I$(top_srcdir)/Zend
-I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.

show more ...


# 70b5a4d5 08-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

BCMath: Avoid using the heap for temporary objects by using arena allocations (#14170)

* BCMath: Avoid using the heap for temporary objects by using arena allocations

* Fix alignmen

BCMath: Avoid using the heap for temporary objects by using arena allocations (#14170)

* BCMath: Avoid using the heap for temporary objects by using arena allocations

* Fix alignment

* Improve size computation

show more ...


# cad0e555 03-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Faster validation logic in bc_str2num() (#14115)

Using SIMD to accelerate the validation.

Using the benchmark from #14076.

After:
```
1.3504369258881
1.62063217

Faster validation logic in bc_str2num() (#14115)

Using SIMD to accelerate the validation.

Using the benchmark from #14076.

After:
```
1.3504369258881
1.6206321716309
1.6845638751984
```

Before:
```
1.4750170707703
1.9039781093597
1.9632289409637
```

show more ...


# 039344cf 01-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Avoid extra inits while flooring or ceiling


# 34b2116e 01-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Avoid unnecessary destruction in bc_mul()


# 0cd952d8 01-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Avoid unnecessary destruction in bc_sub()


# 959e1154 01-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Avoid unnecessary destruction in bc_add()


# be072d7b 01-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use RETVAL_NEW_STR

The strings are always new, not interned.


# a66439ad 01-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Avoid unnecessary number initializations in BCMath (#14104)

Since freeing can deal with NULL, we can avoid calling bc_init_num and
avoid resetting the number during parsing.

Usi

Avoid unnecessary number initializations in BCMath (#14104)

Since freeing can deal with NULL, we can avoid calling bc_init_num and
avoid resetting the number during parsing.

Using benchmark from #14076.

Before:
```
1.544440984726
2.0288550853729
2.092139005661
```

After:
```
1.5324399471283
1.9081380367279
2.065819978714
```

show more ...


# a481556d 29-Apr-2024 Saki Takamachi

Refactor BCMath (#14076)

Optimized the order of structure members and the process of converting
strings to bc_num structures.

closes #14076


# 53593927 30-Apr-2024 Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>

[RFC] Add bcfloor, bcceil and bcround to BCMath (#13096)

Implementation for the "Adding bcround, bcfloor and bcceil to BCMath" RFC: https://wiki.php.net/rfc/adding_bcround_bcfloor_bcceil_to_

[RFC] Add bcfloor, bcceil and bcround to BCMath (#13096)

Implementation for the "Adding bcround, bcfloor and bcceil to BCMath" RFC: https://wiki.php.net/rfc/adding_bcround_bcfloor_bcceil_to_bcmath

* Separated round mode into separate header file

Co-authored-by: Gina Peter Banyard <girgias@php.net>

show more ...


# 68247c02 24-Jul-2023 George Peter Banyard

Refactor BCMath bundledlib and extension (#10774)

* ext/bcmath: coding style: use indentation

And add braces to block statements, as the current code was pretty much unreadable with

Refactor BCMath bundledlib and extension (#10774)

* ext/bcmath: coding style: use indentation

And add braces to block statements, as the current code was pretty much unreadable with how inconsistent it was.

* ext/bcmath: Remove some useless header inclusions

* ext/bcmath: Use standard C99 bool type instead of char

* ext/bcmath: Include specific headers instead of config.h

* Restructure definitions to reduce header inclusions

* Use size_t as a more appropriate type

* Remove unused variable full_scale

* Refactor bc_raisemod() to get rid of Zend dependencies

This separates the concerns of throwing exceptions back into the PHP_FUNCTION instead of being the responsibility of the library

* Refactor bc_raise() to get rid of Zend dependencies

This separates the concerns of throwing exceptions back into the PHP_FUNCTION instead of being the responsibility of the library

* Refactor bc_divmod() and bc_modulo() to return bool

Return false on division by 0 attempt instead of -1 and true on success instead of 0

* Refactor bc_divide() to return bool

Return false on division by 0 attempt instead of -1 and true on success instead of 0

show more ...


# 9d5f2f13 20-Mar-2023 Ilija Tovilo

Use new ZSTR_INIT_LITERAL macro (#10879)


Revision tags: php-8.2.0RC1, php-8.1.10, php-8.0.23, php-8.0.23RC1, php-8.1.10RC1, php-8.2.0beta3, php-8.2.0beta2, php-8.1.9, php-8.0.22, php-8.1.9RC1, php-8.2.0beta1, php-8.0.22RC1, php-8.0.21, php-8.1.8, php-8.2.0alpha3, php-8.1.8RC1, php-8.2.0alpha2, php-8.0.21RC1
# efc8f0eb 17-Jun-2022 Arnaud Le Blanc

Deprecate zend_atol() / add zend_ini_parse_quantity() (#7951)

Add zend_ini_parse_quantity() and deprecate zend_atol(), zend_atoi()

zend_atol() and zend_atoi() don't just do number p

Deprecate zend_atol() / add zend_ini_parse_quantity() (#7951)

Add zend_ini_parse_quantity() and deprecate zend_atol(), zend_atoi()

zend_atol() and zend_atoi() don't just do number parsing.
They also check for a 'K', 'M', or 'G' at the end of the string,
and multiply the parsed value out accordingly.

Unfortunately, they ignore any other non-numerics between the
numeric component and the last character in the string.
This means that numbers such as the following are both valid
and non-intuitive in their final output.

* "123KMG" is interpreted as "123G" -> 132070244352
* "123G " is interpreted as "123 " -> 123
* "123GB" is interpreted as "123B" -> 123
* "123 I like tacos." is also interpreted as "123." -> 123

Currently, in php-src these functions are used only for parsing ini values.

In this change we deprecate zend_atol(), zend_atoi(), and introduce a new
function with the same behavior, but with the ability to report invalid inputs
to the caller. The function's name also makes the behavior less unexpected:
zend_ini_parse_quantity().

Co-authored-by: Sara Golemon <pollita@php.net>

show more ...


Revision tags: php-8.0.20, php-8.1.7, php-8.2.0alpha1, php-7.4.30, php-8.1.7RC1, php-8.0.20RC1, php-8.1.6, php-8.0.19, php-8.1.6RC1, php-8.0.19RC1, php-8.0.18, php-8.1.5, php-7.4.29, php-8.1.5RC1, php-8.0.18RC1, php-8.1.4, php-8.0.17, php-8.1.4RC1, php-8.0.17RC1, php-8.1.3, php-8.0.16, php-7.4.28, php-8.1.3RC1, php-8.0.16RC1, php-8.1.2, php-8.0.15, php-8.1.2RC1, php-8.0.15RC1, php-8.0.14, php-8.1.1, php-7.4.27, php-8.1.1RC1, php-8.0.14RC1, php-7.4.27RC1, php-8.1.0, php-8.0.13, php-7.4.26, php-7.3.33, php-8.1.0RC6, php-7.4.26RC1, php-8.0.13RC1, php-8.1.0RC5, php-7.3.32, php-7.4.25, php-8.0.12, php-8.1.0RC4, php-8.0.12RC1, php-7.4.25RC1, php-8.1.0RC3, php-8.0.11, php-7.4.24, php-7.3.31, php-8.1.0RC2, php-7.4.24RC1, php-8.0.11RC1, php-8.1.0RC1, php-7.4.23, php-8.0.10, php-7.3.30, php-8.1.0beta3, php-8.0.10RC1, php-7.4.23RC1, php-8.1.0beta2, php-8.0.9, php-7.4.22, php-8.1.0beta1, php-7.4.22RC1, php-8.0.9RC1, php-8.1.0alpha3, php-7.4.21, php-7.3.29, php-8.0.8, php-8.1.0alpha2, php-7.4.21RC1, php-8.0.8RC1, php-8.1.0alpha1, php-8.0.7, php-7.4.20, php-8.0.7RC1, php-7.4.20RC1
# 01b3fc03 06-May-2021 KsaR

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

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 |

show more ...


12345678