[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.3.2 (rc2) now available
- From: Jonathan Goble <jcgoble3@...>
- Date: Wed, 25 Nov 2015 23:51:09 -0500
On Wed, Nov 25, 2015 at 11:40 PM, Xavier Wang <email@example.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.