Not using GCC-specific macro __FLT_MAX__
Created by: wangkuiyi
I noticed that we are using __FLT_MAX__
:
https://github.com/PaddlePaddle/Paddle/search?utf8=%E2%9C%93&q=%22__FLT_MAX__%22&type=
It doesn't look a good idea because __FLT_MAX__
is a GCC-specific predefined macro. If we are using another compiler other than GCC, it is probable that we don't have __FLT_MAX__
defined.
It seems to me that the solution could be using standard C library
#include <float.h>
printf("%f", FLT_MAX);
or the standard C++ library
#include <limits>
printf("%f", numeric_limits<float>::max());