Changeset 1275 for cpp/common/nonstd_math.h
- Timestamp:
- 09/09/23 15:16:31 (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/nonstd_math.h
r1253 r1275 9 9 #ifdef _MSC_VER 10 10 #define _USE_MATH_DEFINES //after this is defined, the next #include <math.h> or <cmath> will define M_PI etc. 11 #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)11 #include <math.h> //w vc2008 dzia�a�o tu <cmath>, ale w vc2010 juz nie bo "co�" (jaki� inny .h stl'a?) includuje wcze�niej <cmath> bez _USE_MATH_DEFINES, a <cmath> includuje <math.h> (ale tylko raz bo ma "include guards" jak kazdy .h) 12 12 #include <float.h> 13 13 //#define isnan(x) _isnan(x) //since 2014 we use std::isnan() … … 69 69 70 70 #if defined SHP 71 //#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"71 //#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" 72 72 #define isnan(x) false //isnan() sie nie linkuje 73 73 #define finite(x) true //j.w. … … 79 79 #endif 80 80 81 #if defined LINUX || defined TIZEN || defined __ANDROID__ 82 #include <fenv.h> 83 #endif 84 85 namespace fpExcept 86 { 81 87 //handling floating point exceptions 82 void fpExceptInit(); //call once, before ...Enable/Disable 83 void fpExceptEnable(); 84 void fpExceptDisable(); 88 #if defined LINUX || defined TIZEN || defined __ANDROID__ 89 //fenv.h values 90 static constexpr unsigned int FPEX_DIV0 = FE_DIVBYZERO; 91 static constexpr unsigned int FPEX_INVALID = FE_INVALID; 92 static constexpr unsigned int FPEX_OVERFLOW = FE_OVERFLOW; 93 #elif defined IPHONE 94 // (not implemented but these constants are still needed) 95 static constexpr unsigned int FPEX_DIV0 = 0; 96 static constexpr unsigned int FPEX_INVALID = 0; 97 static constexpr unsigned int FPEX_OVERFLOW = 0; 98 #else 99 //_control87() values 100 static constexpr unsigned int FPEX_DIV0 = EM_ZERODIVIDE; 101 static constexpr unsigned int FPEX_INVALID = EM_INVALID; 102 static constexpr unsigned int FPEX_OVERFLOW = EM_OVERFLOW; 103 #endif 104 extern int wanted_exceptions; 105 106 void init(); //call once, before ...Enable/Disable 107 void enable(); 108 void disable(); 109 }; 85 110 86 111 // std::lerp can be used since C++20 (and has some guaranteed properties probably better than this basic formula) but apparently it is not a template
Note: See TracChangeset
for help on using the changeset viewer.