Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing a number of power of 2 into INT field
Message
 
 
To
09/06/2017 16:13:07
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01651872
Message ID:
01651886
Views:
154
>The others gave you the number answer; to calculate this, you would solve for n in the below formula:
>
>2**n = 2,147,483,647
>LOG(2**n) = LOG(2,147,483,647) ; take the log value of both sides of the equation
>n*LOG(2) = LOG(2,147,483,647) ; the power can be moved to be multiplied as shown
>n = LOG(2,147,483,647) / LOG(2) ; now divide each side by LOG(2)
>n = 30.999999999\
>
>2**31 equals 2,147,483,648; so any number less than the power of 2**31 could be stored; or the maximum int power is 30.

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform