- From: Alex Meiburg <timeroot.alex@gmail.com>
- Date: Sat, 15 May 2010 08:31:33 -0700
- To: Alan Gresley <alan@css-class.com>, www-style@w3.org
- Message-ID: <AANLkTimjlqjK_rcBwehqeyZfU3eJyo7Fz9ijbtHPlnvj@mail.gmail.com>
1. The "0x" prefix before a number indicates that it will be in hex. There are similar things, I believe, with the letter o for Oct, d for decimal, etc. 2. Float just means any decimal number. That's opposed to an integer, which is how the R, G, and B values are usually represented. Usually in computer programming these numbers are called floats instead of fractions or decimals. ~6 out of 5 statisticians say that the number of statistics that either make no sense or use ridiculous timescales at all has dropped over 164% in the last 5.62474396842 years. On Fri, May 14, 2010 at 11:20 PM, Alan Gresley <alan@css-class.com> wrote: > Boris Zbarsky wrote: > >> On 5/15/10 12:37 AM, Alan Gresley wrote: >> >>> 0x00 maps to 0 >>> 0x80 maps to 0.5 >>> 0xFF maps to 1.0 >>> >> >> I would think that Tab's issue was that while 1.0 - 0.5 == 0.5 - 0, 0xFF - >> 0x80 != 0x80 - 0x00. >> >> So the real question is why 0x80 wouldn't map to 0.50196078431372548 if >> we're going from hex to float. >> > > > 0x80 would map to 0.50196078431372548. You can not have a true halfway > value. You have two sets of hexadecimals. > > 0#,1#,2#,3#,4#,5#,6#,7# (127 steps and 128 values) > > _0.5 between two hexadecimals sets_ > > 8#,9#,A#,B#,C#,D#,E#,F# (128 steps and 128 values) > > This is since each color channel (rgb) has 255 steps but 256 values. You > can not divide 255 evenly so 0x80 is the closes to 0.5. > > Two questions: > > > 1. What does the '0x' represent in 0x00? > > 2. What does float represent in where you write, "going from hex to float"? > > > > Or put another way, if we have a set of 256 (really, any even number will >> do) discrete values, there is no way to place them on the closed unit >> interval in such a way that the spacing between two adjacent values is a >> constant and one of the values lands on 0.5. >> >> -Boris >> > > > Correct, please see above :-) > > > > -- > Alan http://css-class.com/ > > Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo > >
Received on Saturday, 15 May 2010 16:01:06 UTC