Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.python

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-19-2012, 07:54 PM
Edward C. Jones
Guest
 
Posts: n/a
Default Re: Python equivalent to the "A" or "a" output conversions in C

On 06/19/2012 12:41 PM, Hemanth H.M wrote:

> >>> float.hex(x)

> '0x1.5000000000000p+3'
>

Some days I don't ask the brightest questions. Suppose x was a numpy
floating scalar (types numpy.float16, numpy.float32, numpy.float64, or
numpy.float128). Is there an easy way to write x in
binary or hex?



Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 06-19-2012, 08:11 PM
jmfauth
Guest
 
Posts: n/a
Default Re: Python equivalent to the "A" or "a" output conversions in C

On Jun 19, 9:54*pm, "Edward C. Jones" <edcjo...@comcast.net> wrote:
> On 06/19/2012 12:41 PM, Hemanth H.M wrote:
>
> > >>> float.hex(x)

> > '0x1.5000000000000p+3'

>
> Some days I don't ask the brightest questions. *Suppose x was a numpy
> floating scalar (types numpy.float16, numpy.float32, numpy.float64, or
> numpy.float128). *Is there an easy way to write x in
> binary or hex?


I'm not aware about a buitin fct. May be the module
struct — Interpret bytes as packed binary data can help.

jmf
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 10:19 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.