On 17 Jul 2014, at 08:17, Stas Malyshev <smalys...@sugarcrm.com> wrote:

> Hi!
> 
>> * Time (actually pretty common in web apps, though we have a DateTime
>> class)
> 
> Admittedly, we're getting closer to the dreaded year 2038, but what does
> it actually mean to divide current Unix timestamp by 3 and why one would
> ever want to do this? We also have classes for real datetime calculations.

To divide by three is probably a bad example, but it’s fair to point out that 
anything with UNIX timestamps would work fine with just floats as we don’t need 
53 bits yet.

> Here you are onto something, but how often you paginate data sets of
> MAXINT size and need exact number of pages?

Rarely, I suspect, but it would still be nice to have a proper way of doing the 
division

> If you're using ints for currency, you're probably doing it wrong. If
> you're dividing currency using integer division, I don't even know what
> you are trying to do, except reenacting Office Space :)

A lot of people use ints as a poor man’s fixnum, and sometimes that’s actually 
the right way to implement them. IIRC, Bitcoin is implemented using 64-bit 
integers internally.

> You mean image processing? If 53 bit precision is not enough there, I'm
> not even sure PHP should be doing that.

True, but again, you should still ask why PHP doesn’t support integer division 
in the first place.

> IMHO this is not enough for a new operator... Especially if this means
> we have to tolerate something like %/.

%/ and %% are hardly the nicest operators, no. Myself I like %% as % being one 
part and %% being the other part of an integer division makes sense to me, but 
I can see why others might not like it.

--
Andrea Faulds
http://ajf.me/





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to