Hey,
it cuts off the lowest 3 bits. These lowest 3 bits are 001, 010, 011 etc, so
1,2,3,4,5,6,7
But cutting off only the lowest three bits, will result in 0..7 being 0,
8..15 being 8, while you want 0..4 -> 0 , 5..12 -> 8, etc, so 4 is added.
But Benjamin can prolly explain better hehe since it'
Indeed it looks very impressive. Could some explain what is does exactly?
Hans Wichman wrote:
very cool!
On Thu, Dec 18, 2008 at 4:26 PM, Benjamin Wolsey wrote:
Am Donnerstag, den 18.12.2008, 16:13 +0100 schrieb Hans Wichman:
Hi,
I think you are looking for :
function roundToEight (pVal:Num
very cool!
On Thu, Dec 18, 2008 at 4:26 PM, Benjamin Wolsey wrote:
> Am Donnerstag, den 18.12.2008, 16:13 +0100 schrieb Hans Wichman:
> > Hi,
> > I think you are looking for :
> > function roundToEight (pVal:Number) {
> > return Math.round(pVal/8)<<3;
> > }
> > although 44.9 and 44.4 will both r
var multitude:Number = tN -(tN%8)
-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri
Heitlager
Sent: donderdag 18 december 2008 14:55
To: Flash Coders List
Subject: [Flashcoders] round number to closet
Thank you all.
:)
Benjamin Wolsey wrote:
Am Donnerstag, den 18.12.2008, 16:13 +0100 schrieb Hans Wichman:
Hi,
I think you are looking for :
function roundToEight (pVal:Number) {
return Math.round(pVal/8)<<3;
}
although 44.9 and 44.4 will both return 48, don't you mean 43.9 and 44.4?
int(pV
44. should be rounded to 48.
Try some simple mathematics, check out the difference between (48 -
44.) vs (44. - 40) and tell me which is the greater
difference?
On Fri, Dec 19, 2008 at 12:04 AM, Jiri Heitlager
wrote:
> Thnx that seems to work good enough.
>
> 44. is rounded to 48
Am Donnerstag, den 18.12.2008, 16:13 +0100 schrieb Hans Wichman:
> Hi,
> I think you are looking for :
> function roundToEight (pVal:Number) {
> return Math.round(pVal/8)<<3;
> }
> although 44.9 and 44.4 will both return 48, don't you mean 43.9 and 44.4?
>
int(pVal + 4) &~ 7;
will also do it.
Wouldn't 44 be the cutoff in that case and anything above (44.444) should go to
48?
-Joe
--- On Thu, 12/18/08, Jiri Heitlager wrote:
> From: Jiri Heitlager
> Subject: Re: [Flashcoders] round number to closet value of 8
> To: "Flash Coders List"
> Date: Thursday,
ash Coders List
> Subject: [Flashcoders] round number to closet value of 8
>
> I am trying to figure out the fastest way to get the closest multitude
> of 8 from a random Number
> and I am really not a math person.
>
> var tN:Number = 32.3
> //32
> var tN:Number = 3
...@chattyfig.figleaf.com] On Behalf Of Jiri
Heitlager
Sent: Thursday, December 18, 2008 8:55 AM
To: Flash Coders List
Subject: [Flashcoders] round number to closet value of 8
I am trying to figure out the fastest way to get the closest multitude
of 8 from a random Number
and I am really not a math
: [Flashcoders] round number to closet value of 8
I am trying to figure out the fastest way to get the closest multitude
of 8 from a random Number
and I am really not a math person.
var tN:Number = 32.3
//32
var tN:Number = 32.00
//32
var tN:Number = 44.9
//48
var tN:Number = 44.4
//40
Much
number to closet value of 8
I am trying to figure out the fastest way to get the closest multitude
of 8 from a random Number
and I am really not a math person.
var tN:Number = 32.3
//32
var tN:Number = 32.00
//32
var tN:Number = 44.9
//48
var tN:Number = 44.4
//40
Much appreciated if someone could
I am trying to figure out the fastest way to get the closest multitude
of 8 from a random Number
and I am really not a math person.
var tN:Number = 32.3
//32
var tN:Number = 32.00
//32
var tN:Number = 44.9
//48
var tN:Number = 44.4
//40
Much appreciated if someone could help me out
Jiri
__
13 matches
Mail list logo