python 中的浮点数表示使用基数 10 吗?

Is representation of float in python using base 10?

我读过 this page(法语),我们可以在其中阅读 python 中的浮点类型将使用以 10 为底的表示,而不是经典二进制(如 Java 例如)。

这对我来说似乎很奇怪,我想确定一下。这是真的吗? Python 不使用 IEEE 754 吗?

不,浮点数用 PyFloatObjects 表示,它们只是 doubles 的包装:

typedef struct {
    PyObject_HEAD
    double ob_fval;
} PyFloatObject;

(source)

正如 arshajii 所说,cpython 正在使用 double 作为内部存储,但是来自

https://docs.python.org/2/reference/lexical_analysis.html#grammar-token-floatnumber -

The allowed range of floating point literals is implementation-dependent.

您正在阅读的表示是如何将浮点数从字符串转换为字符串(编译器正在解析 python 源代码)。这个数字如何在内部存储取决于实现。