#ifndef _NONSTD_MATH_H_ #define _NONSTD_MATH_H_ #ifdef _MSC_VER #define _USE_MATH_DEFINES //after this is defined, the next #include or will define M_PI etc. #include //w vc2008 działało tu , ale w vc2010 juz nie bo "coś" (jakiś inny .h stl'a?) includuje wcześniej bez _USE_MATH_DEFINES, a includuje (ale tylko raz bo ma "include guards" jak kazdy .h) #else //m.in. __BORLANDC__ #include #endif //support for random numbers: #include "stdlib.h" #ifdef __BORLANDC__ #define rnd01 ((double)((double)_lrand()/(double)(LRAND_MAX+1))) //#define rnd01 ((double)((double)rand()/(RAND_MAX+1))) #define rnd0N(num) ((double)((num)*rnd01)) #define randomN(num) random(num) //uses _lrand #else //#define FLOATRAND #ifdef FLOATRAND #define randomN(x) ((int)((x)*drand48())) #define rnd01 (drand48()) #define rnd0N(x) (drand48()*(x)) #else #define rnd01 ((double)(rand()/(RAND_MAX+1.0))) #define rnd0N(x) ((x)*rnd01) #define randomN(x) ((int)rnd0N(x)) #endif #endif #ifdef SHP //#define __assert_func(a,b,c,d) 0 //Currently, we are sorry to inform you that assert() is not yet supported. We have considered your request for internal discussion. Na szczęście jest własna (byle by była, bo i tak zakładamy ze assert ktore przeciez dziala tylko w trybie debug nie jest potrzebne na bada) implementacja w "bada-assert.cpp" #define _isnan(a) isnan(a) #define isnan(a) false //...i isnan() tez sie nie linkuje #include //RAND_MAX defined incorrectly #ifdef BADA_SIMULATOR //...but only in simulator libs #undef RAND_MAX #define RAND_MAX 32768 //...this is the actual value used by rand() #endif #endif #endif