Thread
:
[C#,Math] Anyone think they can do this better?
View Single Post
Reply
Posted 2010-12-14, 10:48 AM in reply to
WetWired
's post starting
"if(intNumber==0)return 0; int mag;..."
Really, you could use a log 2 operation then take the integer part instead of using the for loop, but then you may have to deal with floating point precision issues. That, along with swapping the left shift with an exponent operation would make the solution entirely mathmatical
Profile
PM
WWW
Search
WetWired