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
path: root/intern
diff options
context:
space:
mode:
authorlazydodo <github@lazydodo.com>2017-05-07 18:16:14 +0300
committerlazydodo <github@lazydodo.com>2017-05-07 18:16:14 +0300
commitc9451f1cff4403855d5a77c15cfd428e0a9ebe87 (patch)
tree6549781395d4fe97789646790ab92e41abbd704b /intern
parent3cd27374ee53bc2ae3fd08b0b73c0a3118f81020 (diff)
[Cycles] Fix math problems in safe_logf
log(0) is undefined and should not have been included log(1) == 0, dividing by zero is not recommended
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/util/util_math.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 12abd8e201e..b719640b19c 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -492,17 +492,17 @@ ccl_device float safe_powf(float a, float b)
return compatible_powf(a, b);
}
-ccl_device float safe_logf(float a, float b)
+ccl_device float safe_divide(float a, float b)
{
- if(UNLIKELY(a < 0.0f || b < 0.0f))
- return 0.0f;
-
- return logf(a)/logf(b);
+ return (b != 0.0f)? a/b: 0.0f;
}
-ccl_device float safe_divide(float a, float b)
+ccl_device float safe_logf(float a, float b)
{
- return (b != 0.0f)? a/b: 0.0f;
+ if(UNLIKELY(a <= 0.0f || b <= 0.0f))
+ return 0.0f;
+
+ return safe_divide(logf(a),logf(b));
}
ccl_device float safe_modulo(float a, float b)