php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #1325 longval() and a (long) cast would be handy
Submitted: 1999-04-18 12:55 UTC Modified: 2000-04-14 09:36 UTC
From: maarnold at gte dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.5 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: maarnold at gte dot net
New email:
PHP Version: OS:

 

 [1999-04-18 12:55 UTC] maarnold at gte dot net
floor(), ceil(), intval() all return 2 byte int. Large floats get rolled over by floor() and ceil(). Long strings get rolled over by intval(). I'm trying to create a web based postgress database manager and I'm having a bit of trouble supporting the int4 data type.
The php documentation on type manipulation says that integers are treated as longs. You might just want to have floor(), ceil(), and intval() always return a long. That may be easiest.

I saw the bug report from the guy with the mysql database. My application is also a "serious" database app; but I'm not quite so vindictive.

Thanks

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-04-14 09:36 UTC] rasmus at cvs dot php dot net
They do return longs.  For example, floor() does this:

    if (value->type == IS_DOUBLE) {
        RETURN_LONG((long)floor(value->value.dval));
    }

You probably want to have a look at the bcmath functions instead.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 14:00:01 2026 UTC