Merge pull request #261 from qqlcbb/master

修复小数位不存在报错的情况
This commit is contained in:
wangzheng0822 2019-03-11 09:57:24 +08:00 committed by GitHub
commit d3431d6b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,7 +86,11 @@ function squareRoot($number)
function getDecimalPlaces($number)
{
$temp = explode('.', $number);
return strlen($temp[1]);
if (isset($temp[1])) {
return strlen($temp[1]);
}
return 0;
}
// 测试二分查找给定值