473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Floating point differences between executables sharing a DLL

A W
Hello,

I am encountering the following scenario while compiling a project
under Visual Studio 2005 with the floating point model set as precise.

Two executables A and B share a common dll C. Both call the function
func() in C with the same input and get slightly different floating
point results. Below is what func() looks like:

const long double pi = atanl(1.0) * 4.0;
long double func(long double myVar) {
long double res = myVar * pi / 180.0;

return res;
}
Changing func() into the following gives the same result (although
different from the first version) in both executables:

const long double pi = atanl(1.0) * 4.0;

long double func(long double myVar) {
long double intermediateRes = pi / 180.0;
long double res = myVar * intermediateRes;

return res;
}

Does anyone know why this is happening?

Thanks

Jan 10 '07 #1
0 990

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Christopher Kang | last post by:
I had a question about python and mysql, but I want to first thank those who taught me about the factory method, it was exactly what I needed. Anyway, I have a problem where I am pulling...
31
by: JS | last post by:
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....
15
by: michael.mcgarry | last post by:
Hi, I have a question about floating point precision in C. What is the minimum distinguishable difference between 2 floating point numbers? Does this differ for various computers? Is this...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
8
by: Jon Rea | last post by:
Hi, I have just tried compiling some scientific calculation code on Redhad Linux using gcc-3.4.4 that I normally compile on MS Visual C++ 03 and 05. I was surprised to get different floating...
3
by: prouleau001 | last post by:
Hi all, While trying to use simplejson under Python 2.4.3 I have been investigating the handling of special floating point values and found that both Python 2.4 and 2.5 return False when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.