wintel和Sun / SPARC之间浮点结果的小数值差异 [英] small numerical differences in floating point result between wintel and Sun/SPARC

查看:48
本文介绍了wintel和Sun / SPARC之间浮点结果的小数值差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们拥有相同的浮点密集型C ++程序,该程序在英特尔芯片上的Windows上运行,在SPARC芯片上的Sun Solaris上运行。程序

读取两个平台上完全相同的输入文件。但是,

它们会为浮点数产生略微不同的结果。


他们真的应该生成完全相同的结果吗?我猜这是因为两个平台都应该是IEEE浮点符合
标准(754?)。我已经打开了Visual C ++编译

标志,这将确保Windows生成标准兼容代码

(/ Op标志)。但是,它们仍会产生不同的结果。我怀疑这可能是由于我们使用的商业数学库

不能使用/ Op选项编译。如果我使用/ Op选项重新编译了

所有内容,两者应该产生相同的

结果。


我是对的?


非常感谢。

We have the same floating point intensive C++ program that runs on
Windows on Intel chip and on Sun Solaris on SPARC chips. The program
reads the exactly the same input files on the two platforms. However,
they generate slightly different results for floating point numbers.

Are they really supposed to generate exactly the same results? I
guess so because both platforms are supposed to be IEEE floating point
standard (754?) compliant. I have turned on the Visual C++ compile
flags which will make sure the Windows produce standard compliant code
(the /Op flags). However, they still produce different results. I
suspect that this may be due to a commerical mathematical library that
we use which can''t be compiled using /Op option. If I had recompiled
everything using /Op option, the two should have produced the same
results.

Am I right?

Thanks a lot.

推荐答案

" JS" <所以***** @ somewhere.com>写了...
"JS" <so*****@somewhere.com> wrote...
我们有相同的浮点密集型C ++程序,它运行在英特尔芯片上的Windows上和SPARC芯片上的Sun Solaris上。程序
读取两个平台上完全相同的输入文件。但是,它们会为浮点数生成略有不同的结果。

它们真的应该生成完全相同的结果吗?


不是真的。

我猜是因为这两个平台应该是IEEE浮点
标准(754?)兼容。


是的,但他们会以不同的方式进行计算。

我打开了Visual C ++编译
标志,这将确保Windows生成符合标准的代码
(/ Op标志)。但是,它们仍会产生不同的结果。我怀疑这可能是由于我们使用的商业数学库无法使用/ Op选项编译。如果我使用/ Op选项重新编译了所有内容,那么两者应该产生相同的结果。

我是对的吗?
We have the same floating point intensive C++ program that runs on
Windows on Intel chip and on Sun Solaris on SPARC chips. The program
reads the exactly the same input files on the two platforms. However,
they generate slightly different results for floating point numbers.

Are they really supposed to generate exactly the same results?
Not really.
I
guess so because both platforms are supposed to be IEEE floating point
standard (754?) compliant.
Yes, but they go about making calculations differently.
I have turned on the Visual C++ compile
flags which will make sure the Windows produce standard compliant code
(the /Op flags). However, they still produce different results. I
suspect that this may be due to a commerical mathematical library that
we use which can''t be compiled using /Op option. If I had recompiled
everything using /Op option, the two should have produced the same
results.

Am I right?



很难说。然而,众所周知,浮点数

和涉及这些的计算在不同的硬件上是不同的
平台。并且,是的,因此,标准库中的数学库和数学函数

可能略有不同。


V



Hard to say. However, it is well known that floating point numbers
and calculations involving those are different on different hardware
platforms. And, yes, as a result, math libraries and math functions
in the standard library can differ slightly.

V




" JS" <所以***** @ somewhere.com>在消息中写道

news:st ******************************** @ 4ax.com ...

"JS" <so*****@somewhere.com> wrote in message
news:st********************************@4ax.com...
我们有相同的浮点密集型C ++程序,它运行在英特尔芯片上的Windows上和SPARC芯片上的Sun Solaris上。程序
读取两个平台上完全相同的输入文件。但是,它们会为浮点数生成略有不同的结果。


我并不感到惊讶。

他们真的应该产生完全相同的结果吗?


不一定。

我猜是因为两个平台都应该符合IEEE浮点
标准(754?) 。我已经打开了Visual C ++编译
标志,这将确保Windows生成符合标准的代码
(/ Op标志)。
但是,它们仍会产生不同的结果。我怀疑这可能是由于我们使用的商业数学库无法使用/ Op选项编译。如果我使用/ Op选项重新编译了所有内容,那么两者应该产生相同的结果。

我是对的吗?
We have the same floating point intensive C++ program that runs on
Windows on Intel chip and on Sun Solaris on SPARC chips. The program
reads the exactly the same input files on the two platforms. However,
they generate slightly different results for floating point numbers.
I''m not surprised.

Are they really supposed to generate exactly the same results?
Not necessarily.
I
guess so because both platforms are supposed to be IEEE floating point
standard (754?) compliant. I have turned on the Visual C++ compile
flags which will make sure the Windows produce standard compliant code
(the /Op flags).
However, they still produce different results. I
suspect that this may be due to a commerical mathematical library that
we use which can''t be compiled using /Op option. If I had recompiled
everything using /Op option, the two should have produced the same
results.

Am I right?


http://docs.sun.com/source/806 -3568 / ncg_goldberg.html


-Mike



http://docs.sun.com/source/806-3568/ncg_goldberg.html

-Mike


文章< st ****** **************************@4ax.com>,

JS< so ***** @ somewhere.com>写道:
In article <st********************************@4ax.com>,
JS <so*****@somewhere.com> writes:
我们有相同的浮点密集型C ++程序,它运行在英特尔芯片上的Windows上和SPARC芯片上的Sun Solaris上。程序
读取两个平台上完全相同的输入文件。但是,它们会为浮点数产生稍微不同的结果。
We have the same floating point intensive C++ program that runs on
Windows on Intel chip and on Sun Solaris on SPARC chips. The program
reads the exactly the same input files on the two platforms. However,
they generate slightly different results for floating point numbers.




这与Fortran(或C)有什么关系?不要
交叉偏离主题的帖子。


PS:Google on浮动金伯格


-

Steve



What does this have to do with Fortran (or C)? Don''t
cross post off-topic threads.

PS: Google on "floating goldberg"

--
Steve


这篇关于wintel和Sun / SPARC之间浮点结果的小数值差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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