[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Should not integer exponentiation work when it works?
- From: Patrick Donnelly <batrick@...>
- Date: Thu, 9 Jun 2016 10:04:15 -0400
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