On Mar 30, 1:52 pm, MRAB wrote:
> John Nagle wrote:
> > aditya wrote:
> >> On Mar 30, 10:49 am, Raymond Hettinger wrote:
> >>> On Mar 30, 8:13 am, aditya wrote:
>
> To get the decimal representation of a binary number, I can just do
> this:
> int('11',2) # returns 3
> But dec
Chris
On Tue, Mar 30, 2010 at 11:14 AM, John Nagle wrote:
> aditya wrote:
>
>> On Mar 30, 10:49 am, Raymond Hettinger wrote:
>>
>>> On Mar 30, 8:13 am, aditya wrote:
>>>
>>> To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But d
John Nagle wrote:
aditya wrote:
On Mar 30, 10:49 am, Raymond Hettinger wrote:
On Mar 30, 8:13 am, aditya wrote:
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5,
On 2010-03-30, John Nagle wrote:
> Hex floats are useful because you can get a string representation of
> the exact value of a binary floating point number. It should always
> be the case that
>
>float.fromhex(float.hex(x)) == x
Until you try running your program on a machine that repre
On Mar 30, 10:49 am, Raymond Hettinger wrote:
> On Mar 30, 8:13 am, aditya wrote:
>
> > To get the decimal representation of a binary number, I can just do
> > this:
>
> > int('11',2) # returns 3
>
> > But decimal binary numbers throw a ValueError:
>
> > int('1.1',2) # should return 1.5, throws e
aditya wrote:
On Mar 30, 10:49 am, Raymond Hettinger wrote:
On Mar 30, 8:13 am, aditya wrote:
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5, throws error instea
On Tue, 30 Mar 2010 08:28:50 -0700, Patrick Maupin wrote:
> On Mar 30, 10:13 am, aditya wrote:
>> To get the decimal representation of a binary number, I can just do
>> this:
>>
>> int('11',2) # returns 3
>>
>> But decimal binary numbers throw a ValueError:
>>
>> int('1.1',2) # should return 1.5,
On Mar 30, 10:49 am, Raymond Hettinger wrote:
> On Mar 30, 8:13 am, aditya wrote:
>
> > To get the decimal representation of a binary number, I can just do
> > this:
>
> > int('11',2) # returns 3
>
> > But decimal binary numbers throw a ValueError:
>
> > int('1.1',2) # should return 1.5, throws e
On Mar 30, 10:37 am, Benjamin Kaplan wrote:
> On Tue, Mar 30, 2010 at 11:13 AM, aditya wrote:
> > To get the decimal representation of a binary number, I can just do
> > this:
>
> > int('11',2) # returns 3
>
> > But decimal binary numbers throw a ValueError:
>
> > int('1.1',2) # should return 1.5
aditya wrote:
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5, throws error instead.
Is this by design? It seems to me that this is not the correct
behavior.
int
Doh!
Well the problem is that int's are integers. So yeah, you can't even do
that with normal value "int ('2.1')" will also throw an error. And
floats don't support radix conversion, because no-one really writes
numbers that way. (At least computer programmers...)
On 3/30/2010 11:43 AM, Shash
On Mar 30, 8:13 am, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me that this
The conversion is not supported for decimal integers AFAIK, however
'0b123.456' is always valid. I guess you can always get a decimal number
convertor onto Python-recipes
On Tue, Mar 30, 2010 at 9:05 PM, Grant Olson wrote:
> On 3/30/2010 11:13 AM, aditya wrote:
> > To get the decimal represent
On Tue, Mar 30, 2010 at 11:13 AM, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems t
On 3/30/2010 11:13 AM, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me tha
On Mar 30, 10:13 am, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me that thi
decimal binary number is not included AFAIK
On Tue, Mar 30, 2010 at 8:43 PM, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws err
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5, throws error instead.
Is this by design? It seems to me that this is not the correct
behavior.
- Aditya
--
http://
[EMAIL PROTECTED] wrote:
Hello. New to using Python. Python automatically round off watver i
calculate using the floor function. How wud i make the exact value
appear?
Tried out fabs() in the math library but still confused. Cud some1
elaborate on it.
[python]
---help(math.floor):
Help on buil
[EMAIL PROTECTED] wrote:
Hello. New to using Python. Python automatically round off watver i
calculate using the floor function. How wud i make the exact value
appear?
Tried out fabs() in the math library but still confused. Cud some1
elaborate on it.
If you're working with integers, the resul
Hello. New to using Python. Python automatically round off watver i
calculate using the floor function. How wud i make the exact value
appear?
Tried out fabs() in the math library but still confused. Cud some1
elaborate on it.
--
http://mail.python.org/mailman/listinfo/python-list
21 matches
Mail list logo