解释roundToNextSignificant(double number)

/**
* rounds the given number to the next significant number
*
* @param number
* @return
*/
public static float roundToNextSignificant(double number) {
final float d = (float) Math.ceil((float) Math.log10(number < 0 ? -number : number));
final int pw = 1 - (int) d;
final float magnitude = (float) Math.pow(10, pw);
final long shifted = Math.round(number * magnitude);
return shifted / magnitude;
}
谁能给我解释一下这个函数里的每句话是什么意思,已经这个函数是干什么的?

给定一个数字,求它的数量级最接近的10^n数。