numpy的精度错误

时间:2020-01-10 01:46:51

标签: numpy floating-point precision floating-accuracy

有人可以解释一下吗?

  node {
    withCredentials([
        string(credentialsId: 'some ID', variable: 'some variable')
    ]) {
      stage('Initialize') {
        setup()
      }
    }
  }
}


def setup_worker() {
  def labels = ['label2', 'label1']
  def builders = [:]
  for (x in labels) {
    def label = x
    builders[label] = {
      node(label) {
        stage('Setup') {
          step1
          checkout scm
          login()
          write_config()
        }
      }
    }
  }
  parallel builders
}```

Numpy似乎会产生错误的结果,可能是某种精度错误。

我该如何解决?

谢谢

-朱利安

1 个答案:

答案 0 :(得分:0)

>>> numpy.set_printoptions(precision=15)
>>> numpy.array([22.0], dtype=numpy.float64) / (2 ** 11)
array([0.0107421875])

解决此问题

相关问题