MathGroup Archive 1998

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

Search the Archive

Re: Numbers in arbitrary bases

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13790] Re: [mg13734] Numbers in arbitrary bases
  • From: MJE <evans.nospam at gte.net>
  • Date: Fri, 28 Aug 1998 04:18:16 -0400
  • Organization: None
  • References: <199808190538.BAA00630@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

In my computer programming work, I invariably use inferior tools to
convert between hex, decimal, and binary formats.  Actually, the little
calculator that comes with MS Windows under Accessories has this
capability in Scientific view mode.  It is easier for me than
Mathematica.

Using Mathematica to simulate computer math has another quirk, in that
an arbitrary hex number in 2's complement can be interpreted as signed
or unsigned, depending on the word size of interest.  It would be
convenient to tell Mathematica what is the word size of a given hex
number and then have it left-pad with zero bits or one bits as
appropriate.  When the word size is undefined, it is very hard to
manipulate hex numbers.  Each number can have its own word size (or
compiler type if you please).

Another problem with Mathematica is that there is no "number input"
widget.  This widget should be able to handle multiple bases whenever
it is developed.  I have written my own custom C++ code (MFC) for this
and it is not too hard.  My code does the left-padding stuff, i.e. if
you type 0xFF into a signed hex 16-bit field it assumes you mean
0xFFFF.  If the field type is unsigned, it assumes 0x00FF.

Mark

Remove ".nospam" to reply


Jon Prudhomme wrote:
> 
> Hello,
> 
>         I am looking for a way to work in arbitrary bases in Mathematica
> without having to use the base^^number and BaseForm[number,base]
> functions every time I wish to input or display a number.  Is there
> anyway to change Mathematica's 'default' base?
> 
>         Also, has anyone else had trouble getting the base^^number  function to
> work when base is an expression and not a number?



  • Prev by Date: Animations on mathematica
  • Next by Date: Function as an argument to a function
  • Previous by thread: Numbers in arbitrary bases
  • Next by thread: Help: How to add label such as "alpha" in plotting?