Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development Technologies
- Intel® ISA Extensions
- floating point division on multiple computers - same architecture

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

aros_prince

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-12-2011
06:37 AM

80 Views

floating point division on multiple computers - same architecture

the question is, whether the floating point division of two integers like this:

int i, j;

//init

float x = ((float) i)/j;

ends up with the exactly same result on any computer within one CPU architecture, one operating system and one compiler. I don't really care what the exact number of the result is, i just need it to be exactly the same on multiple computers with the same architecture(in particular i ask about x86_64).

An example:

I have two computers. Both of them are have x64 Debian. One of them has Intel C2D processor and the other one say AMD Phenom II. Now on C2D i compile a source code stated above. The question is: Will the x variable contain exactly the same result on both of the computers for every possible i and j values(same on both computers of course)? Now, do not consider any compiler optimization - let us say the value of the two variables is not known during compile time... Again, I don't care about the precision of the computation, i just need the values to be the same.

Link Copied

5 Replies

TimP

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-13-2011
06:08 AM

80 Views

Quoting aros_prince

the question is, whether the floating point division of two integers like this:

int i, j;

//init

float x = ((float) i)/j;

ends up with the exactly same result on any computer within one CPU architecture, one operating system and one compiler. I don't really care what the exact number of the result is, i just need it to be exactly the same on multiple computers with the same architecture(in particular i ask about x86_64).

An example:

I have two computers. Both of them are have x64 Debian. One of them has Intel C2D processor and the other one say AMD Phenom II. Now on C2D i compile a source code stated above. The question is: Will the x variable contain exactly the same result on both of the computers for every possible i and j values(same on both computers of course)? Now, do not consider any compiler optimization - let us say the value of the two variables is not known during compile time... Again, I don't care about the precision of the computation, i just need the values to be the same.

Needless to say, in more realistic context, other issues may come in. We can't guess how you are using this.

aros_prince

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-16-2011
08:47 AM

80 Views

TimP

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-16-2011
09:58 AM

80 Views

In either case, as I mentioned before, you would avoid the reciprocal-math option.

If you have questions about gcc, the more appropriate place is the gcc-help mail list (sign up at gcc.gnu.org).

aros_prince

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-16-2011
05:09 PM

80 Views

Well i think the answer i got is clear enough. Thank you very much.

SergeyKostrov

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-01-2012
07:26 AM

80 Views

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.