On 17/07/14 04:23, Sara Golemon wrote:
> Wow. I just finally understood what your RFC was going for.  I thought
> you were trying to cover the case where ($a%$b)==0, but you're not,
> you're trying to do truncated integer division regardless of
> remainder.  I also missed the fact that div_function does the right
> thing already as well. My bad for emailing from the bus.
> 
> Okay, that's another animal entirely.

Displaying time intervals is probably one of the best examples of what
is needed, but the 'different animal' that I'd like to be able to handle
transparently is a 'bigint' based index key. One that provides clean
64bit results what ever the hardware base, 'intdiv' and 'mod' giving
'bigint' results which are the two elements of a 'moddiv' result.

I am perhaps a little spoilt since I can do all of this already in the
Firebird database layer ... and since it's the data from there I'm
working with in private code I do not have a problem, but Firebird's
'arithmetic' is not consistent with other engines or PHP. One useful
feature on Firebird is (26 / 3) gives 8 while (28 / 3.00) gives 8.66 -
one can tailor the accuracy of the result simply be loading the input.
This can be irritating at first, but surprisingly useful at times!

Time handling in Firebird introduces another variation which I duplicate
to other engines when needed! A timestamp is essentially 2 32 bit
integers ... one for days and the other 'part of day' -> time as a
fraction of day. This can be used as a 'bigint' value for array indexes
- calendar elements is a good example - or can be split essentially like
the 'moddiv' result to give two integer keys but 32bit ones. Conversion
of this to a 64bit 'unit seconds based' time is a point where one does
not want results wrapped to PHP float values ;)

The point I'm trying to reiterate and expand on is that the integer base
size is as important here as integer division, and one size does not fit
all.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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

Reply via email to