Formatting BaseForm Output
- To: mathgroup at smc.vnet.net
- Subject: [mg39133] Formatting BaseForm Output
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Thu, 30 Jan 2003 01:07:40 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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. As far as I can tell it isn't possible to do that using BaseForm options (there are none), MakeBoxes or Format definitions. I could, without too much trouble, make my own function HexForm[n] that would compute the hex digits and format the output. It would just be more elegant to use the built-in BaseForm if possible. --- Thanks, Ted Ersek