rfc:add_bcdivmod_to_bcmath
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:add_bcdivmod_to_bcmath [2024/06/30 13:59] – created saki | rfc:add_bcdivmod_to_bcmath [2024/10/24 13:12] (current) – saki | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2024-06-30 | * Date: 2024-06-30 | ||
* Author: Saki Takamachi (saki@php.net) | * Author: Saki Takamachi (saki@php.net) | ||
- | * Status: | + | * Status: |
* First Published at: https:// | * First Published at: https:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | BCMath has < | + | BCMath has < |
===== Proposal ===== | ===== Proposal ===== | ||
- | This RFC proposes the addition of a new function < | + | This RFC proposes the addition of a new function < |
This is clearly faster than doing the two operations separately. | This is clearly faster than doing the two operations separately. | ||
Line 31: | Line 31: | ||
<PHP> | <PHP> | ||
- | $results | + | [$quot, $rem] = bcdivmod(' |
- | // $result[0] | + | |
- | // $result[1] is '1' | + | // $quot is ' |
+ | // $rem is '1' | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $slicesOfPizza = new BcMath\Number(8); | ||
+ | $mouthsToFeed = new BcMath\Number(3); | ||
+ | [$perMouth, $slicesLeft] = $slicesOfPizza-> | ||
+ | |||
+ | // $perMouth-> | ||
+ | // $slicesLeft-> | ||
</ | </ | ||
Line 39: | Line 49: | ||
Regarding return values, it was proposed in the mailing list discussion to return them as objects that have these as properties instead of an array. However, since BCMath has significantly better performance in PHP8.4, the overhead of creating the object is probably more significant, | Regarding return values, it was proposed in the mailing list discussion to return them as objects that have these as properties instead of an array. However, since BCMath has significantly better performance in PHP8.4, the overhead of creating the object is probably more significant, | ||
+ | |||
+ | There was an idea to return the value by reference, but it was not adopted because current PHP tends to avoid such implementation. | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 73: | Line 85: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
As per the voting RFC a yes/no vote with a 2/3 majority is needed for this proposal to be accepted. | As per the voting RFC a yes/no vote with a 2/3 majority is needed for this proposal to be accepted. | ||
+ | |||
+ | Voting started on 2024-07-17 and will end on 2024-08-01 00:00 GMT. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/add_bcdivmod_to_bcmath.1719755988.txt.gz · Last modified: 2024/06/30 13:59 by saki