#### Comment Preferences

• ##### I only know about twos complement.(1+ / 0-)
Recommended by:
yet another liberal

I consider 0xFFFFFFFF to be -1 (decimal).

The bit at the end is the positive/negative bit. To switch positive to negative, you just XOR (or EOR, depending on the convention). That's 64 bits, of course. I'd have to think a bit to figure out how ones complement works. Maybe I'll google it.

Hey! Can I brag to you that I once figured out how to calculate a square root in binary in 6502 assembly language (Apple II, Commodore 64), which didn't even have multiply or divide instructions? If you know how to do it in base 10, binary square roots are simple.

And I'll also say I hate floating point numbers. Too messy.

Also, if you're programming something with vectors or circles, forget about converting back and forth from 360 degrees. Use either 256 degrees or 65,536 degrees. It's much simpler. Does that make sense to you?

"Stupid just can't keep its mouth shut." -- SweetAuntFanny's grandmother.

[ Parent ]

• ##### Yeah, cool(1+ / 0-)
Recommended by:
Dbug

I never tried to do a sqrt() with integers.

And yeah, I see what you mean with 256 or 65536 and a circle.  Chop the thing up into the best resolution you can get with your bits (8-bits use 256 pie slices, 16-bit use 65536 pie slices) instead of degrees.  Good idea, I like it.

Republicans: Taking the country back ... to the 19th century

[ Parent ]

• ##### For what it's worth, ...(1+ / 0-)
Recommended by:
Dbug

I managed to put my underwear on correctly this morning.

Reality occupies a dimly lit corner somewhere on the edge of town. I drive by every now and then on my way to visit mom. That’s where the cookie jar is.

[ Parent ]

Subscribe or Donate to support Daily Kos.

• Recommended (141)
• Community (70)
• Civil Rights (26)
• Elections (26)
• Environment (26)
• Media (25)
• Culture (25)
• Law (24)
• Memorial Day (24)
• Science (23)
• Trans-Pacific Partnership (22)
• Labor (21)
• Economy (20)
• Josh Duggar (20)
• Rescued (19)
• Marriage Equality (18)
• Climate Change (17)
• Republicans (17)
• Education (17)
• Ireland (17)