python - 在仿射中使用极小的数字。在python中仿射
问题描述
Affine.scale 中的小数始终为零
例如,
from affine import Affine
# This line will show
#| 0.00, 0.00, 0.00|
#| 0.00, 0.00, 0.00|
#| 0.00, 0.00, 1.00|
print(Affine.scale(1/(2**19)))
但是,我需要 1.9073486328125e-06 而不是 0。
我怎样才能解决这个问题?
(我使用的仿射版本是2.3.0。)
解决方案
打印仿射变换矩阵将使其打印四舍五入的数字。
我们应该使用 index 来获取存储在 metirx 中的确切数字。
print(Affine.scale(1/(2**19))[0])
# got: 1.9073486328125e-06
推荐阅读
- reactjs - npm create-react-app myapp 给出错误命令失败:create-react-app spawn EPERM
- python - cvxpy中的余数运算
- python - 使用 PHP 和 SSH 在 Web 上使用 Python 的 Pi RGB 控制器。这是个好主意?
- hyperledger-fabric - Hyperledger Fabric configtxgen proto:Marshal 用 nil 调用
- plantuml - Plantuml:如何避免自身箭头和方向重叠并选择组件的一侧
- button - 发送 POST 请求后取消点击按钮
- css - 似乎无法在 Rails 上配置 Tailwind CSS 2
- swiftui - Swiftui:检查内容是否适合滚动视图而不滚动
- refresh - 如何更新购物车?产品预览图片、产品名称、价格应更新
- kubernetes - coredns 不提供 IP,只提供名称