4 ms·
When you are looking at a binary number, the number of zeros at the start is the exact same thing as making sure the number is below a certain threshold.
by ars_technician 13y ago
When you are looking at a binary number, the number of zeros at the start is the exact same thing as making sure the number is below a certain threshold.
- lololomg 13y agoNo it's not the exact same thing. Example: Treshold = 001010 If you check 001011 or 001001 then the number of leading zeros are the same but one number is below the threshold and the other is not.
- letstryagain 13y agoNot exactly the same thing. Consider this example: Threshold is 001010 The numbers 001001 and 001011 have the same number of leading zeroes but one is below the threshold and the other is not.
- ars_technician 13y agoWhat I said is correct, but I suppose ambiguous. What I mean to say is that counting MSB zeros does specify that the number will be below a threshold, just not an arbitrary threshold like the one you gave in your example. For a more concrete example, if the requirement is that a 16-bit word is less than 4096, you only have to verify that it leads with 4 zeros.
- letstryagain 13y agoYes but Bitcoin uses 'below number X' which has more precision than just counting leading zeroes.