怎么将普通数字转换为科学计数法,谢谢
public static void parseSciNot(double num, double base, int index) {
base = num;
index = 0;
if (num >= 1) {
while (base >= 10) {
base = base / 10;
index ++;
}
}
else {
while (base < 1) {
base = base * 10;
index --;
}
}
System.out.println("The scientific notation of " + num + " is: " + base + "*10^(" + index + ")");
}
例如 3000=3*10的三次方。0.003=3*10的负三次方