rfc:fix_up_bcmath_number_class
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:fix_up_bcmath_number_class [2024/07/10 06:26] – saki | rfc:fix_up_bcmath_number_class [2024/09/04 02:15] (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:// | ||
Line 14: | Line 14: | ||
This RFC makes several corrections and changes to the < | This RFC makes several corrections and changes to the < | ||
- | Also proposes that when cast a GMP object to bool, change it so that < | + | It also proposes that when a GMP object |
Details of the proposal regarding BCMath are as follows: | Details of the proposal regarding BCMath are as follows: | ||
- Casting a Number object to bool makes it < | - Casting a Number object to bool makes it < | ||
- | - Of the six comparison methods < | + | - Of the six comparison methods < |
- | - Remove format method. | + | - Remove |
- Remove rounding in calculations. | - Remove rounding in calculations. | ||
- Make it serializable. | - Make it serializable. | ||
Line 31: | Line 31: | ||
=== More information about comparison methods === | === More information about comparison methods === | ||
- | In fact, only need the < | + | In fact, only the < |
- | Adding methods later is easy, but removing them always involves a BC Break. | + | Adding methods later is easy, but removing them always involves a BC Break. |
- | By the way, the reason < | + | By the way, the reason < |
- | Then rename the <php>comp()</ | + | Currently, there is no other expression for comparison in PHP called "comp". The expression " |
e.g. | e.g. | ||
+ | https:// | ||
+ | https:// | ||
+ | |||
+ | Therefore, follow these conventions and rename < | ||
+ | |||
<PHP> | <PHP> | ||
public function compare(Number|string|int $num, ?int $scale = null): int {} | public function compare(Number|string|int $num, ?int $scale = null): int {} | ||
Line 65: | Line 70: | ||
</ | </ | ||
- | Based on the idea that shouldn' | + | Based on the idea that we shouldn' |
In other words, the rounding mode during calculations will be fixed at truncation, and the user will not be able to change it. This applies to both operator and method calculations. | In other words, the rounding mode during calculations will be fixed at truncation, and the user will not be able to change it. This applies to both operator and method calculations. | ||
- | If the user wants to do rounding, | + | If the user wants to do rounding, the < |
=== Make it serializable === | === Make it serializable === | ||
Line 92: | Line 97: | ||
BCMath: None. | BCMath: None. | ||
- | GMP: Code like < | + | GMP: Code like < |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 132: | Line 137: | ||
These are not second-round votes, so each requires a two-thirds majority vote to pass. | These are not second-round votes, so each requires a two-thirds majority vote to pass. | ||
+ | |||
+ | Voting ends on 2024-07-30 00:00:00 UTC. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | ---- | ||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Line 137: | Line 154: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | None. | + | https:// |
+ | https:// | ||
===== References ===== | ===== References ===== |
rfc/fix_up_bcmath_number_class.1720592789.txt.gz · Last modified: 2024/07/10 06:26 by saki