javascript 数字中的“e" [英] 'e' in javascript numbers

查看:171
本文介绍了javascript 数字中的“e"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要了解以下内容:

当我在 Google Chrome 的控制台中输入 4e4 时,它返回 40000.

when I type 4e4 in Google Chrome's console it returns 40000.

谁能帮我理解什么是 javascript 数字中的 e 以及为此工作的算法是什么?

Can anyone help me to understand what is e in javascript numbers and what is the algorithm working for this?

提前致谢

推荐答案

4e4 是一种浮点数表示.它包括:

4e4 is a floating-point number representation. It consists of:

  1. 符号 - S(+ 或 -)
  2. 尾数 - M(一些数字,标准化:1.x,其中 x 是一些数字序列)
  3. 指数 - E(代表尾数(M)乘以 10 的幂)
  1. Sign - S(+ or -)
  2. Mantissa - M(some number, normalized: 1.x where x is some sequence of digits)
  3. Exponent - E(represents a power of 10 that is Mantissa(M) multiplied with)

这也是系统中存储浮点数的一种方式.例如,对于单精度,我们得到:单精度浮点数表示

It is also a way of how floating-point numbers are stored on the system. For instance, for single-precision we get: single-precision floating-point number representation

一起,它给了我们:

-1^S * M * p^E 其中 p数值系统的基础

所以,在常识中,p 可以是任何东西,这样 4e4 也可以是 4 * 5^4 if p== 5

So, in common sense, p can be anything so that 4e4 could be also 4 * 5^4 if p == 5

因为我们通常使用十进制值 p 等于 10

正如之前回答的那样,4e4 == 4 * 10^4(因为在这种情况下 4 是十进制值)

And as was answered before, 4e4 == 4 * 10^4 (as 4 is a decimal value in this case)

这篇关于javascript 数字中的“e"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆