首页 > 解决方案 > `float.as_integer_ratio` 方法是否有等效的 Python C API?

问题描述

在普通的 Python 中,我们可以编写类似的东西

>>> (0.5).as_integer_ratio()
(1, 2)

有没有办法通过 Python C API 获得这个结果?我唯一看到的是一个 implementation

标签: pythonfloating-pointpython-c-api

解决方案


推荐阅读