I\'ve written a JavaScript program that calculates the depth of a binary tree based on the number of elements. My program has been working fine for months, but recently I\'ve f
You could perhaps do this instead
// Math.log2(n_elements) to 10 decimal places var tree_depth = Math.floor(Math.round(Math.log2(n_elements) * 10000000000) / 10000000000);