python - How to substract floating point numbers with high precision
问题描述
Basically I have a number say 5.112 I want to subtract it in each iteration by 0.001 like 5.111, 5.110, 5.109, 5.108 etc.
Currently, I am thinking of using the split method to separate the number form decimal point and then subtract the 1st index by 1 and join.
I am just wondering If there is any other better way of doing this.
解决方案
推荐阅读
- excel - 根据另一列中的最后一行复制列中的值
- rest - 放心:为什么我会得到 IllegalStateException 异常?
- java - Java - 有没有一种方法可以在不迭代的情况下查询 Apache Spark 模式?
- python - 获取页面源的快速方法
- angular - 从组件输入中导出 ngIf 值
- ssl - SSL 证书不适用于 letencrypt
- python - Pandas:从 A 列中提取 B 列不存在的数据
- angular - 如何将角度 FormArray 绑定到 ngx-select-dropdown
- java - 如何使用 FileWriter 在文件中附加文本
- ruby - 在 Ruby 1.8.6 中,如何区分常规符号和“引用”符号?