Conversation
| ZEND_ARG_INFO(0, y) | ||
| ZEND_END_ARG_INFO() | ||
|
|
||
| ZEND_BEGIN_ARG_INFO(arginfo_fdiv, 0) |
There was a problem hiding this comment.
This looks like it could add Reflection param and return types, with/without being generated by stubs (some of the above functions already do)
$dividend and $divisor could be used as names to match intdiv.
There was a problem hiding this comment.
I expect that these functions will be converted to stubs very soon, so I'm leaving it for now.
| #ifdef __clang__ | ||
| __attribute__((no_sanitize("float-divide-by-zero"))) | ||
| #endif | ||
| PHP_FUNCTION(fdiv) |
There was a problem hiding this comment.
I recognize the etymology, but I wonder if floatdiv would be a more natural PHP name: it's verbose, and pairs with intdiv obviously. Said another way, the behavior seems closer to intdiv than fmod, so the name should be more closely aligned with the former (floatdiv) than the latter (fdiv).
There was a problem hiding this comment.
Said another way, the behavior seems closer to intdiv than fmod, so the name should be more closely aligned with the former (floatdiv) than the latter (fdiv).
That true, but if someone would ask me a question "What is a complementary (?) function to fmod?" my first guess would be fdiv. Just sharing my thoughs 😉
|
Merged as e35bdb4. |
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
php/php-src#4769 Signed-off-by: Jack Cherng <[email protected]>
* [PHP] Add some built-in classes and constants Classes: ArgumentCountError ArithmeticError CompileError DivisionByZeroError Error ParseError Stringable TypeError ValueError WeakMap WeakReference --- Constants: FILTER_VALIDATE_BOOL --- https://github.com/symfony/polyfill-php80 https://wiki.php.net/rfc/stringable https://wiki.php.net/rfc/weak_maps https://www.php.net/manual/en/reserved.exceptions.php https://www.php.net/manual/en/spl.exceptions.php * [PHP] Add support for union types https://wiki.php.net/rfc/union_types_v2 * [PHP] Add support for "static" return type https://wiki.php.net/rfc/static_return_type * [PHP] Add core function: str_contains https://wiki.php.net/rfc/str_contains * [PHP] Add core function: get_debug_type * [PHP] Add built-in class: DateTimeImmutable, DateTimeInterface * [PHP] Add core function: fdiv php/php-src#4769 * [PHP] Add built-in class: PhpToken https://wiki.php.net/rfc/token_as_object * [PHP] Add core function: str_starts_with, str_ends_with https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions * [PHP] Add support for short attributes ("@@") https://wiki.php.net/rfc/attributes_v2 https://wiki.php.net/rfc/attribute_amendments https://wiki.php.net/rfc/shorter_attribute_syntax * [PHP] Add support for "mixed" type hinting https://wiki.php.net/rfc/mixed_type_v2 * [PHP] Add support for constructor property promotion https://wiki.php.net/rfc/constructor_promotion * [PHP] Extract visibility modifier as a variable * [PHP] Add missing constant: DNS_CAA Fixes #991 * [PHP] Add support for "match" expression https://wiki.php.net/rfc/match_expression_v2 * [PHP] Add snippet: fn ... * [PHP] Add snippet: match ... * [PHP] Add support for named arguments https://wiki.php.net/rfc/named_params * [PHP] Add support for nullsafe operator https://wiki.php.net/rfc/nullsafe_operator * [PHP] Add core function: get_resource_id php/php-src#5427 * [PHP] Add built-in class: InternalIterator php/php-src#5216 * [PHP] Syntax definition use "version: 2" * [PHP] Fix punctuation scopes have no begin/end
* [PHP] Add some built-in classes and constants Classes: ArgumentCountError ArithmeticError CompileError DivisionByZeroError Error ParseError Stringable TypeError ValueError WeakMap WeakReference --- Constants: FILTER_VALIDATE_BOOL --- https://github.com/symfony/polyfill-php80 https://wiki.php.net/rfc/stringable https://wiki.php.net/rfc/weak_maps https://www.php.net/manual/en/reserved.exceptions.php https://www.php.net/manual/en/spl.exceptions.php * [PHP] Add support for union types https://wiki.php.net/rfc/union_types_v2 * [PHP] Add support for "static" return type https://wiki.php.net/rfc/static_return_type * [PHP] Add core function: str_contains https://wiki.php.net/rfc/str_contains * [PHP] Add core function: get_debug_type * [PHP] Add built-in class: DateTimeImmutable, DateTimeInterface * [PHP] Add core function: fdiv php/php-src#4769 * [PHP] Add built-in class: PhpToken https://wiki.php.net/rfc/token_as_object * [PHP] Add core function: str_starts_with, str_ends_with https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions * [PHP] Add support for short attributes ("@@") https://wiki.php.net/rfc/attributes_v2 https://wiki.php.net/rfc/attribute_amendments https://wiki.php.net/rfc/shorter_attribute_syntax * [PHP] Add support for "mixed" type hinting https://wiki.php.net/rfc/mixed_type_v2 * [PHP] Add support for constructor property promotion https://wiki.php.net/rfc/constructor_promotion * [PHP] Extract visibility modifier as a variable * [PHP] Add missing constant: DNS_CAA Fixes sublimehq#991 * [PHP] Add support for "match" expression https://wiki.php.net/rfc/match_expression_v2 * [PHP] Add snippet: fn ... * [PHP] Add snippet: match ... * [PHP] Add support for named arguments https://wiki.php.net/rfc/named_params * [PHP] Add support for nullsafe operator https://wiki.php.net/rfc/nullsafe_operator * [PHP] Add core function: get_resource_id php/php-src#5427 * [PHP] Add built-in class: InternalIterator php/php-src#5216 * [PHP] Syntax definition use "version: 2" * [PHP] Fix punctuation scopes have no begin/end
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.