Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Floating point calculations varying between computers.

Posted on 2003-11-10
4
Medium Priority
?
183 Views
Last Modified: 2010-04-05
I am building an application where two instances, running on two seperate machines, must make the same floating point calculations given the same inputs.

I know that there can be problems with double values.  The two computers will not always make the same calculation due to differrences in precision settings in the FPU.  FPU settings can be changed at any time by other programs that are running concurrently.

Does the same apply to single values? or, are single values at a low enough precision, that even the lowest precision FPU settings will not affect the consistency of calculations on seperate computers?

I am looking for a simple Yes or NO answer with a good explanation of why.

Thank you.

0
Comment
Question by:wolsen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Vihmapuu
ID: 9826423
There is no difference in double or single values except that they have different precision.
Would there be a way of avoiding floating point calculations?
For example, you could use int64 and then divide it by 10000 to get your 4 digits only when showing to the user.
0
 
LVL 2

Author Comment

by:wolsen
ID: 9826912
The difference in precision is the crucial factor.  My hunch is that a lower precision type may not be affected by differing FPU settings.

I will restate my question differrently:

Are single value calculations affected by the FPU precision settings, or will they always be the same?  I know for certain that double value calculations are not consistent between computers.  I have done tests to confirm this.  I have since changed to using single values, and I have not seen the inconsistency happening, but I want to make sure that it will never happen with single values.

I am only using basic operations (+,-,*,/) in the calculations.

Will single values always have the same results between differrent computers when the above operations used.  Yes or No?  Why?
0
 
LVL 1

Accepted Solution

by:
Vihmapuu earned 300 total points
ID: 9830291
I can't answer that.
I would just use int64 (that is more precise and faster, too) and forget about single values. Unless if you are only interested in science and not a practical approach.
Integers are guaranteed to give you the same result with any machine and any conditions.
0
 
LVL 2

Author Comment

by:wolsen
ID: 12288530
I changed to using single values and the problem went away.  The calculations only varied when using double values.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question