Thomas Hruska wrote:
> andrew clarke wrote:
>> On Mon 2008-09-01 04:27:36 UTC-0700, Thomas Hruska ([EMAIL PROTECTED]) wrote:
>>
>>>> (i - (i % 100)) / 100
>>>>
>>>> == 12
>>> There is no need for subtracting the modulus.  It is redundant. 
>>> Integers are truncated automatically.
>> For some reason I was thinking the division would promote the result
>> to a floating point value.  I think this happens in PHP (and possibly
>> Pascal?).  Sorry, my C is getting rusty!  :-(
> 
> Yes, that happens in PHP.  However, you can do typecasting in PHP:
> 
> <?=(1234 / 100)?>
> 12.34
> <?=(int)(45 / 100)?>

Oops.  (Copied and pasted my first example).

<?=(int)(1234 / 100)?>

> 12
> 
> I'm pretty sure Pascal doesn't promote variables either.  But who uses 
> Pascal any more?  (With the sole exception of the InnoSetup installer, 
> Pascal is pretty much a dead language).
> 


-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to