2
0
Эх сурвалжийг харах

Added missing brl.math sources

woollybah 5 жил өмнө
parent
commit
f8b5c31c5e

+ 173 - 0
mod/brl.mod/math.mod/bbMath.h

@@ -0,0 +1,173 @@
+#include <math.h>
+
+#define RAD_TO_DEG 57.2957795130823208767981548141052
+#define DEG_TO_RAD 0.0174532925199432957692369076848861
+
+#ifndef __STDC_VERSION__
+	#define __STDC_VERSION__ 0
+#endif
+
+
+#if __STDC_VERSION__ >= 199901L
+
+inline int bbIsNan( double x ){
+	return isnan(x) ? 1 : 0;
+}
+inline int bbIsInf( double x ){
+	return isinf(x) ? 1 : 0;
+}
+inline double bbSqr( double x ){
+	return sqrt( x );
+}
+inline double bbSin( double x ){
+	return sin( x*DEG_TO_RAD );
+}
+inline double bbCos( double x ){
+	return cos( x*DEG_TO_RAD );
+}
+inline double bbTan( double x ){
+	return tan( x*DEG_TO_RAD );
+}
+inline double bbASin( double x ){
+	return asin( x ) * RAD_TO_DEG;
+}
+inline double bbACos( double x ){
+	return acos( x ) * RAD_TO_DEG;
+}
+inline double bbATan( double x ){
+	return atan( x ) * RAD_TO_DEG;
+}
+inline double bbATan2( double y,double x ){
+	return atan2( y,x ) * RAD_TO_DEG;
+}
+inline double bbSinh( double x ){
+	return sinh( x );
+}
+inline double bbCosh( double x ){
+	return cosh( x );
+}
+inline double bbTanh( double x ){
+	return tanh( x );
+}
+inline double bbExp( double x ){
+	return exp( x );
+}
+inline double bbFloor( double x ){
+	return floor( x );
+}
+inline double bbLog( double x ){
+	return log(x);
+}
+inline double bbLog10( double x ){
+	return log10(x);
+}
+inline double bbCeil( double x ){
+	return ceil( x );
+}
+inline double bbRound( double x ){
+	return round( x );
+}
+inline double bbTrunc( double x ){
+	return trunc( x );
+}
+
+#define RAD_TO_DEGF 57.2957795
+#define DEG_TO_RADF 0.0174532
+
+inline float bbSqrf( float x ){
+	return sqrtf( x );
+}
+inline float bbSinf( float x ){
+	return sinf( x*DEG_TO_RADF );
+}
+inline float bbCosf( float x ){
+	return cosf( x*DEG_TO_RADF );
+}
+inline float bbTanf( float x ){
+	return tanf( x*DEG_TO_RADF );
+}
+inline float bbASinf( float x ){
+	return asinf( x ) * RAD_TO_DEGF;
+}
+inline float bbACosf( float x ){
+	return acosf( x ) * RAD_TO_DEGF;
+}
+inline float bbATanf( float x ){
+	return atanf( x ) * RAD_TO_DEGF;
+}
+inline float bbATan2f( float y,float x ){
+	return atan2f( y,x ) * RAD_TO_DEGF;
+}
+inline float bbSinhf( float x ){
+	return sinhf( x );
+}
+inline float bbCoshf( float x ){
+	return coshf( x );
+}
+inline float bbTanhf( float x ){
+	return tanhf( x );
+}
+inline float bbExpf( float x ){
+	return expf( x );
+}
+inline float bbFloorf( float x ){
+	return floorf( x );
+}
+inline float bbLogf( float x ){
+	return logf(x);
+}
+inline float bbLog10f( float x ){
+	return log10f(x);
+}
+inline float bbCeilf( float x ){
+	return ceilf( x );
+}
+inline float bbRoundf( float x ){
+	return roundf( x );
+}
+inline float bbTruncf( float x ){
+	return truncf( x );
+}
+#else
+int bbIsNan( double x );
+int bbIsInf( double x );
+double bbSqr( double x );
+double bbSin( double x );
+double bbCos( double x );
+double bbTan( double x );
+double bbASin( double x );
+double bbACos( double x );
+double bbATan( double x );
+double bbATan2( double y,double x );
+double bbSinh( double x );
+double bbCosh( double x );
+double bbTanh( double x );
+double bbExp( double x );
+double bbFloor( double x );
+double bbLog( double x );
+double bbLog10( double x );
+double bbCeil( double x );
+double bbRound( double x );
+double bbTrunc( double x );
+
+int bbIsNanf( float x );
+int bbIsInff( float x );
+float bbSqrf( float x );
+float bbSinf( float x );
+float bbCosf( float x );
+float bbTanf( float x );
+float bbASinf( float x );
+float bbACosf( float x );
+float bbATanf( float x );
+float bbATan2f( float y,float x );
+float bbSinhf( float x );
+float bbCoshf( float x );
+float bbTanhf( float x );
+float bbExpf( float x );
+float bbFloorf( float x );
+float bbLogf( float x );
+float bbLog10f( float x );
+float bbCeilf( float x );
+float bbRoundf( float x );
+float bbTruncf( float x );
+#endif

+ 189 - 0
mod/brl.mod/math.mod/math.c

@@ -0,0 +1,189 @@
+
+#include <bbMath.h>
+
+#define RAD_TO_DEG 57.2957795130823208767981548141052
+#define DEG_TO_RAD 0.0174532925199432957692369076848861
+
+#if __STDC_VERSION__ >= 199901L
+extern int bbIsNan( double x );
+extern int bbIsInf( double x );
+extern double bbSqr( double x );
+extern double bbSin( double x );
+extern double bbCos( double x );
+extern double bbTan( double x );
+extern double bbASin( double x );
+extern double bbACos( double x );
+extern double bbATan( double x );
+extern double bbATan2( double y,double x );
+extern double bbSinh( double x );
+extern double bbCosh( double x );
+extern double bbTanh( double x );
+extern double bbExp( double x );
+extern double bbFloor( double x );
+extern double bbLog( double x );
+extern double bbLog10( double x );
+extern double bbCeil( double x );
+extern double bbRound( double x );
+extern double bbTrunc( double x );
+
+extern int bbIsNanf( float x );
+extern int bbIsInff( float x );
+extern float bbSqrf( float x );
+extern float bbSinf( float x );
+extern float bbCosf( float x );
+extern float bbTanf( float x );
+extern float bbASinf( float x );
+extern float bbACosf( float x );
+extern float bbATanf( float x );
+extern float bbATan2f( float y,float x );
+extern float bbSinhf( float x );
+extern float bbCoshf( float x );
+extern float bbTanhf( float x );
+extern float bbExpf( float x );
+extern float bbFloorf( float x );
+extern float bbLogf( float x );
+extern float bbLog10f( float x );
+extern float bbCeilf( float x );
+extern float bbRoundf( float x );
+extern float bbTruncf( float x );
+
+#else
+
+int bbIsNan( double x ){
+	return isnan(x) ? 1 : 0;
+}
+int bbIsInf( double x ){
+	return isinf(x) ? 1 : 0;
+}
+double bbSqr( double x ){
+	return sqrt( x );
+}
+double bbSin( double x ){
+	return sin( x*DEG_TO_RAD );
+}
+double bbCos( double x ){
+	return cos( x*DEG_TO_RAD );
+}
+double bbTan( double x ){
+	return tan( x*DEG_TO_RAD );
+}
+double bbASin( double x ){
+	return asin( x ) * RAD_TO_DEG;
+}
+double bbACos( double x ){
+	return acos( x ) * RAD_TO_DEG;
+}
+double bbATan( double x ){
+	return atan( x ) * RAD_TO_DEG;
+}
+double bbATan2( double y,double x ){
+	return atan2( y,x ) * RAD_TO_DEG;
+}
+double bbSinh( double x ){
+	return sinh( x );
+}
+double bbCosh( double x ){
+	return cosh( x );
+}
+double bbTanh( double x ){
+	return tanh( x );
+}
+double bbExp( double x ){
+	return exp( x );
+}
+double bbFloor( double x ){
+	return floor( x );
+}
+double bbLog( double x ){
+	return log(x);
+}
+double bbLog10( double x ){
+	return log10(x);
+}
+double bbCeil( double x ){
+	return ceil( x );
+}
+double bbRound( double x ){
+	return round( x );
+}
+double bbTrunc( double x ){
+	return trunc( x );
+}
+
+#define RAD_TO_DEGF RAD_TO_DEG
+#define DEG_TO_RADF DEG_TO_RAD
+
+#define sqrtf sqrt
+#define sinf sin
+#define cosf cos
+#define tanf tan
+#define asinf asin
+#define acosf acos
+#define atanf atan
+#define atan2f atan2
+#define sinhf sinh
+#define coshf cosh
+#define tanhf tanh
+#define expf exp
+#define floorf floor
+#define logf log
+#define log10f log10
+#define ceilf ceil
+#define roundf round
+#define truncf trunc
+
+float bbSqrf( float x ){
+	return sqrtf( x );
+}
+float bbSinf( float x ){
+	return sinf( x*DEG_TO_RADF );
+}
+float bbCosf( float x ){
+	return cosf( x*DEG_TO_RADF );
+}
+float bbTanf( float x ){
+	return tanf( x*DEG_TO_RADF );
+}
+float bbASinf( float x ){
+	return asinf( x ) * RAD_TO_DEGF;
+}
+float bbACosf( float x ){
+	return acosf( x ) * RAD_TO_DEGF;
+}
+float bbATanf( float x ){
+	return atanf( x ) * RAD_TO_DEGF;
+}
+float bbATan2f( float y,float x ){
+	return atan2f( y,x ) * RAD_TO_DEGF;
+}
+float bbSinhf( float x ){
+	return sinhf( x );
+}
+float bbCoshf( float x ){
+	return coshf( x );
+}
+float bbTanhf( float x ){
+	return tanhf( x );
+}
+float bbExpf( float x ){
+	return expf( x );
+}
+float bbFloorf( float x ){
+	return floorf( x );
+}
+float bbLogf( float x ){
+	return logf(x);
+}
+float bbLog10f( float x ){
+	return log10f(x);
+}
+float bbCeilf( float x ){
+	return ceilf( x );
+}
+float bbRoundf( float x ){
+	return roundf( x );
+}
+float bbTruncf( float x ){
+	return truncf( x );
+}
+#endif