如何将数字转换为科学记数法? [英] How can I convert numbers into scientific notation?
本文介绍了如何将数字转换为科学记数法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个函数,它将输入的值转换为科学记数法(N x 10 ^ a)但我似乎无法正确理解。
示例:
我输入200.转换器转换它为2 x 10 ^ 2
解决方案
您可以这样做:
a = 200
a.toExponential(); //输出2e + 2
小提琴:
http://jsfiddle.net/Q8avJ/9/
I want to make a function that takes an entered value and converts it to scientific notation (N x 10^a)
I've tried many different things, but I can't seem to get it right.
Example:
I enter 200. The converter converts it to 2 x 10^2
解决方案
You can do something like this:
a = 200
a.toExponential(); //output 2e+2
fiddle: http://jsfiddle.net/Q8avJ/9/
这篇关于如何将数字转换为科学记数法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文