Re: ?? shift left

new topic     » goto parent     » topic index » view thread      » older message » newer message

5 * power(2, 2) = 20
7 * power(2, 16) = 458752

so to shift x left by p, use x * power(2, p)
and to shift x right by p, use x / power(2, p)

Jeff Fielding
----- Original Message ----- 
From: "Bernie Ryan" <xotron at localnet.com>
To: "EUforum" <EUforum at topica.com>
Subject: ?? shift left


> 
> 
> 
> Quoting the library reference :
> 
>  "There are no routines for shifting bits left or right,
>  but you can achieve the same effect by multiplying or dividing
>  by powers of 2."
> 
> 
>  These are my examples :
>          1: 5 shifted-left 2 is equal to 20
>          2: 7 shifted-left 16 is equal to 458752
>  
>  Now how can you do this with the power() function ??
> 
> Bernie
> 
> 
> 
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu