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/02 11:04] – 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. | ||
- Fixed typo in stub. | - Fixed typo in stub. | ||
Line 30: | 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 < |
+ | |||
+ | Currently, there is no other expression for comparison in PHP called " | ||
+ | |||
+ | e.g. | ||
+ | https:// | ||
+ | https:// | ||
+ | |||
+ | Therefore, follow these conventions and rename < | ||
+ | |||
+ | < | ||
+ | public function compare(Number|string|int $num, ?int $scale = null): int {} | ||
+ | </ | ||
=== Remove format method === | === Remove format method === | ||
Line 57: | 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 <php>round()</ |
+ | |||
+ | === Make it serializable === | ||
+ | |||
+ | Being serializable is very important when using something like Redis, as this is expected to be used as a value object. This probably doesn' | ||
=== Fixed typo in stub === | === Fixed typo in stub === | ||
Line 80: | Line 97: | ||
BCMath: None. | BCMath: None. | ||
- | GMP: Code like < | + | GMP: Code like < |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 120: | 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 125: | Line 154: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | None. | + | https:// |
+ | https:// | ||
===== References ===== | ===== References ===== |
rfc/fix_up_bcmath_number_class.1719918293.txt.gz · Last modified: 2024/07/02 11:04 by saki