| PLEX86 | ||
|
Where should the type information be 336
It sounds like you need a copy of "Hacker's Delight". It explains all sorts of interesting tricks and algorithms to do with numbers on a computer in a variety of representations: unsigned, twos-complement and sign-magnitude binary integers, binary integers in bases e, i and -2, Gray code, floating point, and 2D co-ordinates in a Hilbert curve. Where should the type information be 338 fs (future system) was an effort that was targeted at all sorts of complex hardware descriptors ... there was some analysis... For example, the trick where you treat an IEEE floating point as an integer for comparisons is covered. The cases where it doesn't work are shown and explained. Whether you choose to use the trick is thus an engineering compromise, hopefully based on knowing that the input values are in range or "erroneous" returns don't matter, rather than "hey, wow, this is fast, who cares if the results are sometimes broken"0. I don't believe it covers characters though. They're a bit too trivial for a maths book :) If you do want an example of mixing integers and characters, I did once see a very cute nybble-to-ASCII algorithm for the 6502 that used neither a lookup table, or a compare and branch. From faint memory, you put your nybble in the accumulator. You'd switch to BCD mode which would cause an BCD overflow (which would add 6 to the accumulator to normalise it) and a carry set if n was greater than 9. You'd then add-with-carry 0x30. Hey presto, '0'..'9','A'..'F'. Where should the type information be 337 I agree with you that many of the problems buttociated with computers and debugging might be eliminated if data was either described by descriptors or typed with tags, or both. I wrote... 0 aka the PHP-MySQL approach. --
|
||||||||