You just use the logarithm to base 10.
If a number can be written as 1.0 x 10^-n, then the pH=n, because -log10(1.0 x 10^-n)=n
Your example is slightly incorrect because 0.00000001= 1.0 x 10^-8 (notice the minus sign) and so the pH=-log10(10^-8)=8
For other values which are not powers of 10 you just take the logarithm and then change the sign.
so for 0.21 you get pH=-log10(0.21)= -(0.6777....)=0.6777....
You need a calculator.in these cases.