User Tools

Naming convention for data

octal sequencing

For the binary representations in machines, only numbers with fractions denominated by 2's exponents can be precisely represented with finite number of digits. Among these, octal numbers are closest to the familiar decimal numbers.

The denominator is nth power of 8. Numeration runs in decimal integer i.

shopt -s extglob
m=2 # leading octal integer part
n=3 # number of fractional octal digits
i=0 # the decimal numerator
while ((i<10000)); do
	s=`printf %0${n}o $((i%8**n))`;s=`printf %0${m}o $((i/8**n))`${s%%*(0)}
	r=`echo "$i*8^(-$n)"|bc -l`;if [[ "${r}" =~ '.' ]];then r=${r%%*(0)};fi
	echo str=${s}, value=${r}
	i=$((i+1))
done

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information