aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/math/libkvimath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/math/libkvimath.cpp')
-rw-r--r--src/modules/math/libkvimath.cpp64
1 files changed, 27 insertions, 37 deletions
diff --git a/src/modules/math/libkvimath.cpp b/src/modules/math/libkvimath.cpp
index af7152c96..62b7cda75 100644
--- a/src/modules/math/libkvimath.cpp
+++ b/src/modules/math/libkvimath.cpp
@@ -31,12 +31,12 @@
// Workaround for lost isnan and isinf definitions after
// inclusion of iostream.h on some MacOS X systems
#ifdef Q_OS_MACX
- #ifndef isnan
- extern "C" int isnan (double);
- #endif
- #ifndef isinf
- extern "C" int isinf (double);
- #endif
+ #ifndef isnan
+ extern "C" int isnan (double);
+ #endif
+ #ifndef isinf
+ extern "C" int isinf (double);
+ #endif
#endif
#define MATH_KVS_1PARAM_FUNCTION(__fncname,__paramname,__mathcallname) \
@@ -54,40 +54,31 @@ static bool __fncname(KviKvsModuleFunctionCall * c) \
// dobbiamo testare meglio, i risultati.
static double cbrt(double x)
{
- if (x > 0.0)
- return pow(x, 1.0/3.0);
- else
- return -pow(-x, 1.0/3.0);
+ if (x > 0.0) return pow(x, 1.0/3.0);
+ else return -pow(-x, 1.0/3.0);
}
+
static int isinf (double d) {
- int expon = 0;
- double val = frexp (d, &expon);
- if (expon == 1025) {
- if (val == 0.5) {
- return 1;
- } else if (val == -0.5) {
- return -1;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
+ int expon = 0;
+ double val = frexp (d, &expon);
+ if (expon == 1025) {
+ if (val == 0.5) return 1;
+ else if (val == -0.5) return -1;
+ else return 0;
+ } else {
+ return 0;
+ }
}
static int isnan (double d) {
- int expon = 0;
- double val = frexp (d, &expon);
- if (expon == 1025) {
- if (val == 0.5) {
- return 0;
- } else if (val == -0.5) {
- return 0;
- } else {
- return 1;
- }
- } else {
- return 0;
- }
+ int expon = 0;
+ double val = frexp (d, &expon);
+ if (expon == 1025) {
+ if (val == 0.5) return 0;
+ else if (val == -0.5) return 0;
+ else return 1;
+ } else {
+ return 0;
+ }
}
#endif
/*
@@ -442,7 +433,6 @@ static bool math_kvs_fnc_e(KviKvsModuleFunctionCall * c)
#endif
static bool math_module_init(KviModule * m)
{
-
KVSM_REGISTER_FUNCTION(m,"sin",math_kvs_fnc_sin);
KVSM_REGISTER_FUNCTION(m,"cos",math_kvs_fnc_cos);
KVSM_REGISTER_FUNCTION(m,"tan",math_kvs_fnc_tan);