1. and_bits() behavior
- Posted by c.k.lester <euphoric at cklester.com> Jun 26, 2007
- 590 views
Should this be right? ADMIN_ONLY = 128 btype = -1 ?and_bits(ADMIN_ONLY,btype) It's returning 128!
2. Re: and_bits() behavior
- Posted by Juergen Luethje <j.lue at gmx.de> Jun 26, 2007
- 590 views
c.k.lester wrote: > Should this be right? > > ADMIN_ONLY = 128 > btype = -1 > > ?and_bits(ADMIN_ONLY,btype) > > It's returning 128! That's OK. Run the following code, and maybe then you can solve the riddle yourself.
include machine.e ? int_to_bits(-1, 8)
Regards, Juergen
3. Re: and_bits() behavior
- Posted by DB James <larches at comcast.net> Jun 26, 2007
- 581 views
c.k.lester wrote: > > Should this be right? > > ADMIN_ONLY = 128 > btype = -1 > > ?and_bits(ADMIN_ONLY,btype) > > It's returning 128! Hi c.k. Run this...
integer i1 i1=-1 printf(1,"%x\n",i1) printf(1,"%d\n",and_bits(i1,128)) while get_key()=-1 do end while
--Quark
4. Re: and_bits() behavior
- Posted by c.k.lester <euphoric at cklester.com> Jun 26, 2007
- 622 views
Thanks, Juergen and Quark. :) My only response is, "BoooOooOoOOOOOo." So I gotta test for -1. waaaAAAAaahhhh.
5. Re: and_bits() behavior
- Posted by Jason Gade <jaygade at yahoo.com> Jun 27, 2007
- 584 views
Juergen Luethje wrote: > > c.k.lester wrote: > > > Should this be right? > > > > ADMIN_ONLY = 128 > > btype = -1 > > > > ?and_bits(ADMIN_ONLY,btype) > > > > It's returning 128! > > That's OK. > Run the following code, and maybe then you can solve the riddle yourself. > }}} <eucode> > include machine.e > ? int_to_bits(-1, 8) > </eucode> {{{ > Regards, > Juergen BTW, I experimented with this today. The highest bit count that I could go to and still get all ones was 53. At 54 and above, I got all zeroes. -- "Any programming problem can be solved by adding a level of indirection." --anonymous "Any performance problem can be solved by removing a level of indirection." --M. Haertel "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.
6. Re: and_bits() behavior
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Jun 27, 2007
- 631 views
- Last edited Jun 28, 2007
Jason Gade wrote: > > Juergen Luethje wrote: > > > > That's OK. > > Run the following code, and maybe then you can solve the riddle yourself. > > > > }}} <eucode> > > include machine.e > > ? int_to_bits(-1, 8) > > </eucode> {{{ > > BTW, I experimented with this today. The highest bit count that I could go to > and still get all ones was 53. At 54 and above, I got all zeroes. I believe that you've hit the precision limit of a double, which is probably the reason for this. Matt