[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Numbers weirdness
From: |
John Cowan |
Subject: |
Re: [Chicken-users] Numbers weirdness |
Date: |
Fri, 1 Apr 2016 14:38:57 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Andy Bennett scripsit:
> I'm mostly using log2 to work out if numbers are a power of two and find
> the highest bit that they have set.
You can use integer-length to tell how many bits are required. If you
subtract 1 and the number of bits shrinks by 1, you have a power of 2.
Rules for WWI pilots:
1. Stay out of WWII.
--Peanuts
--
John Cowan http://www.ccil.org/~cowan address@hidden
Overhead, without any fuss, the stars were going out.
--Arthur C. Clarke, "The Nine Billion Names of God"