Talk:Binary digits: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 13:
:::Right. I am talking about at language level, not CPU level here. Some languages allow a binary value to be used natively (from within the language). Other languages do not allow this (and therefore do not have binary support at a native language level). If the language does not have a radix specifier for binary (ie it does not have native support for binary), then we have to do some number crunching or string manipulation to derive the binary value as output. If a conversion routine does not need to be written within that language, because the language already supports this, we can say it handles binary "without conversion". If the language does not provide any native handling for binary, and we have to write some number crunching code, then this is a "conversion". Does that make sense? It will probably be clearer, when some of the conversion routines get pasted in.
[[User:Markhobley|Markhobley]] 18:15, 6 July 2011 (UTC)
::::For example: J has a special binary type, which is much like a boolean type in other languages, except that its values are 0 and 1 instead of true and false. It's explicitly a numeric type. And a binary number can be represented as a list whose members are this binary type. Thus, the native representation of this type contains spaces (since that's how J represents numeric lists). J also has a primitive to change a number into a binary lists and another primitive for the inverse operation. So... in this context -- where the language has a type that corresponds to "binary digits" and another type that corresponds to "normal numbers" it can make sense to talk about conversion, no? But I think the question is: what does this distinction mean when you do not have this kind of infrastructure? --[[User:Rdm|Rdm]] 18:59, 6 July 2011 (UTC)
 
:::Also a conversion routine that handle several different number bases, may not be the best way to handle a conversion to binary. The routines in [[Non-decimal radices/Convert]] are probably best used in generic circumstances when the target base is not known at compile time. If we know we are going to require binary, then dedicated binary handling methods are best deployed. [[User:Markhobley|Markhobley]] 18:23, 6 July 2011 (UTC)
6,951

edits