Talk:Double dabble

From Wikipedia, the free encyclopedia
WikiProject Computer science  
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.
 

Isn't n + 4n / 3 just 7n/3.. Is it -n or n...the dash before the formula is confusing.

double dabble after a binary point

I just found out how to use double dabble after a binary point: You simply invert the algorithm. Start with the rightmost (least significant) bit, and proceed to the left, towards the binary point. If, in the current final digit, bit 0 is set, the bit will get shifted out in the current iteration, so create a new 0 digit to the right as the new final digit. Then proceed over all digits (from right to left), shifting bits to the right, propagating borrows: If bit 0 is set in the previous digit, OR 8 into the current digit, then shift the previous digit 1 bit to the right, and so on. In the first digit, set bit 3 (=8) as the input bit. Then proceed over all digits and SUBTRACT 3 where a digit is greater than 4. That's all!! Brought to you as a thank you to the author of this article who helped me solve a problem I had for a long time! 79.227.181.141 (talk) 06:18, 11 March 2012 (UTC)

Optimizations

While coding Double Dabble I noticed some optimizations. I don't know if this is "new research" or in the references, so didn't include it in the main article. First, the most significant BCD digit need not ever be tested for "if > 4 add 3". It will never be > 4 before the last shift. It can't lead to a carry into a more significant BCD digit. Second, the first 3 shifts won't ever have an "add 3" step before them since it takes at least 3 shifts to get a value > 4 into the least significant BCD digit. This means the BCD 1s digit can actually be considered as 3 more significant input binary value bits before the algorithm ever begins. For example the 8-bit binary input, 3 BCD digit, 8 shifts algorithm will actually convert up to 999 (hex 3E7), not just 255 (hex FF), being limited only by the 3 BCD digits. To convert 999, start with the BCD 1s digit set to 3 (the MS byte of input value hex 3E7) and the input byte set to E7. Now do 8 iterations of "if any BCD digit is > 4 add 3, then shift". To extend even further, if space for another BCD digit is added (4 BCD digits plus an 8-bit LS-input byte), the input range is extended to hex 7FF (decimal 2047). (Rick314 (talk) 23:26, 10 January 2015 (UTC))

Retrieved from "https://en.wikipedia.org/w/index.php?title=Talk:Double_dabble&oldid=641937135"
This content was retrieved from Wikipedia : http://en.wikipedia.org/wiki/Talk:Double_dabble
This page is based on the copyrighted Wikipedia article "Talk:Double dabble"; it is used under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA). You may redistribute it, verbatim or modified, providing that you comply with the terms of the CC-BY-SA