integer division with float result

Derek Parnell derek at nomail.afraid.org
Sun Nov 18 23:11:24 PST 2007


On Sun, 18 Nov 2007 23:40:52 +0000 (UTC), Lars Noschinski wrote:

> * Stas Sergeev <stsp at aknet.ru> [07-11-18 22:10]:
>>I haven't used D yet, but I know that most
>>(or all?) of the C-unrelated languages do
>>that in a proper way, and even the Python
>>developers are going to fix that in the future.
> 
> Which languages do that (without having a separate operator for integer
> division)?

Euphoria does. In fact it can be a bit of a nuisance at times.

int a,b,c
a = 3
b = 4
c = a / b -- Fails 'cos result is a floating number and you can't assign it
to an integer.
c = floor(a / b) -- Okay now.


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
19/11/2007 6:08:19 PM



More information about the Digitalmars-d mailing list