summaryrefslogtreecommitdiff
path: root/src/elementaryFunctions/round/crounds.c
diff options
context:
space:
mode:
authortorset2009-02-25 13:38:56 +0000
committertorset2009-02-25 13:38:56 +0000
commit0972fda53894a22215a30f8aa83da5c7de3d129e (patch)
treeb58540fe2c05202684f8ef059b28a9e07b2cd8bf /src/elementaryFunctions/round/crounds.c
parent0a9569e577e3faf3ff87b0c4994e17281d194377 (diff)
downloadscilab2c-0972fda53894a22215a30f8aa83da5c7de3d129e.tar.gz
scilab2c-0972fda53894a22215a30f8aa83da5c7de3d129e.tar.bz2
scilab2c-0972fda53894a22215a30f8aa83da5c7de3d129e.zip
Add round files
Diffstat (limited to 'src/elementaryFunctions/round/crounds.c')
-rw-r--r--src/elementaryFunctions/round/crounds.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/elementaryFunctions/round/crounds.c b/src/elementaryFunctions/round/crounds.c
index dbf20c83..598fd16b 100644
--- a/src/elementaryFunctions/round/crounds.c
+++ b/src/elementaryFunctions/round/crounds.c
@@ -14,8 +14,16 @@
#include "round.h"
floatComplex crounds(floatComplex x) {
- int roundReal = (int)creals(x);
- int roundImag = (int)cimags(x);
+ int roundReal;
+ int roundImag;
+
+ if (creals(x)>=0) roundReal = (int)(creals(x)+0.5);
+ else roundReal = (int)(creals(x)-0.5);
+
+
+
+ if (cimags(x)>=0) roundImag = (int)(cimags(x)+0.5);
+ else roundImag = (int)(cimags(x)-0.5);
return FloatComplex((float)roundReal, (float)roundImag);
}