473,513 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

-1.#IND000 can't be compared with 0.0

this problem happened after we upgrade our program from vc6.0 to vc.net2003
unmanaged code.

Following are the sample code:
float p, cpr = 3.4028234663852886e+038;
p = (1.0f - pow(1.0f-cpr/100.0f, 1.0f/12.0f));
if(p<0.0f)
p = 0.0;

==
Because the value of cpr is blow up during calculation, value p will be
-1.#IND000 after function call of the math function "pow".
In vc6.0, p<0.0f is true, and p=0.0 is executed, which is what we need. But
in vc.net 2003, p<0.0f is false.
I tried to compare p>0.0f, it is false too.

This is important because our system is big and there are many placed like
this in the program. we want the new system built under vc.net2003 behaves
the same way as it was before.

I checked the memory representation of the value of p. They are same for
version vc6.0 vs vc.net
"00 00 C0 FF"

But when it comes to the comparison statement, they behave differently.

Any feed back will be appreciated.

thanks.
Zongwen
Apr 4 '06 #1
2 3821
Zongwen wrote:
this problem happened after we upgrade our program from vc6.0 to
vc.net2003 unmanaged code.

Following are the sample code:
float p, cpr = 3.4028234663852886e+038;
p = (1.0f - pow(1.0f-cpr/100.0f, 1.0f/12.0f));
if(p<0.0f)


if( p != p || p < 0.0f )

Will work for NAN's. I can't remember if -1.#IND000 represents a NAN.

Jeff Flinn
Apr 5 '06 #2
if( p != p || p < 0.0f ) works for me. Thanks.

But our problem is that we have so many uncertain places with same
situation. This doesn't happen in vc6.0, but apprears in vc.net. Do you know
this is because of the compiler difference? Is any control over compiler
option?

Thanks.
Zongwen

"Jeff F" wrote:
Zongwen wrote:
this problem happened after we upgrade our program from vc6.0 to
vc.net2003 unmanaged code.

Following are the sample code:
float p, cpr = 3.4028234663852886e+038;
p = (1.0f - pow(1.0f-cpr/100.0f, 1.0f/12.0f));
if(p<0.0f)


if( p != p || p < 0.0f )

Will work for NAN's. I can't remember if -1.#IND000 represents a NAN.

Jeff Flinn

Apr 5 '06 #3

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

Similar topics

11
2117
by: 73blazer | last post by:
We are migrating a customer from Version 7.1 FP3, to Version 8.2 (8.1 FP8). For the most part, things are faster, but there is one query that is much much slower, and it is a query that is used all the time. select ATTR1,ATTR2,ATTR3,ATTR4 from physical.part_list where S_PART_NUMBER like '%KJS%' The widlcard before and after seems to be...
3
1787
by: sparks | last post by:
All we are hearing at work now is we should give up on access. NO NO NO you need to go with foxpro. access is dead and can't do anything compared to foxpro It can make coffee, and forward your email....bla bla bla to the people who have used both...what do you say to these people. who have never used or programmed in either one.
73
4537
by: Claudio Grondi | last post by:
In the process of learning about some deeper details of Python I am curious if it is possible to write a 'prefix' code assigning to a and b something special, so, that Python gets trapped in an endless loop in a line with: if a==b: print 'OK' I mean, it would be of much help to me on my way to understanding Python to know how such prefix...
50
5652
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
8
6265
by: lawrence k | last post by:
I've installed Apache 1.3.36 on my Redhat EL 3 machine. Now I'm trying to install PHP 5.1.4. I can not get the ./configure command to work. I keep getting this error: configure: error: Invalid Apache directory - unable to find httpd.h under /usr/local/apache/include So then I run this command: find / -name httpd.h
5
15551
by: Brian | last post by:
Hi I have a problem in opening url using 'file'. I searched many other discussion groups and tried suggestions, but could not resolve this problem. e.g <?php $myfile = file('http://google.com'); foreach ( $myfile as $vals){
25
1534
by: Licheng Fang | last post by:
I mean, all the class instances that equal to each other should be reduced into only one instance, which means for instances of this class there's no difference between a is b and a==b. Thank you.
6
5382
by: iCe CreaM | last post by:
I am working on code to calculate the factorial using below function: int factorial (int num) { if (num==1) return 1; return factorial(num-1)*num; // recursive call }
25
2036
by: Andy B | last post by:
How hard/easy is it to use/learn VB compared to c#?
0
7269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7177
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7559
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.