<cfif bitAnd (yourVariable, 2^0) gt 0>
...
</cfif>

Replace 0 in 2^0 with whatever power you want to test for.

Marius
----- Original Message ----- 
From: "Richard Meredith-Hardy" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, October 21, 2004 11:51 AM
Subject: Re: what is it called..?


> No relation, I'm afraid!
>
> Say I have a DB record with lots of attributes.  Rather than have loads
> of bit columns which each have to be individually evaluated yes/no, I
> think you can achieve the same thing by having the single value 22 which
> can be evaluated later to mean 2=yes, 4=yes, 8=no, 16=yes, 32=no Etc.
>
>
>
> Douglas Knudsen wrote:
> >
> > but you inherit a geat name in mathematics!  Hardy!
> > http://www.stetson.edu/~efriedma/periodictable/html/Ho.html
> >
> > So, what are you trying to do?  looks like some sort of partitioning
> > looking only at powers of 2..  Can you give another example?
> >
> > Doug
> >
> > On Thu, 21 Oct 2004 16:25:57 +0100, Richard Meredith-Hardy
> > <[EMAIL PROTECTED]> wrote:
> > > ...when you have a value eg 22 which is made up of 2+4+16 so you know
of
> > > all your options valued 2,4,8,16,32 Etc only 2 and 4 and 16 apply.
> > >
> > > I know there must be a mathematical name for this, but what?
> > >
> > > Does anyone have some example CF code to 'decrypt' such numbers?
> > >
> > > Are there other [simple] ways to do this to handle a large number of
> > > options (>25, so I don't start having giant numbers?)  Something to do
> > > with prime numbers perhaps?
> > >
> > > You can tell I'm not a mathmatician can't you!
> > >
> > > THANKS!
> > >
> > > --
> > > Regards;
> > >
> > > Richard Meredith-Hardy
> > > -------------------------------------------------------------
> > > r[dot]mh[at]flymicro[dot]com
> > > Tel: + 44 (0)1462 834776 FAX: + 44 (0)1462 732668
> > >
> > >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the mailserver that powers this list at 
http://www.houseoffusion.com/banners/view.cfm?bannerid=17

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182205
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to