MSVC won't compile 'const float _demolition[]' because it uses 'divide by zero' while initializing

Hopefully we can use INFINITY and NAN for the relevant initializers ?
This commit is contained in:
John Emmas 2016-05-03 17:30:58 +01:00
parent a12288d9b5
commit dc1a2fbca7
2 changed files with 9 additions and 4 deletions

View file

@ -17,6 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <math.h>
#include <sys/time.h> #include <sys/time.h>
#include <regex.h> #include <regex.h>
#include <stdlib.h> #include <stdlib.h>
@ -1801,10 +1802,10 @@ static const float _demolition[] = {
4294967395.0f, /* 2^16 + 100 */ 4294967395.0f, /* 2^16 + 100 */
-4294967395.0f, -4294967395.0f,
HUGE, /* Big, non-inf number */ HUGE, /* Big, non-inf number */
1.f/0.f, /* +inf */ INFINITY, /* +inf */
-1.f/0.f, /* -inf */ -INFINITY, /* -inf */
-0.f/0.f, /* -nan */ -NAN, /* -nan */
0.f/0.f, /* nan */ NAN, /* nan */
0.0f, /* some silence to check for recovery */ 0.0f, /* some silence to check for recovery */
}; };

View file

@ -49,6 +49,10 @@
#define INFINITY HUGE_VAL #define INFINITY HUGE_VAL
#endif #endif
#ifndef NAN
#define NAN _NANCODE
#endif
// File access modes copied from unistd.h // File access modes copied from unistd.h
#define F_OK 0 #define F_OK 0
#define R_OK 4 #define R_OK 4