Hand-drawn picture of Turing Machine

I took the liberty of looking at the VBA code in the Converters Module of the Converter Excel file that I downloaded from the Home page of this website. I noticed that when converting a denary number to a binary number, or vice versa, you made use of Application.WorksheetFunction.Log10(2). What was that all about?



First of all, let me say that I'm glad that you took a look at the VBA code that I wrote. Feel free to make any modifications to it to suit your own purposes. I only ask that if you do so, and especially if you then make it available to others, that I get credit for the work I've done. Therefore, I ask that you leave my name in the comments so that everyone will know that I'm the original author, and then insert a comment with your own name and explanation of the purpose of your modification.

Your question obviously pertains to the portion of VBA code that handles the conversion of a binary number to a denary number (or of a denary number to a binary number). Based on the number of digits in the binary number, I had to figure out what size array I would need to to hold all of the denary digits. (Or, based on the number of digits in the denary number, I had to figure out what size array I would need to hold all of the binary digits.) For that purpose, I used the following two theorems:

Theorem: Suppose N is a positive integer that requires d digits when expressed in base 10. Then, the number of digits required to express N in base 2 is at most ⌈d/log 2⌉, where ⌈ ⌉ is the ceiling function.

Theorem: Suppose N is a positive integer that requires b digits when expressed in base 2. Then, the number of digits required to express N in base 10 is at most ⌈b log 2⌉, where ⌈ ⌉ is the ceiling function.


Version 1.0 -- April 23, 2017
Template Version 1.0 -- May 19, 2017