diff options
-rw-r--r-- | intern/cycles/util/util_math.h | 14 |
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) |