Click here to Skip to main content
15,888,454 members

Comments by Subrat 4708266 (Top 7 by date)

Subrat 4708266 30-Sep-14 20:41pm View    
>>You did not mention what did you do the option.
I have not changed any option except locale(German<->English)
>>why messing with log?
Without log how I'll come to know what is behind the screen?
>>"S/W works fine" is not informative.
It means, all operations are as per intended.Without exception.
>>You did not even report in what line the exception was thrown...
Exception throws at line z=x/y
Subrat 4708266 30-Sep-14 20:02pm View    
Brief:
I have kept log to track what is value of numerator and denominator. And also the resultant division.
Ex:
double x = 0.0, y = 0.0, z = 0.0;
x=GetX();
LOG(x);
y=GetY();
LOG(y);
z=x/y;
LOG(z);

Experiment-1
Steps:
1. Change the project setting->Locale to German
2. Build the application
3. Run in WIN-8 64 bit English OS.
4. S/W Works fine.
5. In log, I am finding y=0, z = NAN. Because of this NAN, it's not throwing exception.

Experiment-2(Frustrating)
Steps:
1. Change the project setting->Locale to English United State
2. Build the application
3. Run in WIN-8 64 bit English OS.
4. S/W throws exception.
5. Collected the log and found, y=0. Then no log about z, because of crash. During evaluation of z, it's throwing exception.
Subrat 4708266 30-Sep-14 19:26pm View    
I'll try the soln. provided by you. But my major concern lies in locale independent operation. I am runing the build in same CPU architecture. Where it's giving NAN for German build and Exception for English. I'm just changing the locale option in the project settings. Other options remains same for getting German/English build.

One more observation I can add to above comment.
NAN can be checked as follows.

if(result == result)
Not a NAN/ Valid operation
else
NAN
means if you compare NAN with NAN using same variable, it fails to indicate it is not a number. Generally if you will see, always x==x should be true. But that is not the case in case of NAN.
Subrat 4708266 30-Sep-14 11:58am View    
Exactly. I want to know how in different locale,it's behaving differently?
If you will get NAN, you won't get exception. But if it's unable to convert to NAN, then exception.
Subrat 4708266 30-Sep-14 11:53am View    
Have you aware of Embarcadero? Do you have it?

Simply run following code.
double x = 0.0, y = 0.0;

double z = x/y;

See the program in WIN-8 64bit and WIN XP.
Change the locale settings to German in IDE, build and check.