浮点处理器不确定性? [英] floating point processor non-determinism?

查看:70
本文介绍了浮点处理器不确定性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在不涉及不必要的细节的情况下,对浮点数(x86_64)的运算是否有可能基于相同的输入返回结果,但其结果的细微变化?甚至有一点不同吗?

Without getting into unnecessary details, is it possible for operations on floating-point numbers (x86_64) to return -however small- variations on their results, based on identical inputs? Even a single bit different?

我正在模拟一个基本上是混沌的系统,我希望数据上的微小变化会产生明显的影响.但是我希望,使用相同的数据,该程序的行为将得到修复.不是这种情况.每次运行该程序时,我都能看到但可以接受的差异.

I am simulating a basically chaotic system, and I expect small variations on the data to have visible effects. However I expected that, with the same data, the behavior of the program would be fixed. This is not the case. I get visible, but acceptable, differences with each run of the program.

我想我在某个地方留下了一些未初始化的变量...

I am thinking I have left some variable uninitialized somewhere...

我使用的语言是C ++和Python.

The languages I am using are C++ and Python.

罗素的答案是正确的.浮点运算是确定性的.不确定性是由指针悬空引起的.

Russell's answer is correct. Floating point ops are deterministic. The non-determinism was caused by a dangling pointer.

推荐答案

与托马斯的答案相反,浮点运算不是不确定的.它们非常微妙,但是如果未使用未初始化的内存或故意的随机数据,则给定的程序应为相同的输入提供相同的输出.

Contra Thomas's answer, floating point operations are not non-deterministic. They are fiendishly subtle, but a given program should give the same outputs for the same inputs, if it is not using uninitialized memory or deliberately randomized data.

我的第一个问题是,相同数据"是什么意思?这些数据如何进入您的程序?

My first question is, what do you mean by "the same data"? How is that data getting into your program?

这篇关于浮点处理器不确定性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆