**Tag:**Int

Posts of Tag: Int

## Java - How to avoid loss of precision during divide and cast to int?

I have a situation where I need to find out how many times an int goes into a decimal, but in certain cases, I'm losing precision. Here is the method: public int test(double decimalAmount, int divisor) { ret...Learn MoreJavaPrecisionIntCasting## Java int to String - Integer.toString(i) vs new Integer(i).toString()

Sometimes java puzzles me. I have a huge amount of int initializations to make. What's the real difference? Integer.toString(i) new Integer(i).toString() ...Learn MoreStringJavaInt## Convert to a urllib.request to an integer

Am I able to convert the value us_price into an integer after the following: import urllib.request page = urllib.request.urlopen ("http://au.finance.yahoo.com/q?s=AUDUSD=X") text = page.read().decode("utf8") ...Learn MorePythonInturllib## Python get least significant digits from a float (without using string operations)

Assuming I have the float 12345.6789 and I want to get the six least significant digits (i.e. 45.6789) as an int (i.e. 456789) using bit operations in python (v. 2.6). How do I do that? Thanks PS I do not want ...Learn MorePythonIntfloating-pointbit-manipulation## First python screen scraping and smtp script won't evaluate properly

Here's my script with the personal bits scrubbed. import urllib, urllib2, cookielib cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) resp3 = opener.open('https://www.my...Learn MorePythonIntSmtpliburllib2## What is the maximum float in Python?

I think the maximum integer in python is available by calling sys.maxint. What is the maximum float or long in Python?...Learn MorePythonIntmaxlong-integer## How to convert str to int and add them together?

I've spent the last 2 hours trying to find a solution for this and came up with nothing. So either this is not possible or its so basic that no one write about this. Basically I have 2 strings that both equal n...Learn MorePythonStringIntAddconcatenation## How to create FILETIME in Win32?

I have a value __int64 that is a 64-bit FILETIME value. FILETIME has a dwLowDateTime and dwHighDateTime. When I try to assign a __int64 to a FILETIME I get a C2440. How do I assign the __int64 to the FILETIME? ...Learn MoreIntwinapifiletime## Explain the float - int problem in factorization

I am missing here the technical word but the problem here is either to change int to float or float to int. def factorize(n): def isPrime(n): return not [x for x in range(2,int(math.sqrt(n))) ...Learn MorePythonIntfloating-pointfactorization## Python, len, and size of ints

So, cPython (2.4) has some interesting behaviour when the length of something gets near to 1<<32 (the size of an int). r = xrange(1<<30) assert len(r) == 1<<30 is fine, but:...Learn MorePythonInt## Haskell converting Float to Int

I'm still new and trying to create a list for use in a function and want to keep it as small as possible which happens to be logBase x y. but I'm having trouble getting logBase into something I can use in this ...Learn MoreHaskellIntfloating-point## Python: How to convert a list of dictionaries' values into int/float from string?

I have a list of dictionaries as follows: list = [ { 'a':'1' , 'b':'2' , 'c':'3' }, { 'd':'4' , 'e':'5' , 'f':'6' } ] How do I convert the values of each dictionary inside the list to int/float? So it becomes:...Learn MorePythonStringDictionarylistInt