MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Formatting BaseForm Output

  • To: mathgroup at
  • Subject: [mg39471] Re: Formatting BaseForm Output
  • From: Paul Abbott <paul at>
  • Date: Mon, 17 Feb 2003 18:17:14 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <b1agg2$pil$>
  • Sender: owner-wri-mathgroup at

In article <b1agg2$pil$1 at>,
 "Ersek, Ted R" <ErsekTR at> wrote:

> Evaluate the following in Mathematica  
> In[1]:=
>     BaseForm[3914, 16]
> and the output looks like  (f4a  with 16 for a subscript).
> What if you wanted the output above formatted as one of the following
>    0xf4a,  0x0f4a,  0xF4A, 0x0F4A   which are often used by programmers. 

Here's a hack using the fact the built-in BaseForm relies on 


   SubscriptBox[a_, "\"16\""] := 
      StringJoin["0x", StringDrop[StringDrop[a, 1], -1]]


   BaseForm[3914, 16]


Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at 

  • Prev by Date: Re: operate a matrix of derivations
  • Next by Date: Re: Mathematica and LaTeX
  • Previous by thread: Analog Insydes developer resources
  • Next by thread: Animation to QuickTime Movie? (EMERGENCY)