rfc:integer-rounding

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:integer-rounding [2024/03/17 12:22] – open voting maberfc:integer-rounding [2024/04/02 07:07] (current) – Declined mabe
Line 3: Line 3:
   * Date: 2023-09-26   * Date: 2023-09-26
   * Author: Marc Bennewitz, php@mabe.berlin   * Author: Marc Bennewitz, php@mabe.berlin
-  * Status: Under Discussion+  * Status: Declined
   * First Published at: https://wiki.php.net/RFC/integer-rounding   * First Published at: https://wiki.php.net/RFC/integer-rounding
  
Line 23: Line 23:
  
 This RFC proposes to perform rounding on given int and return a rounded int value if possible by default. This RFC proposes to perform rounding on given int and return a rounded int value if possible by default.
-In case of integer under-/overflow the value will be casted to a float (double) and rounded based on the floating point number as it's done currently.+In case of integer under-/overflow the value will be cast to a float (double) and rounded based on the floating point number as it's done currently.
  
 For ''ceil'', ''floor'' and ''round'' with ''precision >= 0'' this means a given int gets returned as is. For ''ceil'', ''floor'' and ''round'' with ''precision >= 0'' this means a given int gets returned as is.
Line 61: Line 61:
 The ''int''-type is compatible to ''float'', returning an int instead of a float will still be a number accepted for type-hints of ''int'', ''float'', ''int|float'' or ''mixed'' with strict_types enabled. The ''int''-type is compatible to ''float'', returning an int instead of a float will still be a number accepted for type-hints of ''int'', ''float'', ''int|float'' or ''mixed'' with strict_types enabled.
  
-As a result PHP will behave more precise on rounding integer values.+As a result PHP will behave more precisely on rounding integer values.
  
  
Line 196: Line 196:
  
 ===== Unaffected PHP Functionality ===== ===== Unaffected PHP Functionality =====
-Rounding floating point numbers will not be effected in any way.+Rounding floating point numbers will not be affected in any way.
  
 ===== Future Scope ===== ===== Future Scope =====
-After PHP 9 it can be considered to deprecate and remove the `force_floatargument again but due to very long future this is not part of this RFC.+After PHP 9 it can be considered to deprecate and remove the ''force_float'' argument again but due to very long future this is not part of this RFC.
  
  
rfc/integer-rounding.1710678154.txt.gz · Last modified: 2024/03/17 12:22 by mabe