warning C4756: overflow in constant arithmetic in MC++ app using Double::NaN 
Author Message
 warning C4756: overflow in constant arithmetic in MC++ app using Double::NaN

If I write a function in MC++ like

Double foo()
{
    return Double::NaN;

Quote:
}

I get the compilation warning
warning C4756: overflow in constant arithmetic

Can I safely ignore this warning? Is there a way around this problem?

/Thomas

--
Thomas Olsson, Vinga System AB, Sweden
http://www.*-*-*.com/
(Reply adress is invalid to avoid spam)



Sat, 13 Aug 2005 17:32:05 GMT  
 warning C4756: overflow in constant arithmetic in MC++ app using Double::NaN
Hi,

Double::NaN is constant declared as  (double)0.0 / (double)0.0. Its binary
format is 0xFFF8000000000000. It is overflow for double data type. The
compiler reports the warning. When the code runs, it will return NaN as it
is. It is saft to ignore the warning if you know you actually want to
return NaN.

You can just disable the warning around the function. It should be the
simplest way to avoid the warning..

I hope this helps. If you have any questions, please reply to this post.

Best Regards,

Jun Su
Microsoft Support

---
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

| Subject: warning C4756: overflow in constant arithmetic in MC++ app using
Double::NaN
| Date: Tue, 25 Feb 2003 10:32:05 +0100
|
| If I write a function in MC++ like
|
| Double foo()
| {
|     return Double::NaN;
| }
|
| I get the compilation warning
| warning C4756: overflow in constant arithmetic
|
| Can I safely ignore this warning? Is there a way around this problem?
|
| /Thomas
|
| --
| Thomas Olsson, Vinga System AB, Sweden
| http://www.vinga.se
| (Reply adress is invalid to avoid spam)
|
|
|



Mon, 15 Aug 2005 11:52:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. warning C4056: overflow in floating-point constant arithmetic

2. Problem with Double.IsNan() and Double.Nan

3. Comparing double NAN with double INF is not IEEE compliant

4. Security for mc++ apps

5. finding app path in mc++ application ?

6. Constant for NaN

7. Overflow in arithmetic operations

8. How to avoid arithmetic overflow?

9. arithmetic overflow

10. Assigning nan to a double

11. long doubles and NaN

12. Check if a float/double is NaN

 

 
Powered by phpBB® Forum Software