sql - Significance of 1e8 in divisions -


I am trying to understand a small function call in SQL Server 2012. I tried to search it online but could not find much information.

The function is simple, its two values ​​are @value and @default, this function returns divx @default to both when @value is zero or 0, otherwise it will automatically be @ Returns the value.

This function is called in various SQL statements to avoid being divided by zero function. .

  Select col1 / divfix (col2,1e8)  

My question is, what 1e8 stands for here, and how to help overcome it Does divided by zero error?

means 10 ^ 8 (10 power 8), thus 100000000. This is a "power (10 , 8) "less for"

From a mathematical point of view, this "divide by 0" is not really a great way to handle IMHO.

Instead of using a small number (which makes some close to the calculus return '0), it is more understandable to use a few numbers (which give something close to infinity rather than a Nain / Failure But not at all ", as long as the last rounding is not equal to 0).


Comments

Popular posts from this blog

graphviz - size of node with shape=circle -

android - TCP sending with Unity -

properties - C#: How to set default value for a property in a partial class? -