lua-users home
lua-l archive

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


On Thu, Jun 9, 2016 at 4:45 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> I know I am reopening an old can of worms.
>
> I find that need to code something the following quite often.
>
> n=327  -- some integer calculated earlier
> u = 2*n+1
> v = u*u
>
> simply because
>
> v=(2*n+1)^2
>
> returns a float. It feels as if I am programming in some low-level
> language where intermediates must be stored explicilty.

v = (2*n+1)<<1

:)

-- 
Patrick Donnelly