Giter Site home page Giter Site logo

is_float(integer) == true about php-src HOT 3 CLOSED

SailorMax avatar SailorMax commented on May 30, 2024
is_float(integer) == true

from php-src.

Comments (3)

nielsdos avatar nielsdos commented on May 30, 2024

That's because it's not an integer, but a float: https://3v4l.org/Ynacn
When you type a number literal so large it can't fit in an integer, you get a float literal instead of an int literal.

from php-src.

SailorMax avatar SailorMax commented on May 30, 2024

I understand the reason, but this is bad solution with unexpected results. If we will try to write some kind of specific encoder (messagepack for example) we will get broken result.

from php-src.

nielsdos avatar nielsdos commented on May 30, 2024

The automatic change from integer to float happens in many cases, e.g. also when doing some arithmetic e.g. PHP_INT_MAX+1.
If you want to change such a fundamental behaviour you'll have to contact the mailing list and do an RFC.

from php-src.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.