overflow in flter.h (warning C4756)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

overflow in flter.h (warning C4756)

Mahmood Naderan

Hi,
In my program, I get these warnnings but I think they are independent of mine:
c:\program files\cgal-3.4-beta1\include\cgal\core\filter.h(180) : warning C4756: overflow in constant arithmetic
c:\program files\cgal-3.4-beta1\include\cgal\core\filter.h(159) : warning C4756: overflow in constant arithmetic

 

Although they are warnnings and can be ingnored, the first one points to this section:
  /// helper function (to avoid warning under some compilers)
  static double getDoubleInfty() {
    static double d = DBL_MAX;
    return 2*d;
  }

 
this function as it says is to avoid warnnings (!), but according to float.h in VC directory, the valuse of DBL_MAX is maximum inself:
#define DBL_MAX         1.7976931348623158e+308 /* max value */

 

So why should we return an overflowed value ?! The second warnning is also related to this function.

 
--------------------
Mahmood Naderan

Reply | Threaded
Open this post in threaded view
|

Re: overflow in flter.h (warning C4756)

Sylvain Pion
Administrator
Mahmood Naderan wrote:

> Hi,
> In my program, I get these warnnings but I think they are independent of
> mine:
> c:\program files\cgal-3.4-beta1\include\cgal\core\filter.h(180) :
> warning C4756: overflow in constant arithmetic
> c:\program files\cgal-3.4-beta1\include\cgal\core\filter.h(159) :
> warning C4756: overflow in constant arithmetic
>
>  
>
> Although they are warnnings and can be ingnored, the first one points to
> this section:
>   /// helper function (to avoid warning under some compilers)
>   static double getDoubleInfty() {
>     static double d = DBL_MAX;
>     return 2*d;
>   }
>  
> this function as it says is to avoid warnnings (!), but according to
> float.h in VC directory, the valuse of DBL_MAX is maximum inself:
> #define DBL_MAX         1.7976931348623158e+308 /* max value */
>
>  
>
> So why should we return an overflowed value ?! The second warnning is
> also related to this function.
DBL_MAX is the maximum *finite* value.  There is also the infinity,
which is what the funciton is trying to generate.

Maybe you can try to return CGAL::CGALi::infinity instead (from <CGAL/FPU.h>)?


Note that Core is not formally part of CGAL, and lacks active maintenance.

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/

smime.p7s (5K) Download Attachment