1 | #ifndef _NONSTD_MATH_H_ |
---|
2 | #define _NONSTD_MATH_H_ |
---|
3 | |
---|
4 | |
---|
5 | #ifdef _MSC_VER |
---|
6 | #define _USE_MATH_DEFINES //after this is defined, the next #include <math.h> or <cmath> will define M_PI etc. |
---|
7 | #include <math.h> //w vc2008 dzia³a³o tu <cmath>, ale w vc2010 juz nie bo "co" (jaki inny .h stl'a?) includuje wczeniej <cmath> bez _USE_MATH_DEFINES, a <cmath> includuje <math.h> (ale tylko raz bo ma "include guards" jak kazdy .h) |
---|
8 | #else //m.in. __BORLANDC__ |
---|
9 | #include <math.h> |
---|
10 | #endif |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | //support for random numbers: |
---|
15 | |
---|
16 | #include "stdlib.h" |
---|
17 | |
---|
18 | #ifdef __BORLANDC__ |
---|
19 | #define rnd01 ((double)((double)_lrand()/(double)(LRAND_MAX+1))) |
---|
20 | //#define rnd01 ((double)((double)rand()/(RAND_MAX+1))) |
---|
21 | #define rnd0N(num) ((double)((num)*rnd01)) |
---|
22 | #define randomN(num) random(num) //uses _lrand |
---|
23 | #else |
---|
24 | |
---|
25 | //#define FLOATRAND |
---|
26 | #ifdef FLOATRAND |
---|
27 | #define randomN(x) ((int)((x)*drand48())) |
---|
28 | #define rnd01 (drand48()) |
---|
29 | #define rnd0N(x) (drand48()*(x)) |
---|
30 | #else |
---|
31 | #define rnd01 ((double)(rand()/(RAND_MAX+1.0))) |
---|
32 | #define rnd0N(x) ((x)*rnd01) |
---|
33 | #define randomN(x) ((int)rnd0N(x)) |
---|
34 | #endif |
---|
35 | #endif |
---|
36 | |
---|
37 | #ifdef SHP |
---|
38 | //#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" |
---|
39 | #define _isnan(a) isnan(a) |
---|
40 | #define isnan(a) false //...i isnan() tez sie nie linkuje |
---|
41 | #include <cstdlib> //RAND_MAX defined incorrectly |
---|
42 | #ifdef BADA_SIMULATOR //...but only in simulator libs |
---|
43 | #undef RAND_MAX |
---|
44 | #define RAND_MAX 32768 //...this is the actual value used by rand() |
---|
45 | #endif |
---|
46 | #endif |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | #endif |
---|
51 | |
---|