[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: floating point hex calc?



On Fri, Mar 07, 2003 at 06:21:57PM +0100, Vincent Lefevre wrote:
> On Fri, Mar 07, 2003 at 08:53:02 -0600, Kirk Strauser wrote:
> > `bc' comes with Debian. Start it with the -l flag (to do float
> > math), set ibase to 16, and enter A-F in caps. The ">" and ":" show
> > what I typed and what bc displayed, respectively.
> > 
> >     $ bc -l
> >     > ibase=16
> >     > A+B
> >     : 21
> >     > 1A.C9E
> >     : 26.788
> 
> But how about output in hexadecimal?
> 
>     $ bc -l
>     > ibase=16
>     > obase=16
>     > 1.23456
>     :  01.03 00 14 21
> 
> What does this means???

You need to enter obase before ibase, or else the output base you enter
will be interpreted in the input base you've set. That is, what you've
actually done above is set the ibase to 16 decimal and the obase to 22
decimal.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: