What is 1e-9?
def compare_floats(a, b, epsilon=1e-9): //判断浮点数是否相等, 实际是判断两数相差是否大于那个极微小的数 return abs(a - b) < epsilon result = compare_floats(0.1 + 0.2, 0.3) //现在返回True,正常工作!
It’s a way to write the number .000000001 in scientific notation, i.e., 1 × 10⁻⁹. The “e” is a more compact way to write “× 10^”.
Or in plain English, the “e” here means “times ten raised to the power of”, so 1e-9 can be read in the same way as 1 × 10⁻⁹, “one times ten raised to the power of negative nine”.
This is alternatively referred to as “E-notation”, and it is mostly used as a way to concisely write numbers in scientific notation, so that they are easier to read in text, or where space is limited, like on a calculator display.
Incidentally, the number 1e-9 corresponds to the scientific prefix nano and what is commonly referred to as the “nanoscale”. For example, a nanometer is one-billionth of a meter, or .000000001 meter or more concisely 1e-9 meter.
These are the sorts of length scales on which the field of nanotechnology works.
Scientific notation and metric affixes
You can enter metric affixes or scientific notation to indicate very large or very small numbers. For scientific notation, you can type either a caret (^) or the letter e
followed by a number to indicate an exponent. You can use both positive and negative exponents.
For example, to indicate 0.012
, you can enter either of the following expressions:
- 1.2*10^-2
- 1.2e-2
To indicate -440,000, you can enter either of the following expressions:
- -4.4*10^5
- -4.4e5
The following table shows how to enter numbers with metric affixes, with scientific notation, and with e
notation.
To enter |
Use this |
Scientific Notation |
Use this |
Other Notation |
0.1 | 1d (deci) | 10^-1 | 1e-1 | |
0.01 | 1c (centi) | 10^-2 | 1e-2 | 1% (percent) |
0.001 | 1m (milli) | 10^-3 | 1e-3 | |
0.000001 | 1u (micro) | 10^-6 | 1e-6 | |
0.000000001 | 1n (nano) | 10^-9 | 1e-9 | |
0.000000000001 | 1p (pico) | 10^-12 | 1e-12 | |
1,000 | 1k (kilo) | 10^3 | 1e3 | |
1,000,000 | 1M (mega) | 10^6 | 1e6 | |
1,000,000,000 | 1G (giga) | 10^9 | 1e9 | |
1,000,000,000,000 | 1T (tera) | 10^12 | 1e12 |
Note: When you use metric affixes or e
notation, make sure you do not include spaces between the number and the metric affix or the e
.
For more information, see Entering math expressions in assignments or the calculator or Using constants in math expressions.
南来地,北往的,上班的,下岗的,走过路过不要错过!
======================个性签名=====================
之前认为Apple 的iOS 设计的要比 Android 稳定,我错了吗?
下载的许多客户端程序/游戏程序,经常会Crash,是程序写的不好(内存泄漏?刚启动也会吗?)还是iOS本身的不稳定!!!
如果在Android手机中可以简单联接到ddms,就可以查看系统log,很容易看到程序为什么出错,在iPhone中如何得知呢?试试Organizer吧,分析一下Device logs,也许有用.