Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20563

BASCOM-AVR : Printbin problem switching from 4 byte integer to 8byte inte : REPLY

$
0
0
Tim, I think you a missing something very fundamental in your understanding of how number systems and representations work, that you even ask this sort of question. You are confusing the data you get from the keypad ( a list of binary codes, like a byte array ) with the 'value' you might assign to that array. How you assign a value depends dramatically on how you agree to assign a meaning to each byte in the array. For us people who work little-endian, we assume a a byte array 'means' an integer with the low significant bytes first. People who work big-endian assume high byte first, people who think in floats assume the IEEE ( or other ) representations for Single and Dounble precision. Others who think in strings use binary to ASCII codes and convert to alphanumerics, or binary to UNICODE and do the same ( but with a different, and expanded, set of codes ). But all these are merely conventions as a way of storing and handling numerics and characters. The primary data is in the byte array itself, and if you choose to represent that as a string of digits 0-9, then you are using yet another convention to convert to a human readable form. Its totally irrelevant what form you use, as long as you and your customers all use the same convention. Since Basic has no 64 bit ( 8 byte ) number representation, you cannot ( easily ) use that, but why would it matter ? Just use the bytes as an array, and represent it as a string of digits, as you are now. At least that way you are not tied to a specific number length as a construction. I thought I pointed this out before, that if you limit yourself to a specific length, just because it fits a certain language specific type, tthen as soon as someone ( inevitably ) wants something different, you break an entire design. You should remember always that we humans represent a 'number' as a string of characters, 1234 for instance, in English, using Arabic based numerals. Other languages, including machines, have many different representations, but the 'number' 1234, meaning a certain size count of objects remains exactly the same. Its no wonder a couple of guys, Russell and Whitehead, in attempting to write a complete logical definition of mathematics back in the early 1900s or so, started a book which ran to 15 volumes. They got around to defining a number at about volume 7.

Viewing all articles
Browse latest Browse all 20563

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>