lua-users home
lua-l archive

Re: Integer division

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 14.11.2012, at 20.17, Roberto Ierusalimschy wrote:
>> What I meant was: I would prefer separate operators // and %% (integer division and modulo) over /%. The reason: there are no combined operators +-, */, <> etc. either…. you get the idea ;-)
> 
> There is no need for an integer modulo operator. Like all arithmetic
> operations except division, the modulo of two integers is always an
> integer. So, modulo can follow the generic rule: modulo of two integers
> results in an integer, modulo of anything else results in a float.
Ah, of course! Sorry for the noise.
Petri

AltStyle によって変換されたページ (->オリジナル) /