lua-users home
lua-l archive

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


2015-11-26 12:51 GMT+08:00 Jonathan Goble <jcgoble3@gmail.com>:
> On Wed, Nov 25, 2015 at 11:40 PM, Xavier Wang <weasley.wx@gmail.com> wrote:
>> When I found doucments for the floor divide operation, I noticed this:
>>
>> With the exception of exponentiation and float division, the
>> arithmetic operators work as follows: If both operands are integers,
>> the operation is performed over integers and the result is an integer.
>> Otherwise, if *both* operands are numbers or strings that can be
>> converted to numbers (see §3.4.3), then they are converted to floats,
>> the operation is performed following the usual rules for
>> floating-point arithmetic (usually the IEEE 754 standard), and the
>> result is a float.
>>
>> maybe the second both (after "Otherwise") should read as "either"?
>
> It's correct as-is: if one operand is an integer and the other is a
> float, then both are numbers, but !(both are integers). Thus a float
> is the result.
>

Yes, you are right. integers is just kind of numbers. Sorry for my fault :-(

-- 
regards,
Xavier Wang.