Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-03-27 05:16:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-27 05:17:30 +0300
commit9ba948a4859da3308033fa6dc54f74433d7e6a21 (patch)
tree0bd6e95eb59d9af03aa32d925c68e1cbebecc246 /source/blender/blenlib/intern/math_base.c
parent337eb8c1de4c57c34520b467d79779153335eecb (diff)
Cleanup: style, use braces for blenlib
Diffstat (limited to 'source/blender/blenlib/intern/math_base.c')
-rw-r--r--source/blender/blenlib/intern/math_base.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c
index c4b01729a6d..ed75cac2d0c 100644
--- a/source/blender/blenlib/intern/math_base.c
+++ b/source/blender/blenlib/intern/math_base.c
@@ -53,8 +53,9 @@ double double_round(double x, int ndigits)
pow2 = 1.0;
y = (x * pow1) * pow2;
/* if y overflows, then rounded value is exactly x */
- if (!isfinite(y))
+ if (!isfinite(y)) {
return x;
+ }
}
else {
pow1 = pow(10.0, (double)-ndigits);
@@ -63,14 +64,17 @@ double double_round(double x, int ndigits)
}
z = round(y);
- if (fabs(y - z) == 0.5)
+ if (fabs(y - z) == 0.5) {
/* halfway between two integers; use round-half-even */
z = 2.0 * round(y / 2.0);
+ }
- if (ndigits >= 0)
+ if (ndigits >= 0) {
z = (z / pow2) / pow1;
- else
+ }
+ else {
z *= pow1;
+ }
/* if computation resulted in overflow, raise OverflowError */
return z;