diff options
author | Marius Kintel <marius@kintel.net> | 2013-08-21 05:40:25 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-08-21 05:40:25 (GMT) |
commit | 7db45a878b29788ff846eac7dedede294836a1bc (patch) | |
tree | f9e01f3aaf86006d195f7bc58488150c7e619009 /src/mathc99.cc | |
parent | a7396cc36fbd2269bc75b0632e659dd05149259b (diff) | |
parent | f25ad73ea5fcc2abcf92d7cd1fbe44c072acd1f4 (diff) |
Merge branch 'master' of github.com:openscad/openscad
Diffstat (limited to 'src/mathc99.cc')
-rw-r--r-- | src/mathc99.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mathc99.cc b/src/mathc99.cc index 335446e..13f4c64 100644 --- a/src/mathc99.cc +++ b/src/mathc99.cc @@ -3,8 +3,12 @@ #ifdef WIN32
#include <algorithm>
+double trunc(double a) {
+ return (a >= 0) ? floor(a) : ceil(a);
+}
+
double round(double a) {
- return a > 0 ? floor(a+0.5) : ceil(a-0.5);
+ return a < 0 ? ceil(a - 0.5f) : floor(a + 0.5f);
}
float fmin(float a, float b) {
|