Fix #640, correct types of sqrt and logBase