Skip to content

is_finite, is_infinite, is_nan wrong input type argument #17809

@remco-pc

Description

@remco-pc

Description

The following functions

  • is_finite,
  • is_infinite,
  • is_nan
    have the argument as a float.
    I believe float ranges are smaller then integer ranges (so is_finite kicks in earlier on a float then on an integer (where the last one is not possible yet))
    Also i believe these functions should accept mixed (like is_int & is_float use) and should convert a numeric string to an integer or a float (wheter it has a comma or not).

this all for the easier way of writing it in templating string like

{{$number = '1.1'}}
{{$is.int.result = $number|is.int}} //false
{{$is.float.result = $number|is.float}} //false
{{$is.number = $number|is.number}} //true
{{$is.finite = $number|is.finite}} //error but custom method could convert numbers it to float (recoverable)
{{$is.infinite = $number|is.infinite}} //error but custom method could convert numbers it to float (recoverable)
{{$is.nan = $number|is.nan}} //error but custom method could convert numbers it to float (recoverable)
{{$is.float.finite = $number|cast.float|is.finite}} //possible
{{$is.float.infinite = $number|cast.float|is.infinite}} //possible
{{$is.float.nan = $number|cast.float|is.nan}} //possible
{{$is.int.finite = $number|cast.integer|is.finite}} //possible due to custom calculation with PHP_INT_MAX & MIN
{{$is.int.infinite = $number|cast.integer|is.infinite}} //possible due to custom calculation with PHP_INT_MAX & MIN
{{$is.int.nan = $number|cast.integer|is.nan}} //possible due to custom calculation with PHP_INT_MAX & MIN

PHP Version

php8.3.15

Operating System

Debian 12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions